![]() Installing the ESLint Extension for VS Code Now that we’ve installed and configured ESLint, all that remains is to tell VS Code how to format your code on save. Formatting on Save in VS Code with ESLint If you’re working with a lower version number, you’ll want to enable this rule and import React anytime you need to render JSX. I’ve disabled the react-in-jsx-scope rule, as it tends to be annoying if you’re using React 17+ (where you don’t have to explicitly import React). ![]() This is useful in case you want to set up lint-staged rules with husky and git hooks: If you haven’t already done so, you can update your package.json scripts to include a script to lint files via the command line. Optional: husky, lint-staged, and Precommit Hooks We’ll look at how to install and configure the extension in a later section. If you already have the ESLint extension installed, VS Code may show a prompt asking if you want to use the ESLint executable you just installed in node_modules. ![]() Install all of your packages as dev dependencies as noted above. You get the idea: yarn add -D eslint-plugin-react eslint-plugin-react-hooks
0 Comments
Leave a Reply. |