A rather strict ESLint TypeScript configuration.
- Single quotes, semicolons.
- Based on the reasonable eslint-config-base configuration.
- Strict by default (and therefore opinionated) rules.
pnpm add -D eslint eslint-plugin-import eslint-plugin-promise @typescript-eslint/eslint-plugin @typescript-eslint/parser @gcoguiec/eslint-config-typescript
Register the configuration with eslint
Edit your .eslintrc
configuration file (you may have to create the file at your project root if it's missing) with the following :
{
"extends": "@gcoguiec/eslint-config-typescript"
}
For stricter compilation checks, you can set the following rules in your tsc
configuration file:
{
"compilerOptions": {
"strict": true,
"strictNullChecks": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"exactOptionalPropertyTypes": true,
"noUncheckedIndexedAccess": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error"
}
}
{
"scripts": {
"lint": "eslint . --ignore-path .gitignore",
"lint:fix": "pnpm lint --fix"
}
}
Note: you can replace pnpm
with your favorite package manager instead.
lint *args:
pnpm eslint . --ignore-path .gitignore {{args}}
lint-fix:
@just lint --fix
Other ESLint configurations you may want to look at:
This package is licensed under BSD 2-Clause.