mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-21 02:50:11 +08:00
d8954f945e
* chore: make eslints work in docs folder * refactor(dev): improve eslint * fix eslint issue Co-authored-by: Kevin <sxzz@sxzz.moe> Co-authored-by: jeremywuuuuu <15975785+JeremyWuuuuu@users.noreply.github.com>
121 lines
2.8 KiB
JavaScript
121 lines
2.8 KiB
JavaScript
module.exports = {
|
|
root: true,
|
|
parser: 'vue-eslint-parser',
|
|
parserOptions: {
|
|
parser: '@typescript-eslint/parser',
|
|
sourceType: 'module',
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
tsx: true,
|
|
},
|
|
},
|
|
env: {
|
|
browser: true,
|
|
node: true,
|
|
},
|
|
globals: {
|
|
jest: 'readonly',
|
|
},
|
|
plugins: ['@typescript-eslint', 'prettier', 'import'],
|
|
extends: [
|
|
'eslint:recommended',
|
|
'plugin:@typescript-eslint/recommended',
|
|
'plugin:vue/vue3-recommended',
|
|
'prettier',
|
|
],
|
|
overrides: [
|
|
{
|
|
files: ['*.ts', '*.vue'],
|
|
rules: {
|
|
'no-undef': 'off',
|
|
},
|
|
},
|
|
{
|
|
files: ['**/__tests__/**'],
|
|
rules: {
|
|
'no-console': 'off',
|
|
},
|
|
},
|
|
],
|
|
rules: {
|
|
// js/ts
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
'no-redeclare': 'off',
|
|
'@typescript-eslint/no-redeclare': 'error',
|
|
'no-console': ['warn', { allow: ['error'] }],
|
|
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
|
|
camelcase: ['error', { properties: 'never' }],
|
|
|
|
'no-var': 'error',
|
|
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
'no-with': 'error',
|
|
'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 }],
|
|
|
|
'@typescript-eslint/explicit-module-boundary-types': '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 },
|
|
],
|
|
|
|
// vue
|
|
'vue/no-v-html': 'off',
|
|
'vue/require-default-prop': 'off',
|
|
'vue/require-explicit-emits': 'off',
|
|
|
|
'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'],
|
|
},
|
|
],
|
|
},
|
|
}
|