|
| 1 | +import js from "@eslint/js"; |
| 2 | +import globals from "globals"; |
| 3 | +import tseslint from "typescript-eslint"; |
| 4 | +import tseslintPlugin from "@typescript-eslint/eslint-plugin"; |
| 5 | +import tseslintParser from "@typescript-eslint/parser"; |
| 6 | +import reactHooks from "eslint-plugin-react-hooks"; |
| 7 | +import reactRefresh from "eslint-plugin-react-refresh"; |
| 8 | + |
| 9 | +export default tseslint.config( |
| 10 | + { ignores: ["dist"] }, |
| 11 | + { |
| 12 | + extends: [js.configs.recommended, ...tseslint.configs.recommended], |
| 13 | + files: ["**/*.{ts,tsx}"], |
| 14 | + languageOptions: { |
| 15 | + ecmaVersion: 2020, |
| 16 | + globals: globals.browser, |
| 17 | + parser: tseslintParser, |
| 18 | + }, |
| 19 | + plugins: { |
| 20 | + "@typescript-eslint": tseslintPlugin, |
| 21 | + "react-hooks": reactHooks, |
| 22 | + "react-refresh": reactRefresh, |
| 23 | + }, |
| 24 | + rules: { |
| 25 | + ...reactHooks.configs.recommended.rules, |
| 26 | + "react-refresh/only-export-components": [ |
| 27 | + "warn", |
| 28 | + { allowConstantExport: true }, |
| 29 | + ], |
| 30 | + "max-len": ["error", { code: 250 }], |
| 31 | + indent: ["error", 4, { SwitchCase: 1 }], |
| 32 | + "@typescript-eslint/no-explicit-any": "off", |
| 33 | + "no-trailing-spaces": "error", // Disallow trailing spaces |
| 34 | + "no-multi-spaces": "error", // Disallow multiple spaces |
| 35 | + "no-irregular-whitespace": "error", // Disallow irregular whitespace |
| 36 | + "space-in-parens": ["error", "never"], // Enforce spacing inside parentheses |
| 37 | + "space-before-function-paren": ["error", "always"], // Enforce spacing before function parenthesis |
| 38 | + "comma-spacing": ["error", { before: false, after: true }], // Enforce spacing after commas |
| 39 | + "object-curly-spacing": ["error", "never"], // Enforce spacing inside curly braces |
| 40 | + }, |
| 41 | + } |
| 42 | +); |
0 commit comments