From af41f0cfb5b22104321800661d30dbca079d32ea Mon Sep 17 00:00:00 2001 From: matthieu-crouzet Date: Wed, 8 Jan 2025 16:45:00 +0100 Subject: [PATCH] fix(eslint): provide default ignores when adding @o3r/eslint-config --- .../@o3r/eslint-config/schematics/ng-add/eslint/index.spec.ts | 3 +++ .../project/eslint.local.config.__extension__.template | 4 ++++ .../workspace/eslint.shared.config.__extension__.template | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/packages/@o3r/eslint-config/schematics/ng-add/eslint/index.spec.ts b/packages/@o3r/eslint-config/schematics/ng-add/eslint/index.spec.ts index 0671942f02..6e6560363f 100644 --- a/packages/@o3r/eslint-config/schematics/ng-add/eslint/index.spec.ts +++ b/packages/@o3r/eslint-config/schematics/ng-add/eslint/index.spec.ts @@ -63,6 +63,7 @@ describe('update eslint config', () => { expect(tree.readText('eslint.local.config.mjs')).toContain(`${monorepoPkgName}/projects`); expect(tree.readText('eslint.shared.config.mjs')).toContain(`${monorepoPkgName}/report-unused-disable-directives`); expect(tree.readText('eslint.shared.config.mjs')).toContain(`${monorepoPkgName}/eslint-config`); + expect(tree.readText('eslint.shared.config.mjs')).toContain(`${monorepoPkgName}/ignores`); }); it('should add an eslint config on an application', async () => { @@ -81,6 +82,7 @@ describe('update eslint config', () => { expect(tree.exists(`${libRoot}/tsconfig.eslint.json`)).toBeFalsy(); expect(tree.readText(`${appRoot}/eslint.config.mjs`)).toContain('import shared from \'../../eslint.shared.config.mjs\''); expect(tree.readText(`${appRoot}/eslint.local.config.mjs`)).toContain(`${pckName}/projects`); + expect(tree.readText(`${appRoot}/eslint.local.config.mjs`)).toContain(`${pckName}/ignores`); expect(tree.readText(`${appRoot}/eslint.local.config.mjs`)).toContain('...globals.browser'); expect(tree.readJson('angular.json')).toEqual({ ...angularJsonContent, @@ -115,6 +117,7 @@ describe('update eslint config', () => { expect(tree.exists(`${appRoot}/tsconfig.eslint.json`)).toBeFalsy(); expect(tree.readText(`${libRoot}/eslint.config.mjs`)).toContain('import shared from \'../../eslint.shared.config.mjs\''); expect(tree.readText(`${libRoot}/eslint.local.config.mjs`)).toContain(`${pckName}/projects`); + expect(tree.readText(`${libRoot}/eslint.local.config.mjs`)).toContain(`${pckName}/ignores`); expect(tree.readText(`${libRoot}/eslint.local.config.mjs`)).not.toContain('...globals.browser'); expect(tree.readJson('angular.json')).toEqual({ ...angularJsonContent, diff --git a/packages/@o3r/eslint-config/schematics/ng-add/eslint/templates/project/eslint.local.config.__extension__.template b/packages/@o3r/eslint-config/schematics/ng-add/eslint/templates/project/eslint.local.config.__extension__.template index 4df72f6665..7369d60d6d 100644 --- a/packages/@o3r/eslint-config/schematics/ng-add/eslint/templates/project/eslint.local.config.__extension__.template +++ b/packages/@o3r/eslint-config/schematics/ng-add/eslint/templates/project/eslint.local.config.__extension__.template @@ -23,5 +23,9 @@ const __dirname = dirname(__filename); ...globals.browser }<% } %> } + }, + { + name: '<%= packageName %>/ignores', + ignores: [] } ]; diff --git a/packages/@o3r/eslint-config/schematics/ng-add/eslint/templates/workspace/eslint.shared.config.__extension__.template b/packages/@o3r/eslint-config/schematics/ng-add/eslint/templates/workspace/eslint.shared.config.__extension__.template index a203b2b3cf..e884467791 100644 --- a/packages/@o3r/eslint-config/schematics/ng-add/eslint/templates/workspace/eslint.shared.config.__extension__.template +++ b/packages/@o3r/eslint-config/schematics/ng-add/eslint/templates/workspace/eslint.shared.config.__extension__.template @@ -13,6 +13,10 @@ const o3rTemplate = require('@o3r/eslint-config/template'); reportUnusedDisableDirectives: 'error' } }, + { + name: '<%= packageName %>/ignores', + ignores: [] + }, { name: '<%= packageName %>/settings', settings: {