41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
![]() |
module.exports = {
|
||
|
parser: '@typescript-eslint/parser',
|
||
|
parserOptions: {
|
||
|
project: 'tsconfig.json',
|
||
|
tsconfigRootDir: __dirname,
|
||
|
sourceType: 'module',
|
||
|
},
|
||
|
plugins: ['@typescript-eslint/eslint-plugin'],
|
||
|
extends: [
|
||
|
'plugin:@typescript-eslint/recommended',
|
||
|
'plugin:prettier/recommended',
|
||
|
],
|
||
|
root: true,
|
||
|
env: {
|
||
|
node: true,
|
||
|
jest: true,
|
||
|
},
|
||
|
ignorePatterns: ['.eslintrc.js'],
|
||
|
rules: {
|
||
|
'@typescript-eslint/interface-name-prefix': 'off',
|
||
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||
|
// 允许使用 any 类型
|
||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||
|
|
||
|
// 允许声明但未使用的变量
|
||
|
'@typescript-eslint/no-unused-vars': [
|
||
|
'warn',
|
||
|
{
|
||
|
vars: 'all', // 检查所有变量
|
||
|
args: 'none', // 不检查函数参数
|
||
|
ignoreRestSiblings: true,
|
||
|
},
|
||
|
],
|
||
|
|
||
|
// 禁止使用未声明的变量
|
||
|
'no-undef': 'error',
|
||
|
},
|
||
|
};
|