- I often get
tsconfigRootDirerrors? - Should I have a root level
eslint.config.js? - Why was
extendsused here but not in the others?
sw
I’d recommend:
-
Have a root
eslint.config.js -
Set:
parserOptions: {
project: true,
tsconfigRootDir: process.cwd(),
}
And inside each package:
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
}
That fixes most tsconfigRootDir issues ![]()
Also quick note: if you’re using the new flat config, it doesn’t use extends anymore — that’s why it looks inconsistent. For the tsconfigRootDir issue, do this:
import js from "@eslint/js";
import tseslint from "typescript-eslint";
export default [
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: process.cwd(),
},
},
},
];
And if you have configs inside each package:
tsconfigRootDir: import.meta.dirname
That’s it — flat config = no extends, and tsconfigRootDir must be explicit
Try this repo to on Github to see more about flat config