Getting Started
Install the plugin:
npm install --save-dev eslint-plugin-tsconfig
Enable one preset in your Flat Config:
import tsconfig from "eslint-plugin-tsconfig";
export default [
tsconfig.configs.recommended,
];
Each preset automatically sets:
files: ["**/*.{json,jsonc}"](targetingtsconfig*.jsonfiles)languageOptions.parserset tojsonc-eslint-parser
Alternative: manual scoped setupโ
If you prefer full control, spread the preset rules manually:
import * as jsoncParser from "jsonc-eslint-parser";
import tsconfig from "eslint-plugin-tsconfig";
export default [
{
files: ["**/tsconfig*.json"],
languageOptions: {
parser: jsoncParser,
},
plugins: {
tsconfig,
},
rules: {
...tsconfig.configs.recommended.rules,
},
},
];
Recommended rolloutโ
- Start with
recommended(two essential rules). - Fix violations, then move to
strictfor stronger conventions. - Add focused presets (
strict-mode,module-resolution,emit-config, etc.) to opt in to focused rule subsets. - Use
allwhen you want every available rule.
Focused subsetsโ
- ๐
tsconfig.configs["strict-mode"] - ๐ฆ
tsconfig.configs["module-resolution"] - ๐ค
tsconfig.configs["emit-config"] - ๐งน
tsconfig.configs["include-hygiene"] - ๐ฏ
tsconfig.configs["lib-target"] - ๐
tsconfig.configs["project-references"]
See the Presets section in this sidebar for details and examples.