|
| 1 | +module.exports = { |
| 2 | + root: true, |
| 3 | + env: { |
| 4 | + node: true, |
| 5 | + }, |
| 6 | + extends: ['plugin:vue/essential', '@vue/airbnb', '@vue/typescript'], |
| 7 | + rules: { |
| 8 | + // js 和 ts 不需要检查 import 的文件后缀 |
| 9 | + 'import/extensions': [ |
| 10 | + 'error', |
| 11 | + 'always', |
| 12 | + { |
| 13 | + js: 'never', |
| 14 | + ts: 'never', |
| 15 | + }, |
| 16 | + ], |
| 17 | + 'no-restricted-syntax': [ |
| 18 | + 'error', |
| 19 | + 'WithStatement', |
| 20 | + 'BinaryExpression[operator=\'in\']', |
| 21 | + ], |
| 22 | + // 可以 debugger |
| 23 | + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, |
| 24 | + // 不要分号 |
| 25 | + semi: [2, 'never'], |
| 26 | + // 全部单引号 |
| 27 | + quotes: [2, 'single'], |
| 28 | + // 对象缩写 |
| 29 | + 'object-shorthand': 0, |
| 30 | + // 可以使用 console |
| 31 | + 'no-console': 0, |
| 32 | + // 允许使用匿名函数 |
| 33 | + 'func-names': 0, |
| 34 | + // 允许属性的 key 值加引号 |
| 35 | + 'quote-props': 0, |
| 36 | + // 允许对函数的参数赋值 |
| 37 | + 'no-param-reassign': 0, |
| 38 | + // 函数的参数可以不使用 |
| 39 | + 'no-unused-vars': 0, |
| 40 | + // 不用强制 export default |
| 41 | + 'import/prefer-default-export': 0, |
| 42 | + // 不禁止箭头函数直接return对象 |
| 43 | + 'arrow-body-style': 0, |
| 44 | + // 允许空行 |
| 45 | + 'no-trailing-spaces': ['error', { skipBlankLines: true }], |
| 46 | + // 允许short circuit evaluations |
| 47 | + 'no-unused-expressions': [ |
| 48 | + 'error', |
| 49 | + { allowShortCircuit: true, allowTernary: true }, |
| 50 | + ], |
| 51 | + // 最长字符 |
| 52 | + 'max-len': ['error', { code: 1500 }], |
| 53 | + 'vue/no-parsing-error': [ |
| 54 | + 2, |
| 55 | + { |
| 56 | + 'invalid-first-character-of-tag-name': false, |
| 57 | + }, |
| 58 | + ], |
| 59 | + // no-plusplus |
| 60 | + 'no-plusplus': 0, |
| 61 | + 'class-methods-use-this': 0, |
| 62 | + 'no-irregular-whitespace': 0, |
| 63 | + 'consistent-return': 0, |
| 64 | + 'import/no-extraneous-dependencies': 0, |
| 65 | + 'global-require': 0, |
| 66 | + 'no-continue': 0, |
| 67 | + 'linebreak-style': 0, |
| 68 | + }, |
| 69 | + parserOptions: { |
| 70 | + parser: '@typescript-eslint/parser', |
| 71 | + }, |
| 72 | +} |
0 commit comments