This configuration is based on eslint-config-airbnb-typescript, but with a few tweaks and most notibly:
- indentation: tab
This project provides both a JavaScript and a TypeScript configuration file. Defaults to TypeScript.
Install the config:
$ npm install --save-dev @rasmuslp/eslint-config
See peer dependencies:
$ npm info "@rasmuslp/eslint-config@latest" peerDependencies
Automatically install peer dependencies:
$ npx install-peerdeps --dev @rasmuslp/eslint-config
Configure eslint in your project by extending this configuration in your local .eslintrc.json
{
"root": true,
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"extends": [
"@rasmuslp"
]
}
The TypeScript config is utilized by certain rules that require type information.
To lint all project files, besides what the default tsconfig
does, add tsconfig.eslint.json
with:
{
"extends": "./tsconfig.json",
"include": ["./"]
}
Lastly, specify the minimum supported Node version in package.json
to enable checks for using unsupported Node features.
"engines": {
"node": ">=18.18.0"
}
Install additional dependencies
$ npm install --save-dev eslint-config-airbnb
Configure eslint in your project by extending this configuration in your local .eslintrc.json
{
"root": true,
"extends": [
// Load broader rules first
"airbnb",
"airbnb-typescript",
// Then override with more specific rule set
"@rasmuslp/eslint-config/src/typescript-react"
]
}
You can omit installing @typescript-eslint/eslint-plugin
and typescript
, but you will get warnings about missing peer dependencies.
Configure eslint in your project by extending this configuration in your local .eslintrc.json
{
"root": true,
"extends": "@rasmuslp/eslint-config/src/javascript"
}