|
@@ -1,16 +1,55 @@
|
|
|
-import baseLintConfig from './index';
|
|
|
-
|
|
|
export default {
|
|
|
- extends: [baseLintConfig],
|
|
|
+ extends: ['@vben'],
|
|
|
plugins: ['simple-import-sort'],
|
|
|
rules: {
|
|
|
'simple-import-sort/imports': 'error',
|
|
|
'simple-import-sort/exports': 'error',
|
|
|
|
|
|
- '@typescript-eslint/ban-types': 'error',
|
|
|
- '@typescript-eslint/ban-ts-ignore': 'error',
|
|
|
- '@typescript-eslint/ban-ts-comment': 'error',
|
|
|
- '@typescript-eslint/no-explicit-any': 'error',
|
|
|
+ '@typescript-eslint/ban-ts-comment': [
|
|
|
+ 'error',
|
|
|
+ {
|
|
|
+ 'ts-expect-error': 'allow-with-description',
|
|
|
+ 'ts-ignore': 'allow-with-description',
|
|
|
+ 'ts-nocheck': 'allow-with-description',
|
|
|
+ 'ts-check': false,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 【强制】关键字前后有一个空格
|
|
|
+ * @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
|
|
|
+ */
|
|
|
+ 'keyword-spacing': 'off',
|
|
|
+ '@typescript-eslint/keyword-spacing': [
|
|
|
+ 'error',
|
|
|
+ {
|
|
|
+ before: true,
|
|
|
+ after: true,
|
|
|
+ overrides: {
|
|
|
+ return: { after: true },
|
|
|
+ throw: { after: true },
|
|
|
+ case: { after: true },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 禁止出现空函数,普通函数(非 async/await/generator)、箭头函数、类上的方法除外
|
|
|
+ * @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
|
|
|
+ */
|
|
|
+ 'no-empty-function': 'off',
|
|
|
+ '@typescript-eslint/no-empty-function': [
|
|
|
+ 'error',
|
|
|
+ {
|
|
|
+ allow: ['arrowFunctions', 'functions', 'methods'],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 优先使用 interface 而不是 type 定义对象类型
|
|
|
+ * @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
|
|
|
+ */
|
|
|
+ '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
|
|
|
|
|
|
'vue/attributes-order': 'error',
|
|
|
'vue/require-default-prop': 'error',
|