26 |
27 | class DefaultLayout extends Component {
> 28 | loading = () => <div className="animated fadeIn pt-1 text-center">Loading...</div>;
| ^
ESLint正在为打开的<div>
标签返回一个解析错误(意外令牌)。我想念什么? JSX中不允许使用普通的HTML属性吗? (div似乎工作正常)
我尝试使用很多配置来修复它们,以实现eslint,babel插件和webpack配置。但是我无法解决。
{
"env": {
"browser": true,
"es6": true,
"commonjs": true,
"node": true,
"jest": true
},
"extends": [
"airbnb"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true,
"experimentalObjectRestSpread": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"react/jsx-filename-extension": ["warn", { "extensions": [".js", ".jsx"] }],
"react/jsx-curly-newline": ["warn", { "multiline": "consistent", "singleline": "consistent" }],
"react/state-in-constructor": ["warn", "always"],
"react/jsx-props-no-spreading": ["warn", {
"html": "ignore",
"custom": "enforce",
"exceptions": ["Image", "img"]
}],
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"max-len": ["warn", { "code": 120 }],
"import/no-extraneous-dependencies": ["error", {"devDependencies": true, "packageDir": "./"}],
"react/destructuring-assignment": [0],
"react/prop-types": [0],
"react/no-array-index-key": "warn"
}
}
请,你能帮我吗?
答案 0 :(得分:0)
我通过删除Prettier扩展程序解决了我的问题。