我已将 Create React App (CRA) 从 3.3.0 更新到 4.0.0,在此更新后它抛出Can not read property 'range' of null,我删除了节点模块和 yarn.lock 并再次安装了软件包,但它还没有解决。
我的 Eslint 配置文件
"env": {
"browser": true,
"es6": true
},
"parser": "babel-eslint",
"extends": [
"prettier", "prettier/react"
],
"plugins": [
"prettier", "react"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"indent": [
"error",
2,
{ "SwitchCase": 1 }
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"prettier/prettier": [
"error",
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
],
"arrow-body-style": [
2,
"as-needed"
],
"class-methods-use-this": 0,
"lines-between-class-members": ["error", "always"] ,
"comma-dangle": [
2,
"always-multiline"
],
"import/imports-first": 0,
"import/newline-after-import": 0,
"import/no-dynamic-require": 0,
"import/no-extraneous-dependencies": 0,
"import/no-named-as-default": 0,
"import/no-webpack-loader-syntax": 0,
"import/prefer-default-export": 0,
"max-len": 0,
"newline-per-chained-call": 0,
"no-confusing-arrow": 1,
"no-console": "warn",
"no-use-before-define": 1,
"prefer-template": 2
}
}
我没有在 package.json 中添加 babel-eslint,因为它默认添加在 CRA 中。
babel-eslint 10.1.0
有人可以帮忙吗?提前致谢