|
2 | 2 |
|
3 | 3 | import eslint from "@eslint/js"; |
4 | 4 | import eslintConfigPrettier from "eslint-config-prettier"; |
| 5 | +import globals from "globals"; |
| 6 | +import path from "node:path"; |
| 7 | +import { fileURLToPath } from "node:url"; |
5 | 8 | import tseslint from "typescript-eslint"; |
6 | 9 |
|
7 | | -const baseConfig = tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended); |
| 10 | +const tsconfigRootDir = path.dirname(fileURLToPath(new URL(import.meta.url))); |
8 | 11 |
|
9 | | -const customConfig = { |
10 | | - ...baseConfig, |
11 | | - overrides: [ |
12 | | - { |
13 | | - files: ["emain/emain.ts", "electron.vite.config.ts"], |
14 | | - env: { |
15 | | - node: true, |
| 12 | +export default [ |
| 13 | + { |
| 14 | + languageOptions: { |
| 15 | + parserOptions: { |
| 16 | + tsconfigRootDir, |
16 | 17 | }, |
17 | 18 | }, |
18 | | - ], |
19 | | -}; |
| 19 | + }, |
20 | 20 |
|
21 | | -export default [customConfig, eslintConfigPrettier]; |
| 21 | + { |
| 22 | + ignores: [ |
| 23 | + "**/node_modules/**", |
| 24 | + "**/dist/**", |
| 25 | + "**/build/**", |
| 26 | + "**/make/**", |
| 27 | + "tsunami/frontend/scaffold/**", |
| 28 | + "docs/.docusaurus/**", |
| 29 | + ], |
| 30 | + }, |
| 31 | + |
| 32 | + { |
| 33 | + files: ["frontend/**/*.{ts,tsx}", "emain/**/*.{ts,tsx}"], |
| 34 | + languageOptions: { |
| 35 | + parserOptions: { |
| 36 | + tsconfigRootDir, |
| 37 | + project: "./tsconfig.json", |
| 38 | + }, |
| 39 | + }, |
| 40 | + }, |
| 41 | + |
| 42 | + { |
| 43 | + files: ["docs/**/*.{ts,tsx}"], |
| 44 | + languageOptions: { |
| 45 | + parserOptions: { tsconfigRootDir, project: "./docs/tsconfig.json" }, |
| 46 | + }, |
| 47 | + }, |
| 48 | + |
| 49 | + eslint.configs.recommended, |
| 50 | + ...tseslint.configs.recommended, |
| 51 | + |
| 52 | + { |
| 53 | + rules: { |
| 54 | + "@typescript-eslint/no-explicit-any": "off", |
| 55 | + }, |
| 56 | + }, |
| 57 | + |
| 58 | + { |
| 59 | + files: ["emain/**/*.ts", "electron.vite.config.ts", "**/*.cjs", "eslint.config.js", "docs/babel.config.js"], |
| 60 | + languageOptions: { |
| 61 | + globals: { |
| 62 | + ...globals.node, |
| 63 | + }, |
| 64 | + }, |
| 65 | + }, |
| 66 | + |
| 67 | + { |
| 68 | + files: ["**/*.js", "**/*.cjs"], |
| 69 | + rules: { |
| 70 | + "@typescript-eslint/no-require-imports": "off", |
| 71 | + }, |
| 72 | + }, |
| 73 | + |
| 74 | + { |
| 75 | + rules: { |
| 76 | + "@typescript-eslint/no-unused-vars": "warn", |
| 77 | + "prefer-const": "warn", |
| 78 | + "no-empty": "warn", |
| 79 | + }, |
| 80 | + }, |
| 81 | + |
| 82 | + { |
| 83 | + files: ["frontend/app/store/services.ts"], |
| 84 | + rules: { |
| 85 | + "prefer-rest-params": "off", |
| 86 | + }, |
| 87 | + }, |
| 88 | + |
| 89 | + eslintConfigPrettier, |
| 90 | +]; |
0 commit comments