Skip to content

Commit

Permalink
fix(misc): add files to flat config overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Sep 10, 2024
1 parent f7ba497 commit 09b2d8d
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 7 deletions.
5 changes: 5 additions & 0 deletions packages/angular/src/generators/add-linting/add-linting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export async function addLintingGenerator(
'flat/angular-template'
);
addOverrideToLintConfig(tree, options.projectRoot, {
files: ['*.ts'],
rules: {
'@angular-eslint/directive-selector': [
'error',
Expand All @@ -84,6 +85,10 @@ export async function addLintingGenerator(
],
},
});
addOverrideToLintConfig(tree, options.projectRoot, {
files: ['*.html'],
rules: {},
});

if (isBuildableLibraryProject(tree, options.projectName)) {
addOverrideToLintConfig(tree, '', {
Expand Down
6 changes: 6 additions & 0 deletions packages/angular/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,7 @@ describe('lib', () => {
...nx.configs["flat/angular"],
...nx.configs["flat/angular-template"],
{
files: ["**/*.ts"],
rules: {
"@angular-eslint/directive-selector": [
"error",
Expand All @@ -1233,6 +1234,11 @@ describe('lib', () => {
}
]
}
},
{
files: ["**/*.html"],
// Override or add rules here
rules: {}
}
];
"
Expand Down
5 changes: 4 additions & 1 deletion packages/cypress/src/utils/add-linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ export async function addLinterToCyProject(
false,
false
);
addOverrideToLintConfig(tree, projectConfig.root, { rules: {} });
addOverrideToLintConfig(tree, projectConfig.root, {
files: ['*.ts', '*.js'],
rules: {},
});
} else {
if (options.rootProject) {
addPluginsToLintConfig(tree, projectConfig.root, '@nx');
Expand Down
5 changes: 4 additions & 1 deletion packages/detox/src/generators/application/lib/add-linting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export async function addLinting(host: Tree, options: NormalizedSchema) {
'flat/react'
);
// Add an empty rules object to users know how to add/override rules
addOverrideToLintConfig(host, options.e2eProjectRoot, { rules: {} });
addOverrideToLintConfig(host, options.e2eProjectRoot, {
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {},
});
} else {
const addExtendsTask = addExtendsToLintConfig(
host,
Expand Down
5 changes: 4 additions & 1 deletion packages/expo/src/utils/add-linting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ export async function addLinting(host: Tree, options: NormalizedSchema) {
'flat/react'
);
// Add an empty rules object to users know how to add/override rules
addOverrideToLintConfig(host, options.projectRoot, { rules: {} });
addOverrideToLintConfig(host, options.projectRoot, {
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {},
});
} else {
const addExtendsTask = addExtendsToLintConfig(host, options.projectRoot, {
name: 'plugin:@nx/react',
Expand Down
5 changes: 4 additions & 1 deletion packages/playwright/src/utils/add-linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ export async function addLinterToPlaywrightProject(
false,
false
);
addOverrideToLintConfig(tree, projectConfig.root, { rules: {} });
addOverrideToLintConfig(tree, projectConfig.root, {
files: ['*.ts', '*.js'],
rules: {},
});
} else {
const addExtendsTask = addExtendsToLintConfig(
tree,
Expand Down
5 changes: 4 additions & 1 deletion packages/react-native/src/utils/add-linting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ export async function addLinting(host: Tree, options: NormalizedSchema) {
'flat/react'
);
// Add an empty rules object to users know how to add/override rules
addOverrideToLintConfig(host, options.projectRoot, { rules: {} });
addOverrideToLintConfig(host, options.projectRoot, {
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {},
});
} else {
const addExtendsTask = addExtendsToLintConfig(host, options.projectRoot, {
name: 'plugin:@nx/react',
Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ async function addLinting(host: Tree, options: NormalizedSchema) {
'flat/react'
);
// Add an empty rules object to users know how to add/override rules
addOverrideToLintConfig(host, options.appProjectRoot, { rules: {} });
addOverrideToLintConfig(host, options.appProjectRoot, {
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {},
});
} else {
const addExtendsTask = addExtendsToLintConfig(
host,
Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/generators/library/lib/add-linting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export async function addLinting(host: Tree, options: NormalizedSchema) {
'flat/react'
);
// Add an empty rules object to users know how to add/override rules
addOverrideToLintConfig(host, options.projectRoot, { rules: {} });
addOverrideToLintConfig(host, options.projectRoot, {
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {},
});
} else {
const addExtendsTask = addExtendsToLintConfig(
host,
Expand Down

0 comments on commit 09b2d8d

Please sign in to comment.