|
| 1 | +import eslint from "@eslint/js"; |
| 2 | +import tseslint from "typescript-eslint"; |
| 3 | +import stylistic from '@stylistic/eslint-plugin' |
| 4 | +import vitest from "@vitest/eslint-plugin" |
| 5 | + |
| 6 | +export default tseslint.config( |
| 7 | + eslint.configs.recommended, |
| 8 | + ...tseslint.configs.strictTypeChecked, |
| 9 | + ...tseslint.configs.stylisticTypeChecked, |
| 10 | + stylistic.configs.customize({ |
| 11 | + indent: 4, |
| 12 | + quotes: "double", |
| 13 | + semi: true, |
| 14 | + quoteProps: "consistent-as-needed", |
| 15 | + braceStyle: "1tbs", |
| 16 | + }), |
| 17 | + { |
| 18 | + files: ["**/*.test.ts"], |
| 19 | + plugins: { |
| 20 | + vitest |
| 21 | + }, |
| 22 | + rules: { |
| 23 | + ...vitest.configs.recommended.rules, |
| 24 | + 'vitest/valid-title': 'warn', |
| 25 | + 'vitest/no-commented-out-tests': 'warn' |
| 26 | + } |
| 27 | + }, |
| 28 | + { |
| 29 | + files: ["**/*.ts", "**/*.tsx"], |
| 30 | + |
| 31 | + languageOptions: { |
| 32 | + parserOptions: { |
| 33 | + project: "./tsconfig.json", |
| 34 | + tsconfigRootDir: import.meta.dirname, |
| 35 | + }, |
| 36 | + }, |
| 37 | + |
| 38 | + rules: { |
| 39 | + // Extra rules |
| 40 | + "eqeqeq": ["error", "always", { |
| 41 | + null: "ignore", |
| 42 | + }], |
| 43 | + "no-self-compare": "error", |
| 44 | + "no-template-curly-in-string": "error", |
| 45 | + "no-useless-assignment": "error", |
| 46 | + "no-nested-ternary": "error", |
| 47 | + "no-return-assign": "error", |
| 48 | + "no-sequences": "error", |
| 49 | + "no-var": "error", |
| 50 | + "arrow-body-style": ["error", "as-needed"], |
| 51 | + "func-style": ["error", "declaration", { |
| 52 | + allowArrowFunctions: true, |
| 53 | + }], |
| 54 | + "curly": ["error", "all"], |
| 55 | + "object-shorthand": ["error", "always"], |
| 56 | + "operator-assignment": ["error", "always"], |
| 57 | + "camelcase": ["error", { |
| 58 | + properties: "always", |
| 59 | + }], |
| 60 | + |
| 61 | + // Rules I don't want |
| 62 | + "@typescript-eslint/restrict-template-expressions": "off", |
| 63 | + |
| 64 | + // Extra code styling rules |
| 65 | + "@stylistic/array-bracket-newline": ["error", "consistent"], |
| 66 | + "@stylistic/array-element-newline": ["error", "consistent"], |
| 67 | + "@/func-call-spacing": ["error", "never"], |
| 68 | + "@stylistic/function-paren-newline": ["error", "multiline"], |
| 69 | + "@stylistic/implicit-arrow-linebreak": ["error", "beside"], |
| 70 | + |
| 71 | + "@stylistic/object-curly-newline": ["error", { |
| 72 | + multiline: true, |
| 73 | + consistent: true, |
| 74 | + }], |
| 75 | + |
| 76 | + "@stylistic/object-property-newline": ["error", { |
| 77 | + allowAllPropertiesOnSameLine: true, |
| 78 | + }], |
| 79 | + |
| 80 | + "@stylistic/operator-linebreak": ["off"], |
| 81 | + "@stylistic/semi-style": ["error", "last"], |
| 82 | + "@stylistic/space-before-function-paren": ["error", "always"], |
| 83 | + }, |
| 84 | + }, |
| 85 | + { |
| 86 | + ignores: ["**/node_modules", "**/dist", "eslint.config.mjs", "**/difflib"], |
| 87 | + }, |
| 88 | +); |
0 commit comments