|
| 1 | +import js from "@eslint/js"; |
| 2 | +import stylistic from "@stylistic/eslint-plugin"; |
| 3 | +import importPlugin from "eslint-plugin-import"; |
| 4 | +import globals from "globals"; |
| 5 | +import tseslint from "typescript-eslint"; |
| 6 | + |
| 7 | + |
| 8 | +export default [ |
| 9 | + js.configs.recommended, |
| 10 | + ...tseslint.configs.recommendedTypeChecked, |
| 11 | + ...tseslint.configs.stylisticTypeChecked, |
| 12 | + importPlugin.flatConfigs.recommended, |
| 13 | + stylistic.configs.customize({ |
| 14 | + arrowParens: true, |
| 15 | + braceStyle: "1tbs", |
| 16 | + commaDangle: "never", |
| 17 | + flat: true, |
| 18 | + jsx: false, |
| 19 | + quotes: "double", |
| 20 | + semi: true |
| 21 | + }), |
| 22 | + { |
| 23 | + languageOptions: { |
| 24 | + ecmaVersion: "latest", |
| 25 | + globals: { |
| 26 | + ...globals.node |
| 27 | + }, |
| 28 | + parserOptions: { |
| 29 | + projectService: true, |
| 30 | + tsconfigRootDir: import.meta.dirname |
| 31 | + } |
| 32 | + }, |
| 33 | + settings: { |
| 34 | + "import/resolver": { |
| 35 | + node: {}, |
| 36 | + typescript: {} |
| 37 | + } |
| 38 | + }, |
| 39 | + rules: { |
| 40 | + // JavaScript |
| 41 | + "no-console": ["error"], |
| 42 | + "no-empty-function": "off", |
| 43 | + "no-fallthrough": "off", |
| 44 | + |
| 45 | + // TypeScript |
| 46 | + "@typescript-eslint/no-unused-vars": ["error", { caughtErrorsIgnorePattern: "^_" }], |
| 47 | + "@typescript-eslint/no-empty-function": "off", |
| 48 | + "@typescript-eslint/consistent-type-definitions": ["error", "type"], |
| 49 | + |
| 50 | + // Imports |
| 51 | + "import/extensions": ["error", "ignorePackages"], |
| 52 | + "import/newline-after-import": ["error", { count: 2, exactCount: false, considerComments: true }], |
| 53 | + |
| 54 | + // Stylistic |
| 55 | + "@stylistic/multiline-ternary": "off", |
| 56 | + "@stylistic/no-mixed-operators": "off", |
| 57 | + "@stylistic/no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0, maxBOF: 0 }], // Allow max=2 for imports |
| 58 | + "@stylistic/quote-props": ["error", "consistent"], |
| 59 | + "@stylistic/yield-star-spacing": ["error", "after"] |
| 60 | + } |
| 61 | + }, |
| 62 | + { |
| 63 | + files: ["**/*.js"], |
| 64 | + ...tseslint.configs.disableTypeChecked |
| 65 | + } |
| 66 | +]; |
0 commit comments