Javascript Can';t重新加载eslint配置文件
我正在开发一个React应用程序(通过createreact应用程序创建),并扩展linting配置 在我的Javascript Can';t重新加载eslint配置文件,javascript,reactjs,eslint,Javascript,Reactjs,Eslint,我正在开发一个React应用程序(通过createreact应用程序创建),并扩展linting配置 在我的src文件夹中,我有一个文件.eslintrc.js,它如下所示: module.exports = { extends: ['react-app'], rules: { 'max-len': ['error', { code: 80 }], }, overrides: [ { files: ['**/*.ts?(x)'], rule
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
我怎样才能解决这个问题?我已尝试重新启动终端,但它不工作消息中已给出答案。您已经在eslint中设置了max len规则。是的,但我已从错误更改为警告,它仍然会给出错误。即使我从80改为300运行
npm start
也总是抱怨80的长度,而当我运行npx eslint./src
时,它会给出正确的输出。到目前为止,我发现更新规则的唯一方法是删除/node modules
文件夹,然后再次运行npm I
。。。