代码拉取完成,页面将自动刷新
const eslintConfig = {
env: {
es6: true,
node: true,
browser: true,
},
plugins: ['prettier'],
settings: {},
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
ecmaFeatures: {
impliedStrict: true,
},
lib: ['es2022', 'dom'],
},
globals: {
NodeJS: 'readonly',
},
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
rules: {
'prettier/prettier': 2,
'constructor-super': 2,
curly: [2, 'all'],
// Unfortunatelly `curly` does not apply to blocks in `switch` cases so
// this is needed.
'no-restricted-syntax': [
2,
{
selector: 'SwitchCase > *.consequent[type!="BlockStatement"]',
message: 'Switch cases without blocks are disallowed',
},
],
'guard-for-in': 2,
'newline-after-var': 2,
'newline-before-return': 2,
'no-alert': 2,
'no-caller': 2,
'no-case-declarations': 2,
'no-catch-shadow': 2,
'no-class-assign': 2,
'no-console': 2,
'no-const-assign': 2,
'no-debugger': 2,
'no-dupe-args': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-div-regex': 2,
'no-empty': [2, { allowEmptyCatch: true }],
'no-empty-pattern': 2,
'no-else-return': 0,
'no-eval': 2,
'no-extend-native': 2,
'no-ex-assign': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-label': 2,
'no-fallthrough': 2,
'no-func-assign': 2,
'no-global-assign': 2,
'no-implicit-coercion': 2,
'no-implicit-globals': 2,
'no-inner-declarations': 2,
'no-invalid-regexp': 2,
'no-invalid-this': 2,
'no-irregular-whitespace': 2,
'no-lonely-if': 2,
'no-multi-str': 2,
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new': 2,
'no-new-func': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-proto': 2,
'no-prototype-builtins': 0,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-restricted-imports': 2,
'no-return-assign': 2,
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow': 2,
'no-shadow-restricted-names': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-undef': 2,
'no-unmodified-loop-condition': 2,
'no-unreachable': 2,
'no-unused-vars': [1, { vars: 'all', args: 'after-used' }],
'no-use-before-define': 0,
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-concat': 2,
'no-useless-rename': 2,
'no-var': 2,
'object-curly-newline': 0,
'prefer-const': 2,
'prefer-rest-params': 2,
'prefer-spread': 2,
'prefer-template': 2,
'spaced-comment': [2, 'always'],
strict: 2,
'valid-typeof': 2,
yoda: 2,
},
overrides: [],
};
const tsRules = {
'no-unused-vars': 0,
'@typescript-eslint/ban-types': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/semi': 2,
'@typescript-eslint/member-delimiter-style': [
2,
{
multiline: { delimiter: 'semi', requireLast: true },
singleline: { delimiter: 'semi', requireLast: false },
},
],
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unused-vars': [
2,
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
},
],
'@typescript-eslint/no-use-before-define': [2, { functions: false }],
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-non-null-assertion': 0,
};
eslintConfig.overrides.push({
files: ['*.ts'],
parser: '@typescript-eslint/parser',
parserOptions: {
...eslintConfig.parserOptions,
project: 'tsconfig.json',
},
plugins: [...eslintConfig.plugins, '@typescript-eslint'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
...eslintConfig.extends,
],
rules: { ...eslintConfig.rules, ...tsRules },
});
eslintConfig.overrides.push({
files: ['src/test/*.ts'],
parserOptions: {
...eslintConfig.parserOptions,
project: 'tsconfig.json',
},
env: {
...eslintConfig.env,
'jest/globals': true,
},
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
...eslintConfig.extends,
],
plugins: [...eslintConfig.plugins, '@typescript-eslint', 'jest'],
rules: {
...eslintConfig.rules,
...tsRules,
'jest/no-disabled-tests': 2,
},
});
module.exports = eslintConfig;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。