|
| 1 | +const { resolve } = require('path'); |
1 | 2 | module.exports = {
|
| 3 | + // https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy |
| 4 | + // This option interrupts the configuration hierarchy at this file |
| 5 | + // Remove this if you have an higher level ESLint config file (it usually happens into a monorepos) |
| 6 | + root: true, |
| 7 | + |
| 8 | + // https://eslint.vuejs.org/user-guide/#how-to-use-custom-parser |
| 9 | + // Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working |
| 10 | + // `parser: 'vue-eslint-parser'` is already included with any 'plugin:vue/**' config and should be omitted |
| 11 | + parserOptions: { |
| 12 | + // https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#configuration |
| 13 | + // https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#eslint |
| 14 | + // Needed to make the parser take into account 'vue' files |
| 15 | + extraFileExtensions: ['.vue'], |
| 16 | + parser: '@typescript-eslint/parser', |
| 17 | + project: resolve(__dirname, './tsconfig.json'), |
| 18 | + tsconfigRootDir: __dirname, |
| 19 | + ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features |
| 20 | + sourceType: 'module' // Allows for the use of imports |
| 21 | + }, |
| 22 | + |
2 | 23 | env: {
|
3 |
| - browser: true, |
4 |
| - es2021: true, |
5 |
| - jquery: true |
| 24 | + browser: true |
6 | 25 | },
|
7 |
| - extends: 'airbnb-base', |
8 |
| - overrides: [ |
9 |
| - { |
10 |
| - env: { |
11 |
| - node: true |
12 |
| - }, |
13 |
| - files: [ |
14 |
| - '.eslintrc.{js,cjs}' |
15 |
| - ], |
16 |
| - parserOptions: { |
17 |
| - sourceType: 'script' |
18 |
| - } |
19 |
| - } |
| 26 | + |
| 27 | + ignorePatterns: [ |
| 28 | + 'vite.config.js' |
20 | 29 | ],
|
21 |
| - parserOptions: { |
22 |
| - ecmaVersion: 'latest', |
23 |
| - sourceType: 'module' |
24 |
| - }, |
| 30 | + |
| 31 | + // Rules order is important, please avoid shuffling them |
| 32 | + extends: [ |
| 33 | + // Base ESLint recommended rules |
| 34 | + // 'eslint:recommended', |
| 35 | + |
| 36 | + // https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#usage |
| 37 | + // ESLint typescript rules |
| 38 | + 'plugin:@typescript-eslint/recommended', |
| 39 | + // consider disabling this class of rules if linting takes too long |
| 40 | + 'plugin:@typescript-eslint/recommended-requiring-type-checking' |
| 41 | + ], |
| 42 | + |
| 43 | + plugins: [ |
| 44 | + // required to apply rules which need type information |
| 45 | + '@typescript-eslint', |
| 46 | + 'import' |
| 47 | + ], |
| 48 | + |
| 49 | + // add your custom rules here |
25 | 50 | rules: {
|
26 |
| - 'no-plusplus': 'off', |
27 |
| - 'comma-dangle': ['error', 'never'], |
28 |
| - 'no-console': 'warn', |
29 |
| - 'max-len': ['error', { code: 130 }], |
30 |
| - 'no-else-return': 'warn', |
31 |
| - 'no-param-reassign': 'off', |
32 |
| - 'prefer-destructuring': 'off', |
33 |
| - 'prefer-template': 'warn', |
34 |
| - 'no-continue': 'off', |
35 |
| - 'space-before-function-paren': ['error', { anonymous: 'never', named: 'always' }], |
36 |
| - 'no-await-in-loop': 'off', |
37 |
| - 'class-methods-use-this': 'off', |
38 |
| - indent: ['error', 2] |
| 51 | + // allow async-await |
| 52 | + 'generator-star-spacing': 'off', |
| 53 | + // allow paren-less arrow functions |
| 54 | + 'arrow-parens': 'off', |
| 55 | + 'one-var': 'off', |
| 56 | + 'no-void': 'off', |
| 57 | + 'multiline-ternary': 'off', |
| 58 | + |
| 59 | + 'import/first': 'off', |
| 60 | + 'import/namespace': 'error', |
| 61 | + 'import/default': 'error', |
| 62 | + 'import/export': 'error', |
| 63 | + 'import/extensions': 'off', |
| 64 | + 'import/no-unresolved': 'off', |
| 65 | + 'import/no-extraneous-dependencies': 'off', |
| 66 | + 'prefer-promise-reject-errors': 'off', |
| 67 | + 'space-before-function-paren': 'error', |
| 68 | + semi: [2, 'always'], |
| 69 | + indent: ['error', 2], |
| 70 | + |
| 71 | + // TypeScript |
| 72 | + quotes: ['warn', 'single', { avoidEscape: true }], |
| 73 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 74 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 75 | + '@typescript-eslint/no-unnecessary-type-assertion': 'off', |
| 76 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
| 77 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
| 78 | + '@typescript-eslint/no-unsafe-call': 'off', |
| 79 | + '@typescript-eslint/no-explicit-any': 'off', |
| 80 | + '@typescript-eslint/restrict-template-expressions': 'off', |
| 81 | + '@typescript-eslint/no-misused-promises': 'off', |
| 82 | + '@typescript-eslint/no-unsafe-argument': 'off', |
| 83 | + |
| 84 | + |
| 85 | + // allow debugger during development only |
| 86 | + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' |
39 | 87 | }
|
40 | 88 | };
|
0 commit comments