Ошибка анализа: неожиданный токен ...
Честно говоря, я не могу понять, почему ESlint добавляет ошибка для первого оператора console.log
, а не для второго:
const generateCss = () => {
console.log({...{foo: 'bar'}});
};
function bar() {
console.log({...{foo: 'bar'}});
}
Есть какое-нибудь объяснение или это моя вина?
Конфигурация ESlint (v7.2.0):
{
"extends": "eslint:recommended",
"env": {
"es6": true,
"node": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"array-bracket-spacing": "warn",
"arrow-parens": ["warn", "as-needed"],
"arrow-spacing": "warn",
"brace-style": "warn",
"comma-spacing": "warn",
"computed-property-spacing": "warn",
"consistent-return": "warn",
"curly": ["warn", "all"],
"eol-last": "warn",
"eqeqeq": "warn",
"func-call-spacing": "warn",
"indent": ["warn", 2, {
"SwitchCase": 1
}],
"key-spacing": ["warn"],
"new-cap": "warn",
"new-parens": "warn",
"no-multiple-empty-lines": ["warn", {
"max": 1
}],
"no-nested-ternary": "warn",
"no-return-assign": ["warn", "always"],
"no-trailing-spaces": "warn",
"no-unneeded-ternary": "warn",
"no-var": "warn",
"object-curly-spacing": ["warn", "always"],
"padded-blocks": ["warn", "never"],
"prefer-const": "warn",
"quote-props": ["warn", "as-needed"],
"quotes": ["warn", "single"],
"semi-spacing": "warn",
"space-before-blocks": ["warn", "always"],
"space-before-function-paren": ["warn", {
"anonymous": "always",
"asyncArrow": "always",
"named": "never"
}],
"space-in-parens": "warn",
"space-infix-ops": ["warn", {
"int32Hint": true
}],
"space-unary-ops": "warn",
"spaced-comment": ["warn", "always"],
"yoda": ["warn", "always", {
"onlyEquality": true
}]
}
}