Provides hughx’s TypeScript conventions as .eslintrc
shared configs.
Emphasizes readability and ease of writing.
ℹ️ For plain JavaScript support, use eslint-config-hughx
instead.
npm install -D eslint-config-hughx-ts
You will have to install peerDependencies
manually:
# npm install -D
yarn add -D \
@hughx/tsconfig \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
eslint \
eslint-config-airbnb-typescript \
eslint-config-hughx \
eslint-config-hughx-ts \
eslint-import-resolver-typescript \
eslint-plugin-import \
typedoc \
typescript
# npm install -D
yarn add -D \
@hughx/tsconfig \
@types/react \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
eslint \
eslint-config-airbnb-base \
eslint-config-airbnb-typescript \
eslint-config-hughx \
eslint-config-hughx-ts \
eslint-import-resolver-typescript \
eslint-plugin-import \
eslint-plugin-jsx-a11y \
eslint-plugin-react \
eslint-plugin-react-hooks \
typedoc \
typescript
# npm install -D
yarn add -D \
@hughx/tsconfig \
@types/node \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
eslint \
eslint-config-airbnb-base \
eslint-config-airbnb-typescript \
eslint-config-hughx \
eslint-config-hughx-ts \
eslint-import-resolver-typescript \
eslint-plugin-import \
typedoc \
typescript
Extend hughx-ts
in your project’s .eslintrc.js
or equivalent:
module.exports = {
"extends": [
"hughx-ts",
],
// …
}
Eslint-config-hughx-ts defaults to the latest version of JavaScript/ECMAScript at the time of release. If your transpiler isn’t set up for this (or you don’t use one), then you should override both env.es*
and parserOptions.ecmaVersion
, e.g.
// Downgrading from ES2021 to ES6
module.exports = {
"extends": [
"hughx-ts",
],
"env": {
"es2021": false,
"es6": true
},
"parserOptions": {
"ecmaVersion": 6
}
};
Then, create a tsconfig.json
in your root and extend @hughx/tsconfig
:
{
"extends": "@hughx/tsconfig"
}
You can extend from one of the following to bring in sensible defaults for different use cases:
- .eslintrc
hughx-ts/react
- tsconfig.json
@hughx/tsconfig/react.json
- .eslintrc
hughx-ts/node
- tsconfig.json
@hughx/tsconfig/node.json
- .eslintrc
hughx-ts/web-components
- tsconfig.json
@hughx/tsconfig/web-components.json