|
| 1 | +import tsESLint from "@typescript-eslint/eslint-plugin" |
| 2 | +import tsParser from "@typescript-eslint/parser" |
| 3 | +import svelte from "eslint-plugin-svelte" |
| 4 | +import svelteParser from "svelte-eslint-parser" |
| 5 | +import stylistic from "@stylistic/eslint-plugin" |
| 6 | +import globals from "globals" |
| 7 | + |
| 8 | +const unusedVarsConfig = { |
| 9 | + args: "all", |
| 10 | + argsIgnorePattern: "^_", |
| 11 | + caughtErrors: "all", |
| 12 | + caughtErrorsIgnorePattern: "^_", |
| 13 | + destructuredArrayIgnorePattern: "^_", |
| 14 | + varsIgnorePattern: "^_", |
| 15 | + ignoreRestSiblings: true, |
| 16 | +} |
| 17 | + |
| 18 | +export default [ |
| 19 | + // Stylistic |
| 20 | + stylistic.configs.customize({ |
| 21 | + indent: 4, |
| 22 | + quotes: "double", |
| 23 | + semi: false, |
| 24 | + jsx: false, |
| 25 | + }), |
| 26 | + { |
| 27 | + plugins: { |
| 28 | + "@stylistic": stylistic, |
| 29 | + }, |
| 30 | + rules: { |
| 31 | + "@stylistic/object-curly-spacing": ["error", "always"], |
| 32 | + "@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }], |
| 33 | + }, |
| 34 | + }, |
| 35 | + |
| 36 | + // TypeScript |
| 37 | + { |
| 38 | + files: ["**/*.ts", "**/*.tsx"], |
| 39 | + languageOptions: { |
| 40 | + parser: tsParser, |
| 41 | + globals: { |
| 42 | + ...globals.browser, |
| 43 | + ...globals.node, |
| 44 | + }, |
| 45 | + }, |
| 46 | + plugins: { |
| 47 | + "@typescript-eslint": tsESLint, |
| 48 | + }, |
| 49 | + rules: { |
| 50 | + ...tsESLint.configs.recommended.rules, |
| 51 | + "@typescript-eslint/no-unused-vars": ["error", unusedVarsConfig], |
| 52 | + "@typescript-eslint/no-explicit-any": "warn", |
| 53 | + }, |
| 54 | + }, |
| 55 | + |
| 56 | + // Svelte |
| 57 | + ...svelte.configs.recommended, |
| 58 | + { |
| 59 | + files: ["**/*.svelte"], |
| 60 | + languageOptions: { |
| 61 | + parser: svelteParser, |
| 62 | + parserOptions: { |
| 63 | + parser: tsParser, |
| 64 | + }, |
| 65 | + globals: { |
| 66 | + ...globals.browser, |
| 67 | + }, |
| 68 | + }, |
| 69 | + plugins: { |
| 70 | + svelte, |
| 71 | + "@typescript-eslint": tsESLint, |
| 72 | + }, |
| 73 | + rules: { |
| 74 | + "svelte/no-dom-manipulating": "warn", |
| 75 | + "svelte/require-each-key": "warn", |
| 76 | + "svelte/css-unused-selector": "off", |
| 77 | + "svelte/no-unused-svelte-ignore": "off", |
| 78 | + "@typescript-eslint/no-unused-vars": ["error", unusedVarsConfig], |
| 79 | + "@typescript-eslint/no-explicit-any": "warn", |
| 80 | + }, |
| 81 | + }, |
| 82 | + |
| 83 | + { |
| 84 | + // Ignore generated files |
| 85 | + ignores: [ |
| 86 | + ".svelte-kit/**", |
| 87 | + "node_modules/**", |
| 88 | + "build/**", |
| 89 | + ], |
| 90 | + }, |
| 91 | +] |
0 commit comments