From dc3edb5b0e59de0ee1d1bd8294d0b91e6b8ccec7 Mon Sep 17 00:00:00 2001 From: Rainer Hahnekamp Date: Mon, 28 Oct 2024 22:58:38 +0100 Subject: [PATCH] feat: rename `encapsulationPatternForBarrelLess` to `encapsulationPattern` --- .../core/src/lib/checks/has-encapsulation-violations.ts | 2 +- .../lib/checks/tests/encapsulation-barrel-less.spec.ts | 6 +++--- packages/core/src/lib/config/default-config.ts | 2 +- packages/core/src/lib/config/parse-config.ts | 4 ++-- packages/core/src/lib/config/tests/parse-config.spec.ts | 8 ++++---- packages/core/src/lib/config/user-sheriff-config.ts | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/core/src/lib/checks/has-encapsulation-violations.ts b/packages/core/src/lib/checks/has-encapsulation-violations.ts index 7f31d6e..8ef950f 100644 --- a/packages/core/src/lib/checks/has-encapsulation-violations.ts +++ b/packages/core/src/lib/checks/has-encapsulation-violations.ts @@ -27,7 +27,7 @@ export function hasEncapsulationViolations( accessesExposedFileForBarrelLessModules( importedFileInfo, config.enableBarrelLess, - config.encapsulationPatternForBarrelLess, + config.encapsulationPattern, ) ) { // 👍 all good diff --git a/packages/core/src/lib/checks/tests/encapsulation-barrel-less.spec.ts b/packages/core/src/lib/checks/tests/encapsulation-barrel-less.spec.ts index 6b5aa44..def62f7 100644 --- a/packages/core/src/lib/checks/tests/encapsulation-barrel-less.spec.ts +++ b/packages/core/src/lib/checks/tests/encapsulation-barrel-less.spec.ts @@ -153,7 +153,7 @@ describe('barrel-less', () => { it('should be able to change the name of internals', () => { assertProject({ - encapsulationPatternForBarrelLess: 'private', + encapsulationPattern: 'private', }) .withCustomerRoute({ feature: { @@ -171,7 +171,7 @@ describe('barrel-less', () => { }); it('should always prioritize the barrel file', () => { - assertProject({ showWarningOnBarrelCollision: false }) + assertProject() .withCustomerRoute({ feature: { 'customer.component.ts': ['../data'], @@ -205,7 +205,7 @@ describe('barrel-less', () => { }); it.skip('should support wildcards', () => { - assertProject({ encapsulationPatternForBarrelLess: '**/internal' }) + assertProject({ encapsulationPattern: '**/internal' }) .withCustomerRoute({ feature: { 'customer.component.ts': [], diff --git a/packages/core/src/lib/config/default-config.ts b/packages/core/src/lib/config/default-config.ts index 22d6cb3..74014ff 100644 --- a/packages/core/src/lib/config/default-config.ts +++ b/packages/core/src/lib/config/default-config.ts @@ -7,7 +7,7 @@ export const defaultConfig: Configuration = { depRules: {}, excludeRoot: false, enableBarrelLess: false, - encapsulationPatternForBarrelLess: 'internal', + encapsulationPattern: 'internal', log: false, entryFile: '', isConfigFileMissing: false, diff --git a/packages/core/src/lib/config/parse-config.ts b/packages/core/src/lib/config/parse-config.ts index fe2ad83..982a886 100644 --- a/packages/core/src/lib/config/parse-config.ts +++ b/packages/core/src/lib/config/parse-config.ts @@ -30,14 +30,14 @@ export const parseConfig = (configFile: FsPath): Configuration => { } if ( - userSheriffConfig.encapsulationPatternForBarrelLess !== undefined && + userSheriffConfig.encapsulationPattern !== undefined && userSheriffConfig.encapsulatedFolderNameForBarrelLess !== undefined ) { throw new CollidingEncapsulationSettings(); } if (userSheriffConfig.encapsulatedFolderNameForBarrelLess) { - userSheriffConfig.encapsulationPatternForBarrelLess = + userSheriffConfig.encapsulationPattern = userSheriffConfig.encapsulatedFolderNameForBarrelLess; } diff --git a/packages/core/src/lib/config/tests/parse-config.spec.ts b/packages/core/src/lib/config/tests/parse-config.spec.ts index af76fe2..1fd3fa0 100644 --- a/packages/core/src/lib/config/tests/parse-config.spec.ts +++ b/packages/core/src/lib/config/tests/parse-config.spec.ts @@ -32,7 +32,7 @@ describe('parse Config', () => { 'depRules', 'excludeRoot', 'enableBarrelLess', - 'encapsulationPatternForBarrelLess', + 'encapsulationPattern', 'log', 'entryFile', 'isConfigFileMissing', @@ -72,7 +72,7 @@ export const config: SheriffConfig = { modules: {}, depRules: { noTag: 'noTag' }, enableBarrelLess: false, - encapsulationPatternForBarrelLess: 'internal', + encapsulationPattern: 'internal', excludeRoot: false, log: false, isConfigFileMissing: false, @@ -154,7 +154,7 @@ export const config: SheriffConfig = { expect(parseConfig( toFsPath(getFs().cwd() + '/sheriff.config.ts') - ).encapsulationPatternForBarrelLess).toBe('_private') + ).encapsulationPattern).toBe('_private') }) it('should throw if both encapsulatedFolderNameForBarrelLess and encapsulationPatternForBarrelLess exist', () => { @@ -169,7 +169,7 @@ export const config: SheriffConfig = { 'noTag': 'noTag', }, encapsulatedFolderNameForBarrelLess: 'internal', - encapsulationPatternForBarrelLess: 'internal' + encapsulationPattern: 'internal' }; `, ); diff --git a/packages/core/src/lib/config/user-sheriff-config.ts b/packages/core/src/lib/config/user-sheriff-config.ts index 69c5827..3958e9a 100644 --- a/packages/core/src/lib/config/user-sheriff-config.ts +++ b/packages/core/src/lib/config/user-sheriff-config.ts @@ -178,7 +178,7 @@ export interface UserSheriffConfig { * which are not available outside the module. * By default, it is set to `internal`. * - * @deprecated use {@link encapsulationPatternForBarrelLess} instead + * @deprecated use {@link encapsulationPattern} instead */ encapsulatedFolderNameForBarrelLess?: string; @@ -200,7 +200,7 @@ export interface UserSheriffConfig { * This is a more powerful alternative to * {@link encapsulatedFolderNameForBarrelLess}. */ - encapsulationPatternForBarrelLess?: string + encapsulationPattern?: string /** * @deprecated no warning is shown.