If you want to use the same config file (for example lint-staged.config.js) in different apps inside your Nx workspace, you can create a TypeScript path alias.
Open your tsconfig.base.json (or tsconfig.base.ts if using TypeScript config).
Inside compilerOptions, add a new alias under "paths":
{
"compilerOptions": {
"paths": {
"@project-name/lint-config": ["lint-staged.config.js"]
// other existing paths...
}
}
}
import rootConfig from '@project-name/lint-config';
Nx and TypeScript will automatically resolve the alias to your config file. If it doesn’t work right away, restart your TypeScript server or rebuild the project.