-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schematics): add
allow
option to whitelist deep imports
Adds an `allow` option to the `nx-enforce-module-boundaries` rule. This option allows users to provide a specific set of library deep imports that should be whitelisted. Values need to be to be absolute library import paths, e.g., `@npmScope/library/subdirectory`. This option does not affect relative imports.
- Loading branch information
1 parent
7e479be
commit b3f6735
Showing
7 changed files
with
35 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { updateJsonFile } from '../src/collection/utility/fileutils'; | ||
|
||
export default { | ||
description: 'Update the schema file to reflect the `allow` option for `nx-enforce-module-boundaries`.', | ||
run: () => { | ||
updateJsonFile('tslint.json', json => { | ||
const ruleName = 'nx-enforce-module-boundaries'; | ||
const ruleOptionName = 'allow'; | ||
const rule = ruleName in json.rules ? json.rules[ruleName] : null; | ||
|
||
// Only modify when the rule is configured with optional arguments | ||
if (Array.isArray(rule) && typeof rule[2] === 'object' && rule[2] !== null) { | ||
rule[2][ruleOptionName] = []; | ||
} | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,7 +114,8 @@ | |
true, | ||
{ | ||
"npmScope": "<%= npmScope %>", | ||
"lazyLoad": [] | ||
"lazyLoad": [], | ||
"allow": [] | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters