|
| 1 | +import eslint from "@eslint/js"; |
| 2 | +import tseslint from "typescript-eslint"; |
| 3 | +import globals from "globals"; |
| 4 | +import reactHooks from "eslint-plugin-react-hooks"; |
| 5 | + |
| 6 | +export default tseslint.config( |
| 7 | + eslint.configs.recommended, |
| 8 | + ...tseslint.configs.recommended, |
| 9 | + { |
| 10 | + files: ["**/*.ts", "**/*.tsx"], |
| 11 | + plugins: { |
| 12 | + "react-hooks": reactHooks, |
| 13 | + }, |
| 14 | + languageOptions: { |
| 15 | + globals: { |
| 16 | + ...globals.node, |
| 17 | + ...globals.es2022, |
| 18 | + }, |
| 19 | + parserOptions: { |
| 20 | + projectService: true, |
| 21 | + }, |
| 22 | + }, |
| 23 | + rules: { |
| 24 | + "@typescript-eslint/no-explicit-any": "warn", |
| 25 | + "@typescript-eslint/no-unused-vars": [ |
| 26 | + "error", |
| 27 | + { varsIgnorePattern: "^_", argsIgnorePattern: "^_" }, |
| 28 | + ], |
| 29 | + "@typescript-eslint/no-namespace": "off", |
| 30 | + "@typescript-eslint/no-empty-object-type": "off", |
| 31 | + "no-console": "warn", |
| 32 | + "require-yield": "off", |
| 33 | + "react-hooks/rules-of-hooks": "error", |
| 34 | + "react-hooks/exhaustive-deps": "warn", |
| 35 | + "no-restricted-imports": [ |
| 36 | + "error", |
| 37 | + { |
| 38 | + patterns: [ |
| 39 | + { |
| 40 | + group: ["../types/*/index*", "../types/*/index"], |
| 41 | + message: "Use #types/* alias instead of relative imports", |
| 42 | + }, |
| 43 | + { |
| 44 | + group: [ |
| 45 | + "../materials/*", |
| 46 | + "../data/*", |
| 47 | + "../pointer/*", |
| 48 | + "../program/*", |
| 49 | + "../type/*", |
| 50 | + ], |
| 51 | + message: "Use #types/* alias instead of relative imports", |
| 52 | + }, |
| 53 | + { |
| 54 | + group: ["../../test/*", "../../../test/*"], |
| 55 | + message: "Use #test/* alias instead of relative imports", |
| 56 | + }, |
| 57 | + { |
| 58 | + group: ["../describe*"], |
| 59 | + message: "Use #describe alias instead of relative imports", |
| 60 | + }, |
| 61 | + ], |
| 62 | + }, |
| 63 | + ], |
| 64 | + }, |
| 65 | + }, |
| 66 | + { |
| 67 | + ignores: [ |
| 68 | + "node_modules/", |
| 69 | + "**/dist/", |
| 70 | + "coverage/", |
| 71 | + "**/*.d.ts", |
| 72 | + "**/*.config.js", |
| 73 | + "**/*.config.ts", |
| 74 | + "packages/format/src/schemas/yamls.ts", |
| 75 | + "packages/web/.docusaurus/", |
| 76 | + "packages/web/build/", |
| 77 | + ], |
| 78 | + }, |
| 79 | +); |
0 commit comments