@skyux-sdk/eslint-config 8.3.0 → 8.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyux-sdk/eslint-config",
3
- "version": "8.3.0",
3
+ "version": "8.4.0",
4
4
  "author": "Blackbaud, Inc.",
5
5
  "description": "Angular CLI schematics to implement recommended ESLint configuration",
6
6
  "keywords": [
@@ -33,6 +33,7 @@
33
33
  "dependencies": {
34
34
  "comment-json": "4.2.3",
35
35
  "fs-extra": "10.1.0",
36
+ "jsonc-parser": "3.2.0",
36
37
  "package-json": "7.0.0"
37
38
  },
38
39
  "main": "./src/index.js",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schematics": {
3
3
  "noop": {
4
- "version": "8.3.0",
4
+ "version": "8.4.0",
5
5
  "factory": "./noop/noop.schematic",
6
6
  "description": "Update ESLint dependencies"
7
7
  }
@@ -5,6 +5,7 @@ const fs_extra_1 = require("fs-extra");
5
5
  const path_1 = require("path");
6
6
  const install_dependencies_1 = require("../shared/rules/install-dependencies");
7
7
  const modify_eslint_config_1 = require("../shared/rules/modify-eslint-config");
8
+ const modify_tsconfig_1 = require("../shared/rules/modify-tsconfig");
8
9
  const tree_1 = require("../shared/utility/tree");
9
10
  function getPackageJson(tree) {
10
11
  return JSON.parse((0, tree_1.readRequiredFile)(tree, '/package.json'));
@@ -29,6 +30,7 @@ function ngAdd() {
29
30
  return (0, schematics_1.chain)([
30
31
  (0, install_dependencies_1.installDependencies)(),
31
32
  (0, modify_eslint_config_1.modifyEsLintConfig)(),
33
+ (0, modify_tsconfig_1.modifyTsConfig)(),
32
34
  hardenPackageVersion(),
33
35
  ]);
34
36
  };
@@ -1 +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":";;AAA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BC"}
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function modifyTsConfig(): Rule;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modifyTsConfig = void 0;
4
+ const json_file_1 = require("../utility/json-file");
5
+ function modifyTsConfig() {
6
+ return (tree) => {
7
+ const tsConfig = new json_file_1.JsonFile(tree, '/tsconfig.json');
8
+ // Strict null checks are needed for the 'prefer-nullish-coalescing' rule.
9
+ tsConfig.modify(['compilerOptions', 'strictNullChecks'], true);
10
+ };
11
+ }
12
+ exports.modifyTsConfig = modifyTsConfig;
13
+ //# sourceMappingURL=modify-tsconfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify-tsconfig.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/eslint-config/src/schematics/shared/rules/modify-tsconfig.ts"],"names":[],"mappings":";;;AAEA,oDAAgD;AAEhD,SAAgB,cAAc;IAC5B,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,QAAQ,GAAG,IAAI,oBAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAEtD,0EAA0E;QAC1E,QAAQ,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC,CAAC;AACJ,CAAC;AAPD,wCAOC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The contents of this file were copied from '@schematics/angular'.
3
+ * @see https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/json-file.ts
4
+ */
5
+ import { JsonValue } from '@angular-devkit/core';
6
+ import { Tree } from '@angular-devkit/schematics';
7
+ export type InsertionIndex = (properties: string[]) => number;
8
+ export type JsonPath = (string | number)[];
9
+ /**
10
+ * Handles JSONC files (JSON files that include comments).
11
+ * @internal
12
+ */
13
+ export declare class JsonFile {
14
+ private readonly host;
15
+ private readonly path;
16
+ content: string;
17
+ private get JsonAst();
18
+ private _jsonAst;
19
+ constructor(host: Tree, path: string);
20
+ get(jsonPath: JsonPath): unknown;
21
+ modify(jsonPath: JsonPath, value: JsonValue | undefined, insertInOrder?: InsertionIndex | false): void;
22
+ remove(jsonPath: JsonPath): void;
23
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ /* istanbul ignore file */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.JsonFile = void 0;
5
+ const jsonc_parser_1 = require("jsonc-parser");
6
+ /**
7
+ * Handles JSONC files (JSON files that include comments).
8
+ * @internal
9
+ */
10
+ class JsonFile {
11
+ get JsonAst() {
12
+ if (this._jsonAst) {
13
+ return this._jsonAst;
14
+ }
15
+ const errors = [];
16
+ this._jsonAst = (0, jsonc_parser_1.parseTree)(this.content, errors, {
17
+ allowTrailingComma: true,
18
+ });
19
+ if (errors.length) {
20
+ const { error, offset } = errors[0];
21
+ throw new Error(`Failed to parse "${this.path}" as JSON AST Object. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at location: ${offset}.`);
22
+ }
23
+ return this._jsonAst;
24
+ }
25
+ constructor(host, path) {
26
+ this.host = host;
27
+ this.path = path;
28
+ const buffer = this.host.read(this.path);
29
+ if (buffer) {
30
+ this.content = buffer.toString();
31
+ }
32
+ else {
33
+ throw new Error(`Could not read '${path}'.`);
34
+ }
35
+ }
36
+ get(jsonPath) {
37
+ const jsonAstNode = this.JsonAst;
38
+ if (!jsonAstNode) {
39
+ return undefined;
40
+ }
41
+ if (jsonPath.length === 0) {
42
+ return (0, jsonc_parser_1.getNodeValue)(jsonAstNode);
43
+ }
44
+ const node = (0, jsonc_parser_1.findNodeAtLocation)(jsonAstNode, jsonPath);
45
+ return node === undefined ? undefined : (0, jsonc_parser_1.getNodeValue)(node);
46
+ }
47
+ modify(jsonPath, value, insertInOrder) {
48
+ let getInsertionIndex;
49
+ if (insertInOrder === undefined) {
50
+ const property = jsonPath.slice(-1)[0];
51
+ getInsertionIndex = (properties) => [...properties, property].sort().findIndex((p) => p === property);
52
+ }
53
+ else if (insertInOrder !== false) {
54
+ getInsertionIndex = insertInOrder;
55
+ }
56
+ const edits = (0, jsonc_parser_1.modify)(this.content, jsonPath, value, {
57
+ getInsertionIndex,
58
+ formattingOptions: {
59
+ insertSpaces: true,
60
+ tabSize: 2,
61
+ },
62
+ });
63
+ this.content = (0, jsonc_parser_1.applyEdits)(this.content, edits);
64
+ this.host.overwrite(this.path, this.content);
65
+ this._jsonAst = undefined;
66
+ }
67
+ remove(jsonPath) {
68
+ if (this.get(jsonPath) !== undefined) {
69
+ this.modify(jsonPath, undefined);
70
+ }
71
+ }
72
+ }
73
+ exports.JsonFile = JsonFile;
74
+ //# sourceMappingURL=json-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-file.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/eslint-config/src/schematics/shared/utility/json-file.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAS1B,+CASsB;AAKtB;;;GAGG;AACH,MAAa,QAAQ;IAGnB,IAAY,OAAO;QACjB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;SACtB;QAED,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAA,wBAAS,EAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE;YAC9C,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,oBACE,IAAI,CAAC,IACP,yBAAyB,IAAA,kCAAmB,EAC1C,KAAK,CACN,iBAAiB,MAAM,GAAG,CAC5B,CAAC;SACH;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAID,YAA6B,IAAU,EAAmB,IAAY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