107 lines
2.8 KiB
JavaScript
107 lines
2.8 KiB
JavaScript
/* eslint-env node */
|
|
require('@rushstack/eslint-patch/modern-module-resolution')
|
|
|
|
module.exports = {
|
|
root: true,
|
|
env: {
|
|
node: true,
|
|
browser: true,
|
|
es2021: true
|
|
},
|
|
extends: [
|
|
'plugin:vue/vue3-essential',
|
|
'plugin:vue/vue3-strongly-recommended',
|
|
'plugin:vue/vue3-recommended',
|
|
'eslint:recommended',
|
|
'@vue/eslint-config-typescript',
|
|
'@vue/eslint-config-prettier/skip-formatting'
|
|
],
|
|
parser: 'vue-eslint-parser',
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
parser: '@typescript-eslint/parser'
|
|
},
|
|
plugins: ['vue', '@typescript-eslint'],
|
|
globals: {
|
|
ElMessage: 'readonly',
|
|
ElMessageBox: 'readonly',
|
|
ElNotification: 'readonly',
|
|
ElLoading: 'readonly'
|
|
},
|
|
rules: {
|
|
// Vue规则
|
|
'vue/multi-word-component-names': 'off',
|
|
'vue/no-v-html': 'off',
|
|
'vue/component-tags-order': [
|
|
'error',
|
|
{
|
|
order: ['script', 'template', 'style']
|
|
}
|
|
],
|
|
'vue/component-name-in-template-casing': [
|
|
'error',
|
|
'PascalCase',
|
|
{
|
|
registeredComponentsOnly: false
|
|
}
|
|
],
|
|
'vue/custom-event-name-casing': ['error', 'camelCase'],
|
|
'vue/define-emits-declaration': 'error',
|
|
'vue/define-props-declaration': 'error',
|
|
'vue/html-button-has-type': 'error',
|
|
'vue/no-unused-refs': 'error',
|
|
'vue/no-useless-v-bind': 'error',
|
|
'vue/prefer-separate-static-class': 'error',
|
|
'vue/prefer-true-attribute-shorthand': 'error',
|
|
'vue/block-order': [
|
|
'error',
|
|
{
|
|
order: ['script', 'template', 'style']
|
|
}
|
|
],
|
|
|
|
// TypeScript规则
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_'
|
|
}
|
|
],
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
'@typescript-eslint/ban-ts-comment': 'warn',
|
|
|
|
// JavaScript规则
|
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
'no-unused-vars': 'off',
|
|
'prefer-const': 'error',
|
|
'no-var': 'error',
|
|
'object-shorthand': 'error',
|
|
'prefer-template': 'error',
|
|
'template-curly-spacing': 'error',
|
|
'yield-star-spacing': 'error',
|
|
'prefer-rest-params': 'error',
|
|
'no-useless-escape': 'error',
|
|
'no-irregular-whitespace': 'error',
|
|
'no-prototype-builtins': 'error',
|
|
'no-fallthrough': 'error',
|
|
'no-extra-boolean-cast': 'error',
|
|
'no-case-declarations': 'error',
|
|
'no-async-promise-executor': 'error'
|
|
},
|
|
overrides: [
|
|
{
|
|
files: ['cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'],
|
|
extends: ['plugin:cypress/recommended']
|
|
},
|
|
{
|
|
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
|
|
env: {
|
|
jest: true
|
|
}
|
|
}
|
|
]
|
|
} |