ESLint
What is it
Use
eslint
,tslint
is deprecated
Configuration
# init yarn create @eslint/config # running Eslint Rule yarn dlx eslint yourfile.js
Use With Prettier
Add prettier
to the extends
array of .eslintrc.*
file.
- Place the element as last, so it overrides other configs
{ "extends": [ "some-other-config-you-use", "some-other-config-you-use", "prettier" ] }
Plugin Style
[ "plugin:prettier/recommended", ]
Running Prettier
prettier apps/admin/internal -w
Run EsLint
# run lint on the project yarn eslint # run autofix on specified path yarn eslint --fix path_to_file_or_dir # run with specified node package ./node_modules/eslint/bin/eslint.js path_to_file_or_dir
Disabling Lint
Disabling linting is not recommended unless you're forced in a situation to disable.
Allowing unused variable
/* eslint-disable @typescript-eslint/no-unused-vars */