|
| 1 | +import js from "@eslint/js"; |
| 2 | +import tseslint from "@typescript-eslint/eslint-plugin"; |
| 3 | +import tsparser from "@typescript-eslint/parser"; |
| 4 | + |
| 5 | +export default [ |
| 6 | + js.configs.recommended, |
| 7 | + { |
| 8 | + files: ["**/*.ts", "**/*.tsx"], |
| 9 | + languageOptions: { |
| 10 | + parser: tsparser, |
| 11 | + parserOptions: { |
| 12 | + ecmaVersion: "latest", |
| 13 | + sourceType: "module", |
| 14 | + }, |
| 15 | + globals: { |
| 16 | + console: "readonly", |
| 17 | + process: "readonly", |
| 18 | + Buffer: "readonly", |
| 19 | + __dirname: "readonly", |
| 20 | + __filename: "readonly", |
| 21 | + global: "readonly", |
| 22 | + module: "readonly", |
| 23 | + require: "readonly", |
| 24 | + }, |
| 25 | + }, |
| 26 | + plugins: { |
| 27 | + "@typescript-eslint": tseslint, |
| 28 | + }, |
| 29 | + rules: { |
| 30 | + // 1. No unused vars with underscore prefix exception |
| 31 | + "no-unused-vars": "off", |
| 32 | + "@typescript-eslint/no-unused-vars": [ |
| 33 | + "error", |
| 34 | + { |
| 35 | + vars: "all", |
| 36 | + args: "after-used", |
| 37 | + ignoreRestSiblings: true, |
| 38 | + varsIgnorePattern: "^_", |
| 39 | + argsIgnorePattern: "^_", |
| 40 | + caughtErrorsIgnorePattern: "^_", |
| 41 | + destructuredArrayIgnorePattern: "^_", |
| 42 | + }, |
| 43 | + ], |
| 44 | + |
| 45 | + // 2. No extra whitespaces and newlines |
| 46 | + "no-trailing-spaces": "error", |
| 47 | + "no-multiple-empty-lines": [ |
| 48 | + "error", |
| 49 | + { |
| 50 | + max: 1, |
| 51 | + maxEOF: 0, |
| 52 | + maxBOF: 0, |
| 53 | + }, |
| 54 | + ], |
| 55 | + "eol-last": ["error", "always"], |
| 56 | + "no-irregular-whitespace": "error", |
| 57 | + "no-mixed-spaces-and-tabs": "error", |
| 58 | + |
| 59 | + // Additional whitespace rules |
| 60 | + semi: ["error", "always"], |
| 61 | + quotes: ["error", "double", { avoidEscape: true }], |
| 62 | + "comma-spacing": ["error", { before: false, after: true }], |
| 63 | + "key-spacing": ["error", { beforeColon: false, afterColon: true }], |
| 64 | + "space-before-blocks": "error", |
| 65 | + "space-infix-ops": "error", |
| 66 | + "object-curly-spacing": ["error", "always"], |
| 67 | + "array-bracket-spacing": ["error", "never"], |
| 68 | + }, |
| 69 | + }, |
| 70 | + { |
| 71 | + files: ["**/*.d.ts"], |
| 72 | + rules: { |
| 73 | + "@typescript-eslint/no-unused-vars": "off", |
| 74 | + }, |
| 75 | + }, |
| 76 | + { |
| 77 | + ignores: [ |
| 78 | + "**/node_modules/**", |
| 79 | + "**/dist/**", |
| 80 | + "**/build/**", |
| 81 | + "**/src/templates/*/project-files/", |
| 82 | + ], |
| 83 | + }, |
| 84 | +]; |
0 commit comments