ESLint
Last updated
Last updated
ESLint existed to lint JavaScript, but now it is also becoming the defacto linter for , thanks to the between the two teams.
To setup ESLint for TypeScript you need the following packages:
TIP: eslint calls packages that contain lint rules as "plugin"
eslint : Core eslint
eslint-plugin-react : For react rules provided by eslint.
@typescript-eslint/parse : To allow eslint to understand ts / tsx files
@typescript-eslint/eslint-plugin : For TypeScript rules.
As you can see there are two eslint packages (for use with js or ts) and two @typescript-eslint packages (for use with ts). So the overhead for TypeScript is not that much.
Create .eslintrc.js
:
In your package.json
add to scripts
:
Now you can npm run lint
to validate.
Add to settings.json
:
Install extension