Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linter): update allowed ESLint config file extensions #30127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const getGlobalFlatEslintConfiguration = (
allow: [
// This allows a root project to be present without causing lint errors
// since all projects will depend on this base file.
'^.*/eslint(\\.base)?\\.config\\.[cm]?js$',
'^.*/eslint(\\.base)?\\.config\\.[cm]?[jt]s$',
],
depConstraints: [
{ sourceTag: '*', onlyDependOnLibsWithTags: ['*'] },
Expand Down
6 changes: 4 additions & 2 deletions packages/eslint/src/generators/lint-project/lint-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,10 @@ function createEsLintConfiguration(
'@nx/dependency-checks': [
'error',
{
// With flat configs, we don't want to include imports in the eslint js/cjs/mjs files to be checked
ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs}'],
// With flat configs, we don't want to include imports in the eslint js/cjs/mjs/ts/cts/mts files to be checked
ignoredFiles: [
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
],
},
],
},
Expand Down
7 changes: 7 additions & 0 deletions packages/eslint/src/utils/flat-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ export const eslintFlatConfigFilenames = [
'eslint.config.cjs',
'eslint.config.js',
'eslint.config.mjs',
'eslint.config.cts',
'eslint.config.ts',
'eslint.config.mts',
];

export const baseEslintConfigFilenames = [
'eslint.base.js',
'eslint.base.ts',
'eslint.base.config.cjs',
'eslint.base.config.js',
'eslint.base.config.mjs',
'eslint.base.config.cts',
'eslint.base.config.ts',
'eslint.base.config.mts',
];

export function getRootESLintFlatConfigFilename(tree: Tree): string {
Expand Down