2024-11-18 11:00:55 +08:00
|
|
|
|
module.exports = {
|
|
|
|
|
env: {
|
|
|
|
|
browser: true,
|
|
|
|
|
es2021: true,
|
|
|
|
|
node: true,
|
|
|
|
|
},
|
|
|
|
|
extends: [
|
|
|
|
|
'plugin:vue/vue3-essential',
|
|
|
|
|
'plugin:@typescript-eslint/recommended',
|
|
|
|
|
'plugin:prettier/recommended', // 添加 prettier 插件
|
|
|
|
|
],
|
2024-11-20 16:33:02 +08:00
|
|
|
|
parser: 'vue-eslint-parser',
|
|
|
|
|
overrides: [],
|
|
|
|
|
parserOptions: {
|
|
|
|
|
ecmaVersion: 'latest',
|
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
|
sourceType: 'module',
|
|
|
|
|
},
|
|
|
|
|
plugins: ['vue', '@typescript-eslint', 'simple-import-sort'],
|
2024-11-18 11:00:55 +08:00
|
|
|
|
rules: {
|
|
|
|
|
'@typescript-eslint/ban-types': 'off',
|
|
|
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
|
|
|
'@typescript-eslint/promise-function-async': 'off',
|
|
|
|
|
'vue/multi-word-component-names': 'off',
|
|
|
|
|
'simple-import-sort/imports': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
groups: [
|
|
|
|
|
[
|
|
|
|
|
// 以字母(或数字或下划线)或“@”后面跟着字母开头的东西,通常为内置模块引入
|
|
|
|
|
'^@?\\w',
|
|
|
|
|
// 内部导入 "@/"
|
|
|
|
|
'^@(/.*|$)',
|
|
|
|
|
`^@/assets$`,
|
|
|
|
|
`^@/components$`,
|
|
|
|
|
`^@/config$`,
|
|
|
|
|
`^@/hooks$`,
|
|
|
|
|
`^@/plugins$`,
|
|
|
|
|
`^@/router$`,
|
|
|
|
|
`^@/store$`,
|
|
|
|
|
`^@/styles$`,
|
|
|
|
|
`^@/utils$`,
|
|
|
|
|
// 父级导入. 把 `..` 放在最后.
|
|
|
|
|
'^\\.\\.(?!/?$)',
|
|
|
|
|
'^\\.\\./?$',
|
|
|
|
|
// 同级导入. 把同一个文件夹.放在最后
|
|
|
|
|
'^\\./(?=.*/)(?!/?$)',
|
|
|
|
|
'^\\.(?!/?$)',
|
|
|
|
|
'^\\./?$',
|
|
|
|
|
// 样式导入.
|
|
|
|
|
'^.+\\.?(css|less|scss)$',
|
|
|
|
|
// 带有副作用导入,比如import 'a.css'这种.
|
|
|
|
|
'^\\u0000',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
'simple-import-sort/exports': 'error', // 导出
|
|
|
|
|
'import/order': 'off',
|
|
|
|
|
},
|
|
|
|
|
};
|