TypeStrict ESLint Config
raw JSON → 1.0.5 verified Sat Apr 25 auth: no javascript
An ESLint shareable configuration focused on maximizing TypeScript type safety by enabling strict rules that catch bugs. Version 1.0.5 is the latest stable, with low release cadence. Combines rules from @typescript-eslint/eslint-plugin and eslint-plugin-sonarjs, emphasizing type-correctness and runtime error prevention over code style. Unlike other configs (e.g., eslint-config-airbnb-typescript), TypeStrict is minimalist and bug-focused, requiring manual peer dependency installation and strict tsconfig setting.
Common errors
error ESLint: Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated. You must provide the `parserOptions.project` property for @typescript-eslint/parser. ↓
cause Missing parserOptions.project in ESLint config.
fix
Add
"parserOptions": { "project": "./tsconfig.json" } to ESLint config. error ESLint: Cannot find module 'eslint-plugin-sonarjs' ↓
cause Peer dependency not installed.
fix
Run
npm install --save-dev eslint-plugin-sonarjs. error ESLint: Configuration for rule '@typescript-eslint/no-unnecessary-condition' is invalid: Value "true" is not a valid severity. ↓
cause Incorrect rule severity format.
fix
Use
"warn" or "error" instead of true. Warnings
breaking Peer dependencies must be installed manually; missing them will cause ESLint errors. ↓
fix Run `npm install --save-dev @typescript-eslint/eslint-plugin eslint-plugin-sonarjs`
gotcha Requires TypeScript strict mode in tsconfig.json; will produce false positives otherwise. ↓
fix Set `"strict": true` in compilerOptions
deprecated Legacy typestrict@1 for TSLint users; modern versions are ESLint-only. ↓
fix Use typestrict@latest with ESLint, or use typestrict@1 for TSLint.
gotcha Config enforces `no-invalid-this` which can conflict with class property initializers in TypeScript. ↓
fix Override rule: `'no-invalid-this': 'off'` if needed.
gotcha Config uses `@typescript-eslint/no-floating-promises` which requires parserOptions.project to be set correctly. ↓
fix Ensure `parserOptions.project` points to your tsconfig.json.
Install
npm install eslint-config-typestrict yarn add eslint-config-typestrict pnpm add eslint-config-typestrict Imports
- typestrict wrong
import typestrict from 'eslint-config-typestrict'correctextends: 'typestrict' in .eslintrc.json - default config wrong
module.exports = require('eslint-config-typestrict')correctmodule.exports = { extends: 'typestrict' } - peer dependencies wrong
npm install --save-dev eslint-config-typestrictcorrectnpm install --save-dev @typescript-eslint/eslint-plugin eslint-plugin-sonarjs
Quickstart
// .eslintrc.json
{
"extends": "typestrict",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020
},
"rules": {
// optional: override rules
}
}
// tsconfig.json
{
"compilerOptions": {
"strict": true,
"noUnusedLocals": true
// ...
}
}