我正在开发一个React应用程序(通过Create React App创建),并且正在扩展linting配置。
在我的src
文件夹中,文件.eslintrc.js
如下:
module.exports = {
extends: ['react-app'],
rules: {
'max-len': ['error', { code: 80 }],
},
overrides: [
{
files: ['**/*.ts?(x)'],
rules: {
'additional-typescript-only-rule': 'warn',
},
},
],
};
由于它阻止了应用程序的编译,因此我将'error'
更改为'warning'
,以便仅引发警告,但应用程序仍然可以运行。
问题是,如果我运行命令npx eslint ./src
,我可以看到它只发出警告,但是当我执行npm run start
时,它会卡在文件的旧版本中:
Failed to compile.
./src/components/ProfitLineChart/index.jsx
Line 101:1: This line has a length of 87. Maximum allowed is 80 max-len
我该如何解决?我已经尝试过重启终端,但是它不起作用