- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- eslint
- eslint-config-airbnb-base
- eslint-config-prettier
- eslint-plugin-import
- eslint-plugin-prettier
- prettier
-
npm i -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-airbnb-base eslint-config-prettier eslint-plugin-import eslint-plugin-prettier prettier. -
node_modules/eslint/bin/eslint.js {path} --fix
.eslintrc.js
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'airbnb-base',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 12,
},
plugins: [
'@typescript-eslint',
],
rules: {
'import/prefer-default-export': 'off',
'class-methods-use-this': 'off',
'max-len': [0, 160, 2, { ignoreUrls: true }],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
};.eslintrc.yaml
env:
node: true
extends:
- plugin:@typescript-eslint/recommended
- prettier/@typescript-eslint
- plugin:prettier/recommended
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 9
project: ./tsconfig.json
plugins:
- '@typescript-eslint'.prettierrc.yml
tabWidth: 2
singleQuote: true
printWidth: 160- Disable eslint for all files in directory and subdirectories
- Nested .eslintrc files in Visual Studio Code
- While running eslint fix on the project i got this error
AssertionError [ERR_ASSERTION]: Node must be provided when reporting error if location is not provided
to fix it i did a loop on the files in the directory and fix each of them to get the code snippet that cause the previous problem
for file in *; do
if [ -f "$file" ]; then
../node_modules/eslint/bin/eslint.js "$file" --fix
fi
done