2022-07-03 02:38:58 +08:00
|
|
|
module.exports = {
|
2021-05-04 21:54:05 +08:00
|
|
|
root: true,
|
|
|
|
env: {
|
|
|
|
browser: true,
|
|
|
|
node: true,
|
2022-01-01 01:31:04 +08:00
|
|
|
es6: true,
|
2021-05-04 21:54:05 +08:00
|
|
|
},
|
|
|
|
parser: 'vue-eslint-parser',
|
|
|
|
parserOptions: {
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
ecmaVersion: 2020,
|
|
|
|
sourceType: 'module',
|
|
|
|
jsxPragma: 'React',
|
|
|
|
ecmaFeatures: {
|
2022-01-01 01:31:04 +08:00
|
|
|
jsx: true,
|
2022-07-03 02:38:58 +08:00
|
|
|
tsx: true,
|
2022-01-01 01:31:04 +08:00
|
|
|
},
|
2021-05-04 21:54:05 +08:00
|
|
|
},
|
2022-07-03 02:38:58 +08:00
|
|
|
plugins: ['@typescript-eslint', 'prettier', 'import'],
|
2021-05-04 21:54:05 +08:00
|
|
|
extends: [
|
2022-07-03 02:38:58 +08:00
|
|
|
'eslint:recommended',
|
2021-05-04 21:54:05 +08:00
|
|
|
'plugin:@typescript-eslint/recommended',
|
2022-07-03 02:38:58 +08:00
|
|
|
'plugin:vue/vue3-recommended',
|
2022-01-01 01:31:04 +08:00
|
|
|
'prettier',
|
2022-07-03 02:38:58 +08:00
|
|
|
],
|
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: ['*.ts', '*.tsx', '*.vue'],
|
|
|
|
rules: {
|
|
|
|
'no-undef': 'off',
|
|
|
|
},
|
|
|
|
},
|
2021-05-04 21:54:05 +08:00
|
|
|
],
|
|
|
|
rules: {
|
2022-07-03 02:38:58 +08:00
|
|
|
// js/ts
|
|
|
|
// 'no-console': ['warn', { allow: ['error'] }],
|
|
|
|
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
|
|
|
|
camelcase: ['error', { properties: 'never' }],
|
|
|
|
|
|
|
|
'no-var': 'error',
|
|
|
|
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
|
|
'no-void': 'error',
|
|
|
|
'prefer-const': ['warn', { destructuring: 'all', ignoreReadBeforeAssign: true }],
|
|
|
|
'prefer-template': 'error',
|
|
|
|
'object-shorthand': ['error', 'always', { ignoreConstructors: false, avoidQuotes: true }],
|
|
|
|
'block-scoped-var': 'error',
|
|
|
|
'no-constant-condition': ['error', { checkLoops: false }],
|
|
|
|
|
|
|
|
'no-redeclare': 'off',
|
|
|
|
'@typescript-eslint/no-redeclare': 'error',
|
2022-01-01 01:31:04 +08:00
|
|
|
'@typescript-eslint/ban-ts-comment': 'off',
|
2021-05-04 21:54:05 +08:00
|
|
|
'@typescript-eslint/ban-types': 'off',
|
2021-05-06 20:10:19 +08:00
|
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
2022-07-03 02:38:58 +08:00
|
|
|
'@typescript-eslint/no-empty-function': 'off',
|
|
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
|
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
|
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
|
|
|
// '@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
|
|
|
|
'@typescript-eslint/no-var-requires': 'off',
|
2022-01-01 01:31:04 +08:00
|
|
|
'@typescript-eslint/no-unused-vars': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
argsIgnorePattern: '^_',
|
|
|
|
varsIgnorePattern: '^_',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'no-unused-vars': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
argsIgnorePattern: '^_',
|
|
|
|
varsIgnorePattern: '^_',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
2022-07-03 02:38:58 +08:00
|
|
|
// vue
|
|
|
|
'vue/no-v-html': 'off',
|
2022-01-01 01:31:04 +08:00
|
|
|
'vue/require-default-prop': 'off',
|
|
|
|
'vue/require-explicit-emits': 'off',
|
2022-07-03 02:38:58 +08:00
|
|
|
'vue/multi-word-component-names': 'off',
|
|
|
|
'vue/one-component-per-file': 'off',
|
|
|
|
|
|
|
|
// prettier
|
|
|
|
'prettier/prettier': 'error',
|
|
|
|
|
|
|
|
// import
|
|
|
|
'import/first': 'error',
|
|
|
|
'import/no-duplicates': 'error',
|
|
|
|
'import/order': [
|
2021-05-06 20:10:19 +08:00
|
|
|
'error',
|
|
|
|
{
|
2022-07-03 02:38:58 +08:00
|
|
|
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
|
|
|
|
|
|
|
pathGroups: [
|
|
|
|
{
|
|
|
|
pattern: 'vue',
|
|
|
|
group: 'external',
|
|
|
|
position: 'before',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
pattern: '@vue/**',
|
|
|
|
group: 'external',
|
|
|
|
position: 'before',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
pattern: 'ant-design-vue',
|
|
|
|
group: 'internal',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
pathGroupsExcludedImportTypes: ['type'],
|
2022-01-01 01:31:04 +08:00
|
|
|
},
|
|
|
|
],
|
2021-05-04 21:54:05 +08:00
|
|
|
},
|
2022-07-03 02:38:58 +08:00
|
|
|
};
|