eslintrc

Failed to load plugin @typescript-eslint: Cannot find module 'eslint-plugin-@typescript-eslint'

回眸只為那壹抹淺笑 提交于 2020-01-02 00:13:17
问题 I am reconfiguring my project from tslint to eslint. I can run eslint manually, but webpack fails to run with this error message: Module build failed (from /path/node_modules/eslint-loader/index.js): Error: Failed to load plugin @typescript-eslint: Cannot find module 'eslint-plugin-@typescript-eslint' I have ruled out bad .eslintrc.js and missing dependencies since it works when I run it manually ./node_modules/eslint/bin/eslint.js ./ --ext .ts,.tsx --config ./.eslintrc.js I'm not sure if

indentation with eslint on jsx

纵然是瞬间 提交于 2019-12-24 01:43:17
问题 I'm trying to make simple component. But when I click on ctrl + s it does this: warning and error is this: [eslint] Expected closing tag to match indentation of opening. (react/jsx-closing-tag-location) [eslint] Expected indentation of 4 space characters but found 2. (react/jsx-indent) my .eslintrc : { "extends": "airbnb", "parserOptions": { "ecmaFeatures": { "jsx": true, "experimentalObjectRestSpread": true } }, "rules": { "max-len": ["warn", 120], "indent": ["warn", 2], "react/jsx-indent":

'number' is never reassigned. Use 'const' instead. (prefer-const)

≡放荡痞女 提交于 2019-12-24 00:18:38
问题 Why in this case eslint 4.17.0 i have error number is never reassigned. Use 'const' instead. (prefer-const). Why i need to use const? Please, explain me i can't understand. let test = { 'number': 1, 'string': 'asd', }; test.number = 99; console.log(test.number); // output: 99 ecmascript { "parser": "babel-eslint", "env": { "browser": true }, "extends": [ "google" ], "rules": { "prefer-const": 2 }, "parserOptions": { "ecmaVersion": 6, "sourceType": "module" } } eslint problem [eslint] 'test'

eslint “parsing error: Unexpected token {” in JSX

假如想象 提交于 2019-12-21 03:53:32
问题 const title = 'My Minimal React Webpack Babel Setups'; const App = () => (<div><b>{title}</b><img src={img} /></div>) This code occurs an error "ESLint Parsing Error: Unexpected token {" my .eslintrc.js file is like that module.exports = { "extends": "airbnb" }; and I install the packages like that "eslint": "^5.9.0", "eslint-config-airbnb": "^17.1.0", "eslint-loader": "^2.1.1", "eslint-plugin-import": "^2.14.0", "eslint-plugin-jsx-a11y": "^6.1.2", "eslint-plugin-react": "^7.11.1", I thought

What is the ESLint rule to prevent newline after an object prop colon

邮差的信 提交于 2019-12-10 13:51:41
问题 I searched and search on both SO and Google. But I cannot find the rule to enforce this: NOT OK const object = { methods: { } } OK const object = { methods: { } } It seems to not be object-property-newline or object-curly-newline Edit: it also doesn't seem to be brace-style. 回答1: There is no rule for that. You may propose this rule in to the eslint project, but I expect it would not be accepted. In the meanwhile eslint-plugin-prettier do cover this case, but it is not possible to opt-in only