|
| 1 | +import js from "@eslint/js"; |
| 2 | +import prettier from "eslint-config-prettier"; |
| 3 | +import react from "eslint-plugin-react"; |
| 4 | +import reactHooks from "eslint-plugin-react-hooks"; |
| 5 | +import globals from "globals"; |
| 6 | +import tseslint from "typescript-eslint"; |
| 7 | + |
| 8 | +export default tseslint.config( |
| 9 | + { |
| 10 | + ignores: [ |
| 11 | + "**/node_modules/", |
| 12 | + "**/dist/", |
| 13 | + "codemod/**/*.js", |
| 14 | + "codemod/**/*.d.ts", |
| 15 | + "demo/**/*", |
| 16 | + "eslint.config.mjs", |
| 17 | + ], |
| 18 | + }, |
| 19 | + { |
| 20 | + settings: { |
| 21 | + react: { version: "19" }, |
| 22 | + }, |
| 23 | + extends: [js.configs.recommended, ...tseslint.configs.recommended], |
| 24 | + languageOptions: { |
| 25 | + globals: globals.browser, |
| 26 | + ecmaVersion: 2020, |
| 27 | + sourceType: "module", |
| 28 | + parserOptions: { |
| 29 | + project: "./tsconfig.eslint.json", |
| 30 | + ecmaFeatures: { |
| 31 | + jsx: true, |
| 32 | + }, |
| 33 | + }, |
| 34 | + }, |
| 35 | + plugins: { |
| 36 | + react, |
| 37 | + "react-hooks": reactHooks, |
| 38 | + }, |
| 39 | + rules: { |
| 40 | + ...react.configs.recommended.rules, |
| 41 | + ...react.configs["jsx-runtime"].rules, |
| 42 | + ...reactHooks.configs.recommended.rules, |
| 43 | + curly: ["error", "all"], |
| 44 | + "no-console": "error", |
| 45 | + "react/function-component-definition": [ |
| 46 | + "error", |
| 47 | + { |
| 48 | + namedComponents: "arrow-function", |
| 49 | + unnamedComponents: "arrow-function", |
| 50 | + }, |
| 51 | + ], |
| 52 | + "react/jsx-filename-extension": [ |
| 53 | + "error", |
| 54 | + { |
| 55 | + extensions: [".tsx"], |
| 56 | + }, |
| 57 | + ], |
| 58 | + "@typescript-eslint/ban-ts-comment": "warn", |
| 59 | + "@typescript-eslint/consistent-type-imports": [ |
| 60 | + "warn", |
| 61 | + { |
| 62 | + prefer: "type-imports", |
| 63 | + disallowTypeAnnotations: true, |
| 64 | + }, |
| 65 | + ], |
| 66 | + "@typescript-eslint/no-deprecated": "warn", |
| 67 | + "@typescript-eslint/no-unused-vars": [ |
| 68 | + "error", |
| 69 | + { |
| 70 | + ignoreRestSiblings: true, |
| 71 | + }, |
| 72 | + ], |
| 73 | + }, |
| 74 | + }, |
| 75 | + { |
| 76 | + files: ["src/select/*.tsx"], |
| 77 | + rules: { |
| 78 | + "react/display-name": "off", |
| 79 | + }, |
| 80 | + }, |
| 81 | + { |
| 82 | + files: ["codemod/**/*.ts"], |
| 83 | + rules: { |
| 84 | + "no-console": "off", |
| 85 | + "@typescript-eslint/no-require-imports": "off", |
| 86 | + }, |
| 87 | + }, |
| 88 | + prettier |
| 89 | +); |
0 commit comments