Component definition is missing display name react/display-name

Exporting an arrow function directly doesn’t give the component a displayName, but if you export a regular function the function name will be used as displayName. export default function MyComponent() { return ( <Switch> <Route path=”/login” exact component={LoginApp}/> <Route path=”/faq” exact component={FAQ}/> <Route component={NotFound} /> </Switch> ); } You can also put the function in … Read more

How to make WebStorm format code according to eslint?

(Described steps and screenshots are from IntelliJ IDEA 2017.2) You can add a keyboard shortcut to action ‘Fix ESLint Problem’. Ensure plugin ‘JavaScript Support’ is installed and enabled. First got to Preferences | Language & Frameworks | JavaScript | Code Quality Tools | ESLint and enable it. You will need to define your ‘Node interpreter’, … Read more

How is ESLint integrated into Create React App?

Yes, create-react-app comes with eslint config. How do I enable and extend it correctly? You can check how to extend it here. { “eslintConfig”: { “extends”: [“react-app”, “shared-config”], “rules”: { “additional-rule”: “warn” }, “overrides”: [ { “files”: [“**/*.ts?(x)”], “rules”: { “additional-typescript-only-rule”: “warn” } } ] } } How do I enable it? You need to … Read more

ESLint – Configuring “no-unused-vars” for TypeScript

I think the use of “plugin:@typescript-eslint/eslint-recommended” introduces bunch of unwanted rules. One is probably better off using “@typescript-eslint/no-unused-vars” ESLint rule instead. { “parser”: “@typescript-eslint/parser”, “plugins”: [ “@typescript-eslint”, ], “extends”: [ “eslint:recommended”, “plugin:@typescript-eslint/recommended”, ], “rules”: { “no-unused-vars”: “off”, “@typescript-eslint/no-unused-vars”: [“error”] } } Reference – https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md