|
1 | 1 | { |
2 | 2 | "extends": [ |
3 | | - "@nuxtjs/eslint-config-typescript" |
| 3 | + "@nuxtjs/eslint-config-typescript", |
| 4 | + // Enable typescript-specific recommended rules |
| 5 | + "plugin:@typescript-eslint/recommended", |
| 6 | + // Turns off all rules that are unnecessary or might conflict with Prettier (needs to be last) |
| 7 | + "prettier" |
4 | 8 | ], |
| 9 | + "plugins": ["unused-imports"], |
5 | 10 | "rules": { |
6 | | - "@typescript-eslint/no-unused-vars": [ |
7 | | - "off" |
8 | | - ] |
9 | | - } |
| 11 | + // Workaround for bug https://github.com/nuxt/eslint-config/issues/147 |
| 12 | + "no-useless-constructor": "off", |
| 13 | + "@typescript-eslint/no-useless-constructor": "error", |
| 14 | + // Don"t report unused imports (this is handled by prettier) |
| 15 | + "unused-imports/no-unused-imports": "off", |
| 16 | + // Report unused variables (except the ones prefixed with an underscore) |
| 17 | + "unused-imports/no-unused-vars": [ |
| 18 | + "warn", |
| 19 | + { |
| 20 | + "vars": "all", |
| 21 | + "varsIgnorePattern": "^_", |
| 22 | + "args": "after-used", |
| 23 | + "argsIgnorePattern": "^_" |
| 24 | + } |
| 25 | + ], |
| 26 | + // Ensure void operator is not used, except for variable assignment or function return (might be handy for promises) |
| 27 | + "no-void": ["error", { "allowAsStatement": true }], |
| 28 | + // Demote this to warning as long as we are still using cjs modules |
| 29 | + "import/named": "warn", |
| 30 | + // Import order is handled by prettier (which is incompatible with this rule: https://github.com/simonhaenisch/prettier-plugin-organize-imports/issues/65) |
| 31 | + "import/order": "off" |
| 32 | + }, |
| 33 | + "overrides": [ |
| 34 | + { |
| 35 | + "files": ["*.ts", "*.vue"], |
| 36 | + // Parser supporting vue files |
| 37 | + "parser": "vue-eslint-parser", |
| 38 | + "parserOptions": { |
| 39 | + // Use ts parser for ts files and for the script tag in vue files |
| 40 | + "parser": "@typescript-eslint/parser", |
| 41 | + // Path to tsconfig to enable rules that require type information |
| 42 | + "project": "./tsconfig.eslint.json", |
| 43 | + // Correctly handle vue files |
| 44 | + "extraFileExtensions": [".vue"] |
| 45 | + }, |
| 46 | + "extends": [ |
| 47 | + // Enable recommended rules for typescript that use typing information (may be CPU intensive) |
| 48 | + "plugin:@typescript-eslint/recommended-requiring-type-checking" |
| 49 | + ] |
| 50 | + } |
| 51 | + ] |
10 | 52 | } |
0 commit comments