@hz-9/eslint-config-airbnb-ts
Less than 1 minute
@hz-9/eslint-config-airbnb-ts
A eslint config for 'hz-9' (TypeScript).
Installation
To install the @hz-9/eslint-config-airbnb-ts package, run the following command:
npm install @hz-9/eslint-config-airbnb-ts --save-devUsage
This package provides both Legacy eslintrc and Flat config formats.
Legacy (eslintrc)
Add the following code to your .eslintrc.js file:
module.exports = {
extends: [
'@hz-9/eslint-config-airbnb-ts'
],
}If you need to generate parserServices, set parseOptions.project:
module.exports = {
extends: [
'@hz-9/eslint-config-airbnb-ts'
],
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
},
}Available sub-path exports:
| Export | Description |
|---|---|
@hz-9/eslint-config-airbnb-ts (or ./index) | airbnb-base + prettier + TS + hz-9 rules |
@hz-9/eslint-config-airbnb-ts/airbnb-ts | airbnb-base + TS rules |
@hz-9/eslint-config-airbnb-ts/airbnb-prettier | airbnb-base + prettier + TS rules |
Flat Config (ESLint >= 9.x)
Add the following code to your eslint.config.js file:
const airbnbTsConfig = require('@hz-9/eslint-config-airbnb-ts/flat')
module.exports = [
...airbnbTsConfig,
]Available sub-path exports:
| Export | Description |
|---|---|
@hz-9/eslint-config-airbnb-ts/flat | airbnb-base + prettier + TS + hz-9 rules |
@hz-9/eslint-config-airbnb-ts/flat/airbnb-ts | airbnb-base + TS rules |
@hz-9/eslint-config-airbnb-ts/flat/airbnb-prettier | airbnb-base + prettier + TS rules |
After that, you can run the ESLint fix command to automatically fix linting issues:
eslint --fix .