@skyux-sdk/eslint-config 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +7 -0
  2. package/collection.json +10 -0
  3. package/package.json +44 -0
  4. package/recommended.json +105 -0
  5. package/src/index.d.ts +1 -0
  6. package/src/index.js +5 -0
  7. package/src/index.js.map +1 -0
  8. package/src/schematics/migrations/migration-collection.json +9 -0
  9. package/src/schematics/migrations/noop/noop.schematic.d.ts +2 -0
  10. package/src/schematics/migrations/noop/noop.schematic.js +8 -0
  11. package/src/schematics/migrations/noop/noop.schematic.js.map +1 -0
  12. package/src/schematics/ng-add/ng-add.schematic.d.ts +2 -0
  13. package/src/schematics/ng-add/ng-add.schematic.js +12 -0
  14. package/src/schematics/ng-add/ng-add.schematic.js.map +1 -0
  15. package/src/schematics/ng-add/schema.json +5 -0
  16. package/src/schematics/shared/rules/install-dependencies.d.ts +2 -0
  17. package/src/schematics/shared/rules/install-dependencies.js +29 -0
  18. package/src/schematics/shared/rules/install-dependencies.js.map +1 -0
  19. package/src/schematics/shared/rules/modify-eslint-config.d.ts +2 -0
  20. package/src/schematics/shared/rules/modify-eslint-config.js +33 -0
  21. package/src/schematics/shared/rules/modify-eslint-config.js.map +1 -0
  22. package/src/schematics/shared/testing/scaffold.d.ts +13 -0
  23. package/src/schematics/shared/testing/scaffold.js +36 -0
  24. package/src/schematics/shared/testing/scaffold.js.map +1 -0
  25. package/src/schematics/shared/types/eslint-config.d.ts +14 -0
  26. package/src/schematics/shared/types/eslint-config.js +3 -0
  27. package/src/schematics/shared/types/eslint-config.js.map +1 -0
  28. package/src/schematics/shared/utility/tree.d.ts +8 -0
  29. package/src/schematics/shared/utility/tree.js +39 -0
  30. package/src/schematics/shared/utility/tree.js.map +1 -0
  31. package/src/schematics/shared/utility/workspace.d.ts +25 -0
  32. package/src/schematics/shared/utility/workspace.js +76 -0
  33. package/src/schematics/shared/utility/workspace.js.map +1 -0
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # eslint-config
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Running unit tests
6
+
7
+ Run `nx test eslint-config` to execute the unit tests via [Jest](https://jestjs.io).
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Add @skyux-sdk/eslint-config to your project.",
6
+ "factory": "./src/schematics/ng-add/ng-add.schematic",
7
+ "schema": "./src/schematics/ng-add/schema.json"
8
+ }
9
+ }
10
+ }
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@skyux-sdk/eslint-config",
3
+ "version": "8.2.0",
4
+ "author": "Blackbaud, Inc.",
5
+ "description": "Angular CLI schematics to implement recommended ESLint configuration",
6
+ "keywords": [
7
+ "blackbaud",
8
+ "skyux"
9
+ ],
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/blackbaud/skyux.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/blackbaud/skyux/issues"
17
+ },
18
+ "homepage": "https://github.com/blackbaud/skyux#readme",
19
+ "schematics": "./collection.json",
20
+ "ng-add": {
21
+ "save": "devDependencies"
22
+ },
23
+ "ng-update": {
24
+ "migrations": "./src/schematics/migrations/migration-collection.json",
25
+ "packageGroup": {
26
+ "eslint-plugin-deprecation": "^1.4.1"
27
+ }
28
+ },
29
+ "peerDependencies": {
30
+ "@angular/cli": "^15.2.8",
31
+ "@angular-eslint/eslint-plugin": "^15.2.1",
32
+ "@angular-eslint/eslint-plugin-template": "^15.2.1",
33
+ "@angular-eslint/template-parser": "^15.2.1",
34
+ "@typescript-eslint/eslint-plugin": "^5.59.5",
35
+ "@typescript-eslint/parser": "^5.59.5",
36
+ "eslint-plugin-deprecation": "^1.4.1",
37
+ "eslint": "^8.36.0"
38
+ },
39
+ "dependencies": {
40
+ "comment-json": "4.2.3"
41
+ },
42
+ "main": "./src/index.js",
43
+ "types": "./src/index.d.ts"
44
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "reportUnusedDisableDirectives": true,
3
+ "extends": [
4
+ "eslint:recommended",
5
+ "plugin:@angular-eslint/recommended",
6
+ "plugin:@angular-eslint/template/process-inline-templates",
7
+ "plugin:@typescript-eslint/recommended",
8
+ "plugin:@typescript-eslint/recommended-requiring-type-checking"
9
+ ],
10
+ "plugins": [
11
+ "@angular-eslint",
12
+ "@angular-eslint/template",
13
+ "@typescript-eslint",
14
+ "deprecation"
15
+ ],
16
+ "rules": {
17
+ "deprecation/deprecation": "warn",
18
+
19
+ "curly": "error",
20
+ "default-case": "error",
21
+ "default-case-last": "error",
22
+ "eqeqeq": ["error", "always"],
23
+ "guard-for-in": "error",
24
+ "id-denylist": [
25
+ "error",
26
+ "any",
27
+ "boolean",
28
+ "Boolean",
29
+ "number",
30
+ "Number",
31
+ "object",
32
+ "Object",
33
+ "string",
34
+ "String",
35
+ "undefined",
36
+ "Undefined"
37
+ ],
38
+ "no-alert": "error",
39
+ "no-caller": "error",
40
+ "no-console": "error",
41
+ "no-constant-binary-expression": "error",
42
+ "no-constructor-return": "error",
43
+ "no-duplicate-imports": ["error", { "includeExports": true }],
44
+ "no-eval": "error",
45
+ "no-lonely-if": "error",
46
+ "no-mixed-operators": "error",
47
+ "no-new-wrappers": "error",
48
+ "no-self-compare": "error",
49
+ "no-template-curly-in-string": "error",
50
+ "no-unmodified-loop-condition": "error",
51
+ "no-unreachable-loop": "error",
52
+ "no-unused-private-class-members": "error",
53
+ "no-use-before-define": [
54
+ "error",
55
+ { "functions": false, "classes": true, "variables": true }
56
+ ],
57
+ "no-useless-return": "error",
58
+ "prefer-arrow-callback": "error",
59
+ "prefer-regex-literals": "error",
60
+ "radix": "error",
61
+ "require-atomic-updates": "error",
62
+
63
+ "@typescript-eslint/array-type": "error",
64
+ "@typescript-eslint/ban-tslint-comment": "error",
65
+ "@typescript-eslint/consistent-generic-constructors": "error",
66
+ "default-param-last": "off",
67
+ "@typescript-eslint/default-param-last": "error",
68
+ "dot-notation": "off",
69
+ "@typescript-eslint/dot-notation": "error",
70
+ "@typescript-eslint/explicit-member-accessibility": [
71
+ "error",
72
+ { "overrides": { "constructors": "no-public" } }
73
+ ],
74
+ "@typescript-eslint/explicit-module-boundary-types": "error",
75
+ "@typescript-eslint/no-base-to-string": "error",
76
+ "@typescript-eslint/no-confusing-non-null-assertion": "error",
77
+ "@typescript-eslint/no-confusing-void-expression": "error",
78
+ "@typescript-eslint/no-duplicate-enum-values": "error",
79
+ "@typescript-eslint/no-mixed-enums": "error",
80
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
81
+ "@typescript-eslint/no-redundant-type-constituents": "error",
82
+ "no-shadow": "off",
83
+ "@typescript-eslint/no-shadow": "error",
84
+ "@typescript-eslint/no-unsafe-declaration-merging": "error",
85
+ "no-unused-expressions": "off",
86
+ "@typescript-eslint/no-unused-expressions": "error",
87
+ "@typescript-eslint/non-nullable-type-assertion-style": "error",
88
+ "@typescript-eslint/prefer-for-of": "error",
89
+ "@typescript-eslint/prefer-function-type": "error",
90
+ "@typescript-eslint/prefer-includes": "error",
91
+ "@typescript-eslint/prefer-literal-enum-member": "error",
92
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
93
+ "@typescript-eslint/prefer-optional-chain": "error",
94
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
95
+ "@typescript-eslint/prefer-return-this-type": "error",
96
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
97
+ "@typescript-eslint/semi": "error",
98
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
99
+ "@typescript-eslint/type-annotation-spacing": "error",
100
+ "@typescript-eslint/unbound-method": ["error", { "ignoreStatic": true }],
101
+
102
+ "@angular-eslint/no-lifecycle-call": "error",
103
+ "@angular-eslint/sort-ngmodule-metadata-arrays": "error"
104
+ }
105
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './schematics/ng-add/ng-add.schematic';
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./schematics/ng-add/ng-add.schematic"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/sdk/eslint-config/src/index.ts"],"names":[],"mappings":";;;AAAA,+EAAqD"}
@@ -0,0 +1,9 @@
1
+ {
2
+ "schematics": {
3
+ "noop": {
4
+ "version": "8.2.0",
5
+ "factory": "./noop/noop.schematic",
6
+ "description": "Update ESLint dependencies"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export default function (): Rule;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function default_1() {
4
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
5
+ return () => { };
6
+ }
7
+ exports.default = default_1;
8
+ //# sourceMappingURL=noop.schematic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.schematic.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/eslint-config/src/schematics/migrations/noop/noop.schematic.ts"],"names":[],"mappings":";;AAEA;IACE,gEAAgE;IAChE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;AAClB,CAAC;AAHD,4BAGC"}
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export default function ngAdd(): Rule;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
+ const install_dependencies_1 = require("../shared/rules/install-dependencies");
5
+ const modify_eslint_config_1 = require("../shared/rules/modify-eslint-config");
6
+ function ngAdd() {
7
+ return () => {
8
+ return (0, schematics_1.chain)([(0, install_dependencies_1.installDependencies)(), (0, modify_eslint_config_1.modifyEsLintConfig)()]);
9
+ };
10
+ }
11
+ exports.default = ngAdd;
12
+ //# sourceMappingURL=ng-add.schematic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-add.schematic.js","sourceRoot":"","sources":["../../../../../../../libs/sdk/eslint-config/src/schematics/ng-add/ng-add.schematic.ts"],"names":[],"mappings":";;AAAA,2DAAyD;AAEzD,+EAA2E;AAC3E,+EAA0E;AAE1E,SAAwB,KAAK;IAC3B,OAAO,GAAG,EAAE;QACV,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAA,0CAAmB,GAAE,EAAE,IAAA,yCAAkB,GAAE,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC;AAJD,wBAIC"}
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "type": "object",
4
+ "properties": {}
5
+ }
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function installDependencies(): Rule;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.installDependencies = void 0;
4
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
5
+ const dependencies_1 = require("@schematics/angular/utility/dependencies");
6
+ function installDependencies() {
7
+ return (tree, context) => {
8
+ context.addTask(new tasks_1.NodePackageInstallTask());
9
+ const packages = {
10
+ '@angular-eslint/eslint-plugin': '^15.2.1',
11
+ '@angular-eslint/eslint-plugin-template': '^15.2.1',
12
+ '@angular-eslint/template-parser': '^15.2.1',
13
+ '@typescript-eslint/eslint-plugin': '^5.59.5',
14
+ '@typescript-eslint/parser': '^5.59.5',
15
+ 'eslint-plugin-deprecation': '^1.4.1',
16
+ eslint: '^8.36.0',
17
+ };
18
+ for (const [packageName, version] of Object.entries(packages)) {
19
+ (0, dependencies_1.addPackageJsonDependency)(tree, {
20
+ name: packageName,
21
+ type: dependencies_1.NodeDependencyType.Dev,
22
+ version,
23
+ overwrite: true,
24
+ });
25
+ }
26
+ };
27
+ }
28
+ exports.installDependencies = installDependencies;
29
+ //# sourceMappingURL=install-dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-dependencies.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/eslint-config/src/schematics/shared/rules/install-dependencies.ts"],"names":[],"mappings":";;;AACA,4DAA0E;AAC1E,2EAGkD;AAElD,SAAgB,mBAAmB;IACjC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAE9C,MAAM,QAAQ,GAA2B;YACvC,+BAA+B,EAAE,SAAS;YAC1C,wCAAwC,EAAE,SAAS;YACnD,iCAAiC,EAAE,SAAS;YAC5C,kCAAkC,EAAE,SAAS;YAC7C,2BAA2B,EAAE,SAAS;YACtC,2BAA2B,EAAE,QAAQ;YACrC,MAAM,EAAE,SAAS;SAClB,CAAC;QAEF,KAAK,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC7D,IAAA,uCAAwB,EAAC,IAAI,EAAE;gBAC7B,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,iCAAkB,CAAC,GAAG;gBAC5B,OAAO;gBACP,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC;AAvBD,kDAuBC"}
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function modifyEsLintConfig(): Rule;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modifyEsLintConfig = void 0;
4
+ const tree_1 = require("../utility/tree");
5
+ const tree_2 = require("../utility/tree");
6
+ const ESLINT_CONFIG_NAME = '@skyux-sdk/eslint-config/recommended';
7
+ const ESLINT_CONFIG_PATH = '.eslintrc.json';
8
+ function modifyEsLintConfig() {
9
+ return async (tree) => {
10
+ const esLintConfig = (0, tree_1.readJsonFile)(tree, ESLINT_CONFIG_PATH);
11
+ if (Array.isArray(esLintConfig.overrides)) {
12
+ // Setup type-checking for ESLint.
13
+ esLintConfig.parser = '@typescript-eslint/parser';
14
+ esLintConfig.parserOptions = {
15
+ project: ['tsconfig.json'],
16
+ tsconfigRootDir: '.',
17
+ };
18
+ // Overwrite the 'extends' array with our configuration.
19
+ for (const override of esLintConfig.overrides) {
20
+ if (override.files.find((f) => f.endsWith('.ts'))) {
21
+ const hasPrettier = override.extends?.includes('prettier');
22
+ override.extends = [ESLINT_CONFIG_NAME];
23
+ if (hasPrettier) {
24
+ override.extends.push('prettier');
25
+ }
26
+ }
27
+ }
28
+ }
29
+ (0, tree_2.writeJsonFile)(tree, ESLINT_CONFIG_PATH, esLintConfig);
30
+ };
31
+ }
32
+ exports.modifyEsLintConfig = modifyEsLintConfig;
33
+ //# sourceMappingURL=modify-eslint-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify-eslint-config.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/eslint-config/src/schematics/shared/rules/modify-eslint-config.ts"],"names":[],"mappings":";;;AAGA,0CAA+C;AAC/C,0CAAgD;AAEhD,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAClE,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAE5C,SAAgB,kBAAkB;IAChC,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,YAAY,GAAG,IAAA,mBAAY,EAAe,IAAI,EAAE,kBAAkB,CAAC,CAAC;QAE1E,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;YACzC,kCAAkC;YAClC,YAAY,CAAC,MAAM,GAAG,2BAA2B,CAAC;YAClD,YAAY,CAAC,aAAa,GAAG;gBAC3B,OAAO,EAAE,CAAC,eAAe,CAAC;gBAC1B,eAAe,EAAE,GAAG;aACrB,CAAC;YAEF,wDAAwD;YACxD,KAAK,MAAM,QAAQ,IAAI,YAAY,CAAC,SAAS,EAAE;gBAC7C,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;oBACjD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;oBAE3D,QAAQ,CAAC,OAAO,GAAG,CAAC,kBAAkB,CAAC,CAAC;oBAExC,IAAI,WAAW,EAAE;wBACf,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;qBACnC;iBACF;aACF;SACF;QAED,IAAA,oBAAa,EAAC,IAAI,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC;AA5BD,gDA4BC"}
@@ -0,0 +1,13 @@
1
+ import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
2
+ /**
3
+ * Creates a new Angular CLI application.
4
+ */
5
+ export declare function createTestApp(runner: SchematicTestRunner, appOptions: {
6
+ defaultProjectName: string;
7
+ }): Promise<UnitTestTree>;
8
+ /**
9
+ * Create a test workspace with a library as the default project.
10
+ */
11
+ export declare function createTestLibrary(runner: SchematicTestRunner, libOptions: {
12
+ name: string;
13
+ }): Promise<UnitTestTree>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTestLibrary = exports.createTestApp = void 0;
4
+ const cli_1 = require("@angular/cli");
5
+ /**
6
+ * Creates a new Angular CLI application.
7
+ */
8
+ async function createTestApp(runner, appOptions) {
9
+ return await runner.runExternalSchematic('@schematics/angular', 'ng-new', {
10
+ directory: '/',
11
+ name: appOptions.defaultProjectName,
12
+ routing: true,
13
+ strict: true,
14
+ style: 'scss',
15
+ version: cli_1.VERSION.major,
16
+ });
17
+ }
18
+ exports.createTestApp = createTestApp;
19
+ /**
20
+ * Create a test workspace with a library as the default project.
21
+ */
22
+ async function createTestLibrary(runner, libOptions) {
23
+ const workspaceTree = await runner.runExternalSchematic('@schematics/angular', 'ng-new', {
24
+ directory: '/',
25
+ name: `${libOptions.name}-workspace`,
26
+ createApplication: false,
27
+ strict: true,
28
+ version: cli_1.VERSION.major,
29
+ });
30
+ await runner.runExternalSchematic('@schematics/angular', 'library', {
31
+ name: libOptions.name,
32
+ }, workspaceTree);
33
+ return workspaceTree;
34
+ }
35
+ exports.createTestLibrary = createTestLibrary;
36
+ //# sourceMappingURL=scaffold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/eslint-config/src/schematics/shared/testing/scaffold.ts"],"names":[],"mappings":";;;AAIA,sCAAuC;AAEvC;;GAEG;AACI,KAAK,UAAU,aAAa,CACjC,MAA2B,EAC3B,UAEC;IAED,OAAO,MAAM,MAAM,CAAC,oBAAoB,CAAC,qBAAqB,EAAE,QAAQ,EAAE;QACxE,SAAS,EAAE,GAAG;QAEd,IAAI,EAAE,UAAU,CAAC,kBAAkB;QACnC,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,aAAO,CAAC,KAAK;KACvB,CAAC,CAAC;AACL,CAAC;AAfD,sCAeC;AAED;;GAEG;AACI,KAAK,UAAU,iBAAiB,CACrC,MAA2B,EAC3B,UAEC;IAED,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,oBAAoB,CACrD,qBAAqB,EACrB,QAAQ,EACR;QACE,SAAS,EAAE,GAAG;QACd,IAAI,EAAE,GAAG,UAAU,CAAC,IAAI,YAAY;QACpC,iBAAiB,EAAE,KAAK;QACxB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,aAAO,CAAC,KAAK;KACvB,CACF,CAAC;IAEF,MAAM,MAAM,CAAC,oBAAoB,CAC/B,qBAAqB,EACrB,SAAS,EACT;QACE,IAAI,EAAE,UAAU,CAAC,IAAI;KACtB,EACD,aAAa,CACd,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC;AA5BD,8CA4BC"}
@@ -0,0 +1,14 @@
1
+ export interface EsLintConfig {
2
+ extends?: string | string[];
3
+ parser?: string;
4
+ parserOptions?: {
5
+ project: string[];
6
+ tsconfigRootDir: string;
7
+ };
8
+ overrides?: [
9
+ {
10
+ extends?: string | string[];
11
+ files: string[];
12
+ }
13
+ ];
14
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=eslint-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eslint-config.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/eslint-config/src/schematics/shared/types/eslint-config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ /**
3
+ * Returns the contents of a required file or throws an error if it doesn't exist.
4
+ */
5
+ export declare function readRequiredFile(tree: Tree, filePath: string): string;
6
+ export declare function readJsonFile<T>(tree: Tree, path: string): T;
7
+ export declare function writeTextFile(tree: Tree, path: string, contents: string): void;
8
+ export declare function writeJsonFile<T>(tree: Tree, path: string, contents: T): void;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeJsonFile = exports.writeTextFile = exports.readJsonFile = exports.readRequiredFile = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@angular-devkit/core");
6
+ const comment_json_1 = tslib_1.__importDefault(require("comment-json"));
7
+ /**
8
+ * Returns the contents of a required file or throws an error if it doesn't exist.
9
+ */
10
+ function readRequiredFile(tree, filePath) {
11
+ const data = tree.read(filePath);
12
+ /* istanbul ignore next */
13
+ if (!data) {
14
+ throw new Error(`The file '${filePath}' was expected to exist but was not found.`);
15
+ }
16
+ return core_1.virtualFs.fileBufferToString(data);
17
+ }
18
+ exports.readRequiredFile = readRequiredFile;
19
+ function readJsonFile(tree, path) {
20
+ if (tree.exists(path)) {
21
+ return comment_json_1.default.parse(readRequiredFile(tree, path));
22
+ }
23
+ return {};
24
+ }
25
+ exports.readJsonFile = readJsonFile;
26
+ function writeTextFile(tree, path, contents) {
27
+ if (tree.exists(path)) {
28
+ tree.overwrite(path, contents);
29
+ }
30
+ else {
31
+ tree.create(path, contents);
32
+ }
33
+ }
34
+ exports.writeTextFile = writeTextFile;
35
+ function writeJsonFile(tree, path, contents) {
36
+ writeTextFile(tree, path, comment_json_1.default.stringify(contents, undefined, 2));
37
+ }
38
+ exports.writeJsonFile = writeJsonFile;
39
+ //# sourceMappingURL=tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/eslint-config/src/schematics/shared/utility/tree.ts"],"names":[],"mappings":";;;;AAAA,+CAAiD;AAGjD,wEAAuC;AAEvC;;GAEG;AACH,SAAgB,gBAAgB,CAAC,IAAU,EAAE,QAAgB;IAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,0BAA0B;IAC1B,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CACb,aAAa,QAAQ,4CAA4C,CAClE,CAAC;KACH;IAED,OAAO,gBAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAVD,4CAUC;AAED,SAAgB,YAAY,CAAI,IAAU,EAAE,IAAY;IACtD,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QACrB,OAAO,sBAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAM,CAAC;KAC7D;IAED,OAAO,EAAO,CAAC;AACjB,CAAC;AAND,oCAMC;AAED,SAAgB,aAAa,CAC3B,IAAU,EACV,IAAY,EACZ,QAAgB;IAEhB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QACrB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KAChC;SAAM;QACL,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KAC7B;AACH,CAAC;AAVD,sCAUC;AAED,SAAgB,aAAa,CAAI,IAAU,EAAE,IAAY,EAAE,QAAW;IACpE,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,sBAAW,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC;AAFD,sCAEC"}
@@ -0,0 +1,25 @@
1
+ import { ProjectDefinition, WorkspaceDefinition, WorkspaceHost } from '@angular-devkit/core/src/workspace';
2
+ import { Rule, Tree } from '@angular-devkit/schematics';
3
+ /**
4
+ * Returns the workspace host and project config (angular.json).
5
+ */
6
+ export declare function getWorkspace(tree: Tree): Promise<{
7
+ host: WorkspaceHost;
8
+ workspace: WorkspaceDefinition;
9
+ }>;
10
+ export declare function getProject(workspace: WorkspaceDefinition, projectName: string): Promise<{
11
+ project: ProjectDefinition;
12
+ projectName: string;
13
+ }>;
14
+ /**
15
+ * Allows updates to the Angular project config (angular.json).
16
+ */
17
+ export declare function updateWorkspace(updater: (workspace: WorkspaceDefinition) => void | Promise<void>): Rule;
18
+ /**
19
+ * Returns the project definition corresponding to the provided name, or throws an
20
+ * error if the project is not found.
21
+ */
22
+ export declare function getRequiredProject(tree: Tree, projectName: string | undefined): Promise<{
23
+ projectName: string;
24
+ project: ProjectDefinition;
25
+ }>;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRequiredProject = exports.updateWorkspace = exports.getProject = exports.getWorkspace = void 0;
4
+ const workspace_1 = require("@angular-devkit/core/src/workspace");
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ const tree_1 = require("./tree");
7
+ /**
8
+ * Creates a workspace host.
9
+ * Taken from: https://angular.io/guide/schematics-for-libraries#get-the-project-configuration
10
+ */
11
+ function createHost(tree) {
12
+ return {
13
+ /* istanbul ignore next */
14
+ async readFile(path) {
15
+ return (0, tree_1.readRequiredFile)(tree, path);
16
+ },
17
+ /* istanbul ignore next */
18
+ async writeFile(path, data) {
19
+ return tree.overwrite(path, data);
20
+ },
21
+ async isDirectory(path) {
22
+ // approximate a directory check
23
+ return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
24
+ },
25
+ async isFile(path) {
26
+ return tree.exists(path);
27
+ },
28
+ };
29
+ }
30
+ /**
31
+ * Returns the workspace host and project config (angular.json).
32
+ */
33
+ async function getWorkspace(tree) {
34
+ const host = createHost(tree);
35
+ const { workspace } = await (0, workspace_1.readWorkspace)('/', host);
36
+ return { host, workspace };
37
+ }
38
+ exports.getWorkspace = getWorkspace;
39
+ async function getProject(workspace, projectName) {
40
+ const project = workspace.projects.get(projectName);
41
+ if (!project) {
42
+ throw new schematics_1.SchematicsException(`The "${projectName}" project is not defined in angular.json. Provide a valid project name.`);
43
+ }
44
+ return { project, projectName };
45
+ }
46
+ exports.getProject = getProject;
47
+ /**
48
+ * Allows updates to the Angular project config (angular.json).
49
+ */
50
+ function updateWorkspace(updater) {
51
+ return async (tree) => {
52
+ const { host, workspace } = await getWorkspace(tree);
53
+ // Send the workspace to the callback to allow it to be modified.
54
+ await updater(workspace);
55
+ // Update the workspace config with any changes.
56
+ await (0, workspace_1.writeWorkspace)(workspace, host);
57
+ };
58
+ }
59
+ exports.updateWorkspace = updateWorkspace;
60
+ /**
61
+ * Returns the project definition corresponding to the provided name, or throws an
62
+ * error if the project is not found.
63
+ */
64
+ async function getRequiredProject(tree, projectName) {
65
+ if (!projectName) {
66
+ throw new Error('A project name is required.');
67
+ }
68
+ const { workspace } = await getWorkspace(tree);
69
+ const project = workspace.projects.get(projectName);
70
+ if (!project) {
71
+ throw new Error(`The project '${projectName}' was not found in the workspace configuration.`);
72
+ }
73
+ return { projectName, project };
74
+ }
75
+ exports.getRequiredProject = getRequiredProject;
76
+ //# sourceMappingURL=workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/eslint-config/src/schematics/shared/utility/workspace.ts"],"names":[],"mappings":";;;AAAA,kEAM4C;AAC5C,2DAA6E;AAE7E,iCAA0C;AAE1C;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAU;IAC5B,OAAO;QACL,0BAA0B;QAC1B,KAAK,CAAC,QAAQ,CAAC,IAAY;YACzB,OAAO,IAAA,uBAAgB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;QACD,0BAA0B;QAC1B,KAAK,CAAC,SAAS,CAAC,IAAY,EAAE,IAAY;YACxC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,IAAY;YAC5B,gCAAgC;YAChC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QACrE,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,IAAY;YACvB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,YAAY,CAAC,IAAU;IAI3C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,yBAAa,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACrD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC;AAPD,oCAOC;AAEM,KAAK,UAAU,UAAU,CAC9B,SAA8B,EAC9B,WAAmB;IAEnB,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,gCAAmB,CAC3B,QAAQ,WAAW,yEAAyE,CAC7F,CAAC;KACH;IAED,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAClC,CAAC;AAZD,gCAYC;AAED;;GAEG;AACH,SAAgB,eAAe,CAC7B,OAAiE;IAEjE,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;QAErD,iEAAiE;QACjE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;QAEzB,gDAAgD;QAChD,MAAM,IAAA,0BAAc,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC;AACJ,CAAC;AAZD,0CAYC;AAED;;;GAGG;AACI,KAAK,UAAU,kBAAkB,CACtC,IAAU,EACV,WAA+B;IAE/B,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;KAChD;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEpD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,gBAAgB,WAAW,iDAAiD,CAC7E,CAAC;KACH;IAED,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC;AAlBD,gDAkBC"}