2020-07-27 16:17:41 +08:00
|
|
|
module.exports = {
|
|
|
|
parser: 'vue-eslint-parser',
|
|
|
|
parserOptions: {
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
sourceType: 'module',
|
2020-09-15 12:28:12 +08:00
|
|
|
ecmaFeatures: {
|
|
|
|
jsx: true,
|
|
|
|
tsx: true,
|
|
|
|
},
|
2020-07-27 16:17:41 +08:00
|
|
|
},
|
|
|
|
env: {
|
|
|
|
browser: true,
|
|
|
|
node: true,
|
|
|
|
},
|
2021-09-17 15:27:31 +08:00
|
|
|
globals: {
|
|
|
|
jest: 'readonly',
|
|
|
|
},
|
|
|
|
plugins: ['@typescript-eslint', 'prettier', 'import'],
|
2020-07-27 16:17:41 +08:00
|
|
|
extends: [
|
2021-09-17 15:27:31 +08:00
|
|
|
'eslint:recommended',
|
2020-07-27 16:17:41 +08:00
|
|
|
'plugin:@typescript-eslint/recommended',
|
|
|
|
'plugin:vue/vue3-recommended',
|
2021-09-04 19:29:28 +08:00
|
|
|
'prettier',
|
|
|
|
],
|
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: ['*.ts'],
|
|
|
|
rules: {
|
|
|
|
'no-undef': 'off',
|
|
|
|
},
|
|
|
|
},
|
2021-09-09 11:49:48 +08:00
|
|
|
{
|
|
|
|
files: ['**/__tests__/**'],
|
|
|
|
rules: {
|
|
|
|
'no-console': 'off',
|
|
|
|
},
|
|
|
|
},
|
2020-07-27 16:17:41 +08:00
|
|
|
],
|
|
|
|
rules: {
|
2021-08-27 17:46:06 +08:00
|
|
|
// js/ts
|
2021-09-04 19:29:28 +08:00
|
|
|
'no-unused-vars': 'off',
|
|
|
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
|
|
'no-redeclare': 'off',
|
|
|
|
'@typescript-eslint/no-redeclare': 'error',
|
2021-09-09 11:49:48 +08:00
|
|
|
'no-console': ['warn', { allow: ['error'] }],
|
2021-09-04 19:29:28 +08:00
|
|
|
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
|
2021-08-27 17:46:06 +08:00
|
|
|
camelcase: ['error', { properties: 'never' }],
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
|
|
'no-var': 'error',
|
2021-09-17 15:27:31 +08:00
|
|
|
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
|
|
'no-with': 'error',
|
|
|
|
'no-void': 'error',
|
2021-09-04 19:29:28 +08:00
|
|
|
'prefer-const': [
|
|
|
|
'warn',
|
|
|
|
{ destructuring: 'all', ignoreReadBeforeAssign: true },
|
|
|
|
],
|
2021-09-17 09:18:24 +08:00
|
|
|
'prefer-template': 'error',
|
2021-09-04 19:29:28 +08:00
|
|
|
'object-shorthand': [
|
2020-08-19 21:35:40 +08:00
|
|
|
'error',
|
2021-09-04 19:29:28 +08:00
|
|
|
'always',
|
|
|
|
{ ignoreConstructors: false, avoidQuotes: true },
|
2020-08-19 21:35:40 +08:00
|
|
|
],
|
2021-09-04 19:29:28 +08:00
|
|
|
'block-scoped-var': 'error',
|
2021-09-17 15:27:31 +08:00
|
|
|
'no-constant-condition': ['error', { checkLoops: false }],
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
2021-09-12 19:38:48 +08:00
|
|
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
|
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
2021-09-17 15:27:31 +08:00
|
|
|
'@typescript-eslint/consistent-type-imports': [
|
|
|
|
'error',
|
|
|
|
{ disallowTypeAnnotations: false },
|
|
|
|
],
|
2021-08-27 17:46:06 +08:00
|
|
|
|
2020-07-27 16:17:41 +08:00
|
|
|
// vue
|
2020-08-19 21:35:40 +08:00
|
|
|
'vue/no-v-html': 'off',
|
|
|
|
'vue/require-default-prop': 'off',
|
2021-09-12 19:38:48 +08:00
|
|
|
'vue/require-explicit-emits': 'off',
|
2021-09-04 19:29:28 +08:00
|
|
|
|
2021-09-17 15:27:31 +08:00
|
|
|
'prettier/prettier': 'error',
|
|
|
|
|
|
|
|
// import
|
|
|
|
'import/first': 'error',
|
|
|
|
'import/no-duplicates': 'error',
|
|
|
|
'import/order': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
groups: [
|
|
|
|
'builtin',
|
|
|
|
'external',
|
|
|
|
'internal',
|
|
|
|
'parent',
|
|
|
|
'sibling',
|
|
|
|
'index',
|
|
|
|
'object',
|
|
|
|
'type',
|
|
|
|
],
|
|
|
|
|
|
|
|
pathGroups: [
|
|
|
|
{
|
|
|
|
pattern: 'vue',
|
|
|
|
group: 'external',
|
|
|
|
position: 'before',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
pattern: '@vue/**',
|
|
|
|
group: 'external',
|
|
|
|
position: 'before',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
pattern: '@element-plus/**',
|
|
|
|
group: 'internal',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
pathGroupsExcludedImportTypes: ['type'],
|
|
|
|
},
|
|
|
|
],
|
2020-07-27 16:17:41 +08:00
|
|
|
},
|
|
|
|
}
|