File size: 3,473 Bytes
0ad74ed |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
import globals from "globals";
import ts_plugin from "@typescript-eslint/eslint-plugin";
import js_plugin from "@eslint/js";
import jsdoc from "eslint-plugin-jsdoc";
import typescriptParser from "@typescript-eslint/parser";
import sveltePlugin from "eslint-plugin-svelte";
import svelteParser from "svelte-eslint-parser";
const ts_rules_disabled = Object.fromEntries(
Object.keys(ts_plugin.rules).map((rule) => [
`@typescript-eslint/${rule}`,
"off"
])
);
const js_rules_disabled = Object.fromEntries(
Object.keys(js_plugin.configs.all.rules).map((rule) => [rule, "off"])
);
const jsdoc_rules_disabled = Object.fromEntries(
Object.keys(jsdoc.configs.recommended.rules).map((rule) => [
`jsdoc/${rule}`,
"off"
])
);
const js_rules = {
...js_rules_disabled,
"no-console": ["error", { allow: ["warn", "error", "debug", "info"] }],
"no-constant-condition": "error",
"no-dupe-args": "error",
"no-extra-boolean-cast": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"array-callback-return": "error",
complexity: "error",
"no-else-return": "error",
"no-useless-return": "error",
"no-undef": "error"
};
const ts_rules = {
...ts_rules_disabled,
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{ allowExpressions: true }
],
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/no-inferrable-types": "error"
};
const jsdoc_rules = {
...jsdoc_rules_disabled,
"jsdoc/require-param-description": "error",
"jsdoc/require-returns-description": "error"
};
const { browser, es2021, node } = globals;
export default [
{
ignores: [
"**/.svelte-kit/**/*",
"**/node_modules/**",
"**/dist/**",
"**/.config/*",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.node-test.ts",
"js/spa/test/**/*",
"**/*vite.config.ts",
"**/_website/**/*",
"**/app/**/*",
"**/_spaces-test/**/*",
"**/preview/test/**/*",
"**/component-test/**/*",
"**/js/wasm/src/webworker/**/*"
]
},
{
files: ["**/*.js", "**/*.cjs"],
languageOptions: {
globals: {
...browser,
...es2021,
...node
}
},
plugins: {
"eslint:recommended": js_plugin,
jsdoc
},
rules: { ...js_rules, ...jsdoc_rules }
},
{
files: ["**/*.ts"],
languageOptions: {
parser: typescriptParser,
parserOptions: {
project: "./tsconfig.json",
extraFileExtensions: [".svelte"]
},
globals: {
...browser,
...es2021,
...node
}
},
plugins: {
"@typescript-eslint": ts_plugin,
"eslint:recommended": js_plugin,
jsdoc
},
rules: {
...ts_rules,
...js_rules,
...jsdoc_rules,
"no-undef": "off"
}
},
{
files: ["**/client/js/**"],
languageOptions: {
parserOptions: {
project: "./client/js/tsconfig.json"
}
}
},
{
files: ["**/*.svelte"],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: typescriptParser,
project: "./tsconfig.json",
extraFileExtensions: [".svelte"]
},
globals: {
...browser,
...es2021
}
},
plugins: {
svelte: sveltePlugin,
"@typescript-eslint": ts_plugin,
"eslint:recommended": js_plugin,
jsdoc
},
rules: {
...ts_rules,
...js_rules,
...jsdoc_rules,
...sveltePlugin.configs.recommended.rules,
"svelte/no-at-html-tags": "off",
"no-undef": "off"
}
}
];
|