@monorepolint/rules 0.5.0-alpha.97 → 0.5.0-beta.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 (151) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +47 -25
  3. package/src/__tests__/alphabeticalScripts.spec.ts +7 -6
  4. package/src/__tests__/bannedDependencies.spec.ts +7 -9
  5. package/src/__tests__/consistentDependencies.spec.ts +8 -7
  6. package/src/__tests__/consistentVersions.spec.ts +7 -6
  7. package/src/__tests__/fileContents.spec.ts +45 -18
  8. package/src/__tests__/mustSatisfyPeerDependencies.spec.ts +41 -40
  9. package/src/__tests__/nestedWorkspaces.spec.ts +7 -6
  10. package/src/__tests__/packageEntry.spec.ts +44 -33
  11. package/src/__tests__/packageOrder.spec.ts +24 -15
  12. package/src/__tests__/packageScript.spec.ts +62 -44
  13. package/src/__tests__/requireDependency.spec.ts +10 -9
  14. package/src/__tests__/utils.ts +11 -6
  15. package/src/alphabeticalDependencies.ts +7 -9
  16. package/src/alphabeticalScripts.ts +7 -9
  17. package/src/bannedDependencies.ts +9 -10
  18. package/src/consistentDependencies.ts +9 -7
  19. package/src/consistentVersions.ts +6 -5
  20. package/src/fileContents.ts +17 -14
  21. package/src/index.ts +13 -13
  22. package/src/mustSatisfyPeerDependencies.ts +16 -11
  23. package/src/nestedWorkspaces.ts +10 -9
  24. package/src/packageEntry.ts +7 -6
  25. package/src/packageOrder.ts +12 -7
  26. package/src/packageScript.ts +12 -16
  27. package/src/public/util.ts +1 -0
  28. package/src/requireDependency.ts +9 -7
  29. package/src/standardTsconfig.ts +11 -9
  30. package/src/util/checkAlpha.ts +2 -2
  31. package/src/util/makeRule.ts +29 -0
  32. package/src/util/packageDependencyGraphService.ts +2 -2
  33. package/tsconfig.json +10 -2
  34. package/lib/__tests__/alphabeticalScripts.spec.d.ts +0 -8
  35. package/lib/__tests__/alphabeticalScripts.spec.d.ts.map +0 -1
  36. package/lib/__tests__/alphabeticalScripts.spec.js +0 -61
  37. package/lib/__tests__/alphabeticalScripts.spec.js.map +0 -1
  38. package/lib/__tests__/bannedDependencies.spec.d.ts +0 -2
  39. package/lib/__tests__/bannedDependencies.spec.d.ts.map +0 -1
  40. package/lib/__tests__/bannedDependencies.spec.js +0 -161
  41. package/lib/__tests__/bannedDependencies.spec.js.map +0 -1
  42. package/lib/__tests__/consistentDependencies.spec.d.ts +0 -2
  43. package/lib/__tests__/consistentDependencies.spec.d.ts.map +0 -1
  44. package/lib/__tests__/consistentDependencies.spec.js +0 -115
  45. package/lib/__tests__/consistentDependencies.spec.js.map +0 -1
  46. package/lib/__tests__/consistentVersions.spec.d.ts +0 -8
  47. package/lib/__tests__/consistentVersions.spec.d.ts.map +0 -1
  48. package/lib/__tests__/consistentVersions.spec.js +0 -183
  49. package/lib/__tests__/consistentVersions.spec.js.map +0 -1
  50. package/lib/__tests__/fileContents.spec.d.ts +0 -8
  51. package/lib/__tests__/fileContents.spec.d.ts.map +0 -1
  52. package/lib/__tests__/fileContents.spec.js +0 -59
  53. package/lib/__tests__/fileContents.spec.js.map +0 -1
  54. package/lib/__tests__/mustSatisfyPeerDependencies.spec.d.ts +0 -8
  55. package/lib/__tests__/mustSatisfyPeerDependencies.spec.d.ts.map +0 -1
  56. package/lib/__tests__/mustSatisfyPeerDependencies.spec.js +0 -1063
  57. package/lib/__tests__/mustSatisfyPeerDependencies.spec.js.map +0 -1
  58. package/lib/__tests__/nestedWorkspaces.spec.d.ts +0 -2
  59. package/lib/__tests__/nestedWorkspaces.spec.d.ts.map +0 -1
  60. package/lib/__tests__/nestedWorkspaces.spec.js +0 -124
  61. package/lib/__tests__/nestedWorkspaces.spec.js.map +0 -1
  62. package/lib/__tests__/packageEntry.spec.d.ts +0 -8
  63. package/lib/__tests__/packageEntry.spec.d.ts.map +0 -1
  64. package/lib/__tests__/packageEntry.spec.js +0 -144
  65. package/lib/__tests__/packageEntry.spec.js.map +0 -1
  66. package/lib/__tests__/packageOrder.spec.d.ts +0 -8
  67. package/lib/__tests__/packageOrder.spec.d.ts.map +0 -1
  68. package/lib/__tests__/packageOrder.spec.js +0 -116
  69. package/lib/__tests__/packageOrder.spec.js.map +0 -1
  70. package/lib/__tests__/packageScript.spec.d.ts +0 -8
  71. package/lib/__tests__/packageScript.spec.d.ts.map +0 -1
  72. package/lib/__tests__/packageScript.spec.js +0 -171
  73. package/lib/__tests__/packageScript.spec.js.map +0 -1
  74. package/lib/__tests__/requireDependency.spec.d.ts +0 -2
  75. package/lib/__tests__/requireDependency.spec.d.ts.map +0 -1
  76. package/lib/__tests__/requireDependency.spec.js +0 -123
  77. package/lib/__tests__/requireDependency.spec.js.map +0 -1
  78. package/lib/__tests__/utils.d.ts +0 -76
  79. package/lib/__tests__/utils.d.ts.map +0 -1
  80. package/lib/__tests__/utils.js +0 -83
  81. package/lib/__tests__/utils.js.map +0 -1
  82. package/lib/alphabeticalDependencies.d.ts +0 -12
  83. package/lib/alphabeticalDependencies.d.ts.map +0 -1
  84. package/lib/alphabeticalDependencies.js +0 -22
  85. package/lib/alphabeticalDependencies.js.map +0 -1
  86. package/lib/alphabeticalScripts.d.ts +0 -12
  87. package/lib/alphabeticalScripts.d.ts.map +0 -1
  88. package/lib/alphabeticalScripts.js +0 -20
  89. package/lib/alphabeticalScripts.js.map +0 -1
  90. package/lib/bannedDependencies.d.ts +0 -33
  91. package/lib/bannedDependencies.d.ts.map +0 -1
  92. package/lib/bannedDependencies.js +0 -131
  93. package/lib/bannedDependencies.js.map +0 -1
  94. package/lib/consistentDependencies.d.ts +0 -17
  95. package/lib/consistentDependencies.d.ts.map +0 -1
  96. package/lib/consistentDependencies.js +0 -75
  97. package/lib/consistentDependencies.js.map +0 -1
  98. package/lib/consistentVersions.d.ts +0 -14
  99. package/lib/consistentVersions.d.ts.map +0 -1
  100. package/lib/consistentVersions.js +0 -94
  101. package/lib/consistentVersions.js.map +0 -1
  102. package/lib/fileContents.d.ts +0 -25
  103. package/lib/fileContents.d.ts.map +0 -1
  104. package/lib/fileContents.js +0 -82
  105. package/lib/fileContents.js.map +0 -1
  106. package/lib/index.d.ts +0 -20
  107. package/lib/index.d.ts.map +0 -1
  108. package/lib/index.js +0 -36
  109. package/lib/index.js.map +0 -1
  110. package/lib/mustSatisfyPeerDependencies.d.ts +0 -240
  111. package/lib/mustSatisfyPeerDependencies.d.ts.map +0 -1
  112. package/lib/mustSatisfyPeerDependencies.js +0 -636
  113. package/lib/mustSatisfyPeerDependencies.js.map +0 -1
  114. package/lib/nestedWorkspaces.d.ts +0 -13
  115. package/lib/nestedWorkspaces.d.ts.map +0 -1
  116. package/lib/nestedWorkspaces.js +0 -50
  117. package/lib/nestedWorkspaces.js.map +0 -1
  118. package/lib/packageEntry.d.ts +0 -25
  119. package/lib/packageEntry.d.ts.map +0 -1
  120. package/lib/packageEntry.js +0 -75
  121. package/lib/packageEntry.js.map +0 -1
  122. package/lib/packageOrder.d.ts +0 -12
  123. package/lib/packageOrder.d.ts.map +0 -1
  124. package/lib/packageOrder.js +0 -103
  125. package/lib/packageOrder.js.map +0 -1
  126. package/lib/packageScript.d.ts +0 -25
  127. package/lib/packageScript.d.ts.map +0 -1
  128. package/lib/packageScript.js +0 -90
  129. package/lib/packageScript.js.map +0 -1
  130. package/lib/requireDependency.d.ts +0 -15
  131. package/lib/requireDependency.d.ts.map +0 -1
  132. package/lib/requireDependency.js +0 -65
  133. package/lib/requireDependency.js.map +0 -1
  134. package/lib/standardTsconfig.d.ts +0 -45
  135. package/lib/standardTsconfig.d.ts.map +0 -1
  136. package/lib/standardTsconfig.js +0 -116
  137. package/lib/standardTsconfig.js.map +0 -1
  138. package/lib/util/checkAlpha.d.ts +0 -10
  139. package/lib/util/checkAlpha.d.ts.map +0 -1
  140. package/lib/util/checkAlpha.js +0 -51
  141. package/lib/util/checkAlpha.js.map +0 -1
  142. package/lib/util/makeDirectory.d.ts +0 -8
  143. package/lib/util/makeDirectory.d.ts.map +0 -1
  144. package/lib/util/makeDirectory.js +0 -28
  145. package/lib/util/makeDirectory.js.map +0 -1
  146. package/lib/util/packageDependencyGraphService.d.ts +0 -37
  147. package/lib/util/packageDependencyGraphService.d.ts.map +0 -1
  148. package/lib/util/packageDependencyGraphService.js +0 -70
  149. package/lib/util/packageDependencyGraphService.js.map +0 -1
  150. package/tsconfig.tsbuildinfo +0 -1
  151. /package/{jest.config.js → jest.config.cjs} +0 -0
@@ -1,13 +0,0 @@
1
- /*!
2
- * Copyright 2019 Palantir Technologies, Inc.
3
- *
4
- * Licensed under the MIT license. See LICENSE file in the project root for details.
5
- *
6
- */
7
- import { RuleModule } from "@monorepolint/core";
8
- import * as r from "runtypes";
9
- export declare const Options: r.Literal<undefined>;
10
- declare type Options = r.Static<typeof Options>;
11
- export declare const nestedWorkspaces: RuleModule<typeof Options>;
12
- export {};
13
- //# sourceMappingURL=nestedWorkspaces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nestedWorkspaces.d.ts","sourceRoot":"","sources":["../src/nestedWorkspaces.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,eAAO,MAAM,OAAO,sBAAc,CAAC;AAEnC,aAAK,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAGxC,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,OAAO,OAAO,CAyCvD,CAAC"}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright 2019 Palantir Technologies, Inc.
4
- *
5
- * Licensed under the MIT license. See LICENSE file in the project root for details.
6
- *
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.nestedWorkspaces = exports.Options = void 0;
10
- const tslib_1 = require("tslib");
11
- const globby_1 = tslib_1.__importDefault(require("globby"));
12
- const path_1 = tslib_1.__importDefault(require("path"));
13
- const r = tslib_1.__importStar(require("runtypes"));
14
- exports.Options = r.Undefined;
15
- // Enforce that the root package.json contains all of the workspaces in the repo (including nested packages)
16
- exports.nestedWorkspaces = {
17
- check: (context) => {
18
- const rootPackageJson = context.getWorkspaceContext().getPackageJson();
19
- // Expand a set of globs covering all package.json files in the entire repo (except the root)
20
- const packageJsonPaths = globby_1.default.sync(["*/**/package.json", "!**/node_modules/**"]);
21
- const workspaces = Array.isArray(rootPackageJson.workspaces)
22
- ? rootPackageJson.workspaces
23
- : rootPackageJson.workspaces !== undefined
24
- ? rootPackageJson.workspaces.packages
25
- : undefined;
26
- if (workspaces === undefined && packageJsonPaths.length > 0) {
27
- context.addError({
28
- file: context.getPackageJsonPath(),
29
- message: 'The "workspace" field is missing, even though there are workspaces in the repository.',
30
- });
31
- return;
32
- }
33
- // Build a set of globs for each package.json that exists in packages specified by a workspace.
34
- const workspacePackageJsons = (workspaces || []).map((item) => `${item}/package.json`);
35
- // Expand the globs to get an array of all package.json files that are in packages specified by a workspace.
36
- const expandedWorkspacesGlobs = globby_1.default.sync([...workspacePackageJsons, "!**/node_modules/**"]);
37
- // Ensure there are no package.jsons which are not included in the globbed workspaces set
38
- const difference = packageJsonPaths.filter((packageJsonPath) => !expandedWorkspacesGlobs.includes(packageJsonPath));
39
- if (difference.length !== 0) {
40
- const differencesList = difference.map((packageJsonPath) => path_1.default.dirname(packageJsonPath)).join(", ");
41
- context.addError({
42
- file: context.getPackageJsonPath(),
43
- message: `The "workspace" field is missing one or more values: ${differencesList}. ` +
44
- 'You may be able to use a glob to avoid listing each workspace individually, e.g. "packages/nested-workspace/*".',
45
- });
46
- }
47
- },
48
- optionsRuntype: exports.Options,
49
- };
50
- //# sourceMappingURL=nestedWorkspaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nestedWorkspaces.js","sourceRoot":"","sources":["../src/nestedWorkspaces.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,4DAA4B;AAC5B,wDAAwB;AACxB,oDAA8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AAC,MAAM,KAAK,CAAC,EAAE;YAC3B,MAAM,eAAe,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtG,OAAO,CAAC,QAAQ,CAAC;gBACf,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;gBAClC,OAAO,EACL,wDAAwD,eAAe,IAAI;oBAC3E,iHAAiH;aACpH,CAAC,CAAC;SACJ;IACH,CAAC;IACD,cAAc,EAAE,eAAO;CACxB,CAAC"}
@@ -1,25 +0,0 @@
1
- /*!
2
- * Copyright 2019 Palantir Technologies, Inc.
3
- *
4
- * Licensed under the MIT license. See LICENSE file in the project root for details.
5
- *
6
- */
7
- import { RuleModule } from "@monorepolint/core";
8
- import * as r from "runtypes";
9
- export declare const Options: r.Union<[r.Intersect<[r.Record<{
10
- entries: r.Dictionary<r.Unknown, string | number | symbol>;
11
- }, false>, r.Partial<{
12
- entriesExist: r.Literal<undefined>;
13
- }, false>]>, r.Intersect<[r.Record<{
14
- entriesExist: r.Array<r.String, false>;
15
- }, false>, r.Partial<{
16
- entries: r.Literal<undefined>;
17
- }, false>]>, r.Record<{
18
- entries: r.Dictionary<r.Unknown, string | number | symbol>;
19
- entriesExist: r.Array<r.String, false>;
20
- }, false>]>;
21
- export declare type Options = r.Static<typeof Options>;
22
- export declare const packageEntry: RuleModule<typeof Options>;
23
- export declare function createStandardizedEntryErrorMessage(key: string): string;
24
- export declare function createExpectedEntryErrorMessage(key: string): string;
25
- //# sourceMappingURL=packageEntry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageEntry.d.ts","sourceRoot":"","sources":["../src/packageEntry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,eAAO,MAAM,OAAO;;;;;;;;;;;WAuBnB,CAAC;AAEF,oBAAY,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,OAAO,OAAO,CAyCnD,CAAC;AAEF,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,MAAM,UAE9D;AAED,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,MAAM,UAE1D"}
@@ -1,75 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright 2019 Palantir Technologies, Inc.
4
- *
5
- * Licensed under the MIT license. See LICENSE file in the project root for details.
6
- *
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.createExpectedEntryErrorMessage = exports.createStandardizedEntryErrorMessage = exports.packageEntry = exports.Options = void 0;
10
- const tslib_1 = require("tslib");
11
- const utils_1 = require("@monorepolint/utils");
12
- const jest_diff_1 = tslib_1.__importDefault(require("jest-diff"));
13
- const r = tslib_1.__importStar(require("runtypes"));
14
- exports.Options = r.Union(r
15
- .Record({
16
- entries: r.Dictionary(r.Unknown), // string => unknown, enforces existence of keys and their values
17
- })
18
- .And(r.Partial({
19
- entriesExist: r.Undefined,
20
- })), r
21
- .Record({
22
- entriesExist: r.Array(r.String), // enforces existence of keys, but not values
23
- })
24
- .And(r.Partial({
25
- entries: r.Undefined,
26
- })), r.Record({
27
- entries: r.Dictionary(r.Unknown),
28
- entriesExist: r.Array(r.String),
29
- }));
30
- exports.packageEntry = {
31
- check: function expectPackageEntry(context, options) {
32
- const packageJson = context.getPackageJson();
33
- if (options.entries) {
34
- for (const key of Object.keys(options.entries)) {
35
- const value = options.entries[key];
36
- const entryDiff = (0, jest_diff_1.default)(JSON.stringify(value) + "\n", (JSON.stringify(packageJson[key]) || "") + "\n");
37
- if ((typeof value !== "object" && value !== packageJson[key]) ||
38
- entryDiff == null ||
39
- !entryDiff.includes("Compared values have no visual difference")) {
40
- context.addError({
41
- file: context.getPackageJsonPath(),
42
- message: createStandardizedEntryErrorMessage(key),
43
- longMessage: entryDiff,
44
- fixer: () => {
45
- (0, utils_1.mutateJson)(context.getPackageJsonPath(), context.host, (input) => {
46
- input[key] = value;
47
- return input;
48
- });
49
- },
50
- });
51
- }
52
- }
53
- }
54
- if (options.entriesExist) {
55
- for (const key of options.entriesExist) {
56
- if (packageJson[key] === undefined) {
57
- context.addError({
58
- file: context.getPackageJsonPath(),
59
- message: createExpectedEntryErrorMessage(key),
60
- });
61
- }
62
- }
63
- }
64
- },
65
- optionsRuntype: exports.Options,
66
- };
67
- function createStandardizedEntryErrorMessage(key) {
68
- return `Expected standardized entry for '${key}'`;
69
- }
70
- exports.createStandardizedEntryErrorMessage = createStandardizedEntryErrorMessage;
71
- function createExpectedEntryErrorMessage(key) {
72
- return `Expected entry for '${key}' to exist`;
73
- }
74
- exports.createExpectedEntryErrorMessage = createExpectedEntryErrorMessage;
75
- //# sourceMappingURL=packageEntry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageEntry.js","sourceRoot":"","sources":["../src/packageEntry.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,+CAA8D;AAC9D,kEAA6B;AAC7B,oDAA8B;AAEjB,QAAA,OAAO,GAAG,CAAC,CAAC,KAAK,CAC5B,CAAC;KACE,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,iEAAiE;CACpG,CAAC;KACD,GAAG,CACF,CAAC,CAAC,OAAO,CAAC;IACR,YAAY,EAAE,CAAC,CAAC,SAAS;CAC1B,CAAC,CACH,EACH,CAAC;KACE,MAAM,CAAC;IACN,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,6CAA6C;CAC/E,CAAC;KACD,GAAG,CACF,CAAC,CAAC,OAAO,CAAC;IACR,OAAO,EAAE,CAAC,CAAC,SAAS;CACrB,CAAC,CAC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,OAAO,KAAK,CAAC;4BACf,CAAC,CAAC,CAAC;wBACL,CAAC;qBACF,CAAC,CAAC;iBACJ;aACF;SACF;QAED,IAAI,OAAO,CAAC,YAAY,EAAE;YACxB,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,YAAY,EAAE;gBACtC,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;oBAClC,OAAO,CAAC,QAAQ,CAAC;wBACf,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;wBAClC,OAAO,EAAE,+BAA+B,CAAC,GAAG,CAAC;qBAC9C,CAAC,CAAC;iBACJ;aACF;SACF;IACH,CAAC;IACD,cAAc,EAAE,eAAO;CACxB,CAAC;AAEF,SAAgB,mCAAmC,CAAC,GAAW;IAC7D,OAAO,oCAAoC,GAAG,GAAG,CAAC;AACpD,CAAC;AAFD,kFAEC;AAED,SAAgB,+BAA+B,CAAC,GAAW;IACzD,OAAO,uBAAuB,GAAG,YAAY,CAAC;AAChD,CAAC;AAFD,0EAEC"}
@@ -1,12 +0,0 @@
1
- /*!
2
- * Copyright 2019 Palantir Technologies, Inc.
3
- *
4
- * Licensed under the MIT license. See LICENSE file in the project root for details.
5
- *
6
- */
7
- import { RuleModule } from "@monorepolint/core";
8
- import * as r from "runtypes";
9
- export declare const packageOrder: RuleModule<r.Union<[r.Record<{
10
- order: r.Union<[r.Array<r.String, false>, r.Function]>;
11
- }, false>, r.Literal<undefined>]>>;
12
- //# sourceMappingURL=packageOrder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageOrder.d.ts","sourceRoot":"","sources":["../src/packageOrder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAyC9B,eAAO,MAAM,YAAY;;kCA8BM,CAAC"}
@@ -1,103 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright 2019 Palantir Technologies, Inc.
4
- *
5
- * Licensed under the MIT license. See LICENSE file in the project root for details.
6
- *
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.packageOrder = void 0;
10
- const tslib_1 = require("tslib");
11
- const jest_diff_1 = tslib_1.__importDefault(require("jest-diff"));
12
- const r = tslib_1.__importStar(require("runtypes"));
13
- const Options = r
14
- .Record({
15
- order: r.Union(r.Array(r.String), r.Function),
16
- })
17
- .Or(r.Undefined);
18
- const defaultKeyOrder = [
19
- "name",
20
- "version",
21
- "description",
22
- "author",
23
- "contributors",
24
- "url",
25
- "license",
26
- "private",
27
- "engines",
28
- "bin",
29
- "main",
30
- "module",
31
- "typings",
32
- "style",
33
- "sideEffects",
34
- "workspaces",
35
- "husky",
36
- "lint-staged",
37
- "files",
38
- "scripts",
39
- "resolutions",
40
- "dependencies",
41
- "peerDependencies",
42
- "devDependencies",
43
- "optionalDependencies",
44
- "publishConfig",
45
- ];
46
- exports.packageOrder = {
47
- check: function expectPackageOrder(context, opts) {
48
- const packageJson = context.getPackageJson();
49
- const packagePath = context.getPackageJsonPath();
50
- const order = opts === undefined ? defaultKeyOrder : opts.order;
51
- const comparator = isOrderFunction(order) ? order(context) : createComparator(order);
52
- const actualOrder = Object.keys(packageJson);
53
- const expectedOrder = actualOrder.slice().sort(comparator); // sort mutates, so we need to copy the previous result
54
- if (!arrayOrderCompare(actualOrder, expectedOrder)) {
55
- context.addError({
56
- file: packagePath,
57
- message: "Incorrect order of fields in package.json",
58
- longMessage: (0, jest_diff_1.default)(expectedOrder, actualOrder, { expand: true }),
59
- fixer: () => {
60
- const expectedPackageJson = {};
61
- expectedOrder.forEach((key) => {
62
- expectedPackageJson[key] = packageJson[key];
63
- });
64
- context.host.writeJson(packagePath, expectedPackageJson);
65
- },
66
- });
67
- }
68
- },
69
- optionsRuntype: Options,
70
- };
71
- function arrayOrderCompare(a, b) {
72
- for (let index = 0; index < a.length; index++) {
73
- if (a[index] !== b[index]) {
74
- return false;
75
- }
76
- }
77
- return true;
78
- }
79
- function createComparator(order) {
80
- return (a, b) => {
81
- const aIndex = order.indexOf(a);
82
- const bIndex = order.indexOf(b);
83
- // if one of the two is missing from the order array, push it further down
84
- if (aIndex >= 0 && bIndex < 0) {
85
- return -1;
86
- }
87
- else if (aIndex < 0 && bIndex >= 0) {
88
- return 1;
89
- }
90
- // otherwise compare the indexes and use alphabetical as a tie breaker
91
- const compared = aIndex - bIndex;
92
- if (compared !== 0) {
93
- return compared;
94
- }
95
- else {
96
- return a.localeCompare(b);
97
- }
98
- };
99
- }
100
- function isOrderFunction(order) {
101
- return !Array.isArray(order);
102
- }
103
- //# sourceMappingURL=packageOrder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageOrder.js","sourceRoot":"","sources":["../src/packageOrder.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,kEAA6B;AAC7B,oDAA8B;AAI9B,MAAM,OAAO,GAAG,CAAC;KACd,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC;CAC9C,CAAC;KACD,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAInB,MAAM,eAAe,GAAG;IACtB,MAAM;IACN,SAAS;IACT,aAAa;IACb,QAAQ;IACR,cAAc;IACd,KAAK;IACL,SAAS;IACT,SAAS;IACT,SAAS;IACT,KAAK;IACL,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,aAAa;IACb,YAAY;IACZ,OAAO;IACP,aAAa;IACb,OAAO;IACP,SAAS;IACT,aAAa;IACb,cAAc;IACd,kBAAkB;IAClB,iBAAiB;IACjB,sBAAsB;IACtB,eAAe;CAChB,CAAC;AAEW,QAAA,YAAY,GAAG;IAC1B,KAAK,EAAE,SAAS,kBAAkB,CAAC,OAAgB,EAAE,IAAa;QAChE,MAAM,WAAW,GAAG,OA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AAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAC7C,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE;YACzB,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,gBAAgB,CAAC,KAA4B;IACpD,OAAO,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhC,0EAA0E;QAC1E,IAAI,MAAM,IAAI,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE;YAC7B,OAAO,CAAC,CAAC,CAAC;SACX;aAAM,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE;YACpC,OAAO,CAAC,CAAC;SACV;QAED,sEAAsE;QACtE,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;QAEjC,IAAI,QAAQ,KAAK,CAAC,EAAE;YAClB,OAAO,QAAQ,CAAC;SACjB;aAAM;YACL,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;SAC3B;IACH,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAA4C;IACnE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
@@ -1,25 +0,0 @@
1
- /*!
2
- * Copyright 2019 Palantir Technologies, Inc.
3
- *
4
- * Licensed under the MIT license. See LICENSE file in the project root for details.
5
- *
6
- */
7
- import { RuleModule } from "@monorepolint/core";
8
- import * as r from "runtypes";
9
- export declare const Options: r.Record<{
10
- scripts: r.Dictionary<r.Union<[r.String, r.Intersect<[r.Record<{
11
- options: r.Array<r.Union<[r.String, r.Literal<undefined>]>, false>;
12
- }, false>, r.Partial<{
13
- fixValue: r.Union<[r.String, r.Literal<undefined>, r.Literal<false>]>;
14
- }, false>]>]>, string | number | symbol>;
15
- }, false>;
16
- export declare type Options = r.Static<typeof Options>;
17
- export declare const MSG_NO_SCRIPTS_BLOCK = "No scripts block in package.json";
18
- export declare const packageScript: RuleModule<r.Record<{
19
- scripts: r.Dictionary<r.Union<[r.String, r.Intersect<[r.Record<{
20
- options: r.Array<r.Union<[r.String, r.Literal<undefined>]>, false>;
21
- }, false>, r.Partial<{
22
- fixValue: r.Union<[r.String, r.Literal<undefined>, r.Literal<false>]>;
23
- }, false>]>]>, string | number | symbol>;
24
- }, false>>;
25
- //# sourceMappingURL=packageScript.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageScript.d.ts","sourceRoot":"","sources":["../src/packageScript.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,eAAO,MAAM,OAAO;;;;;;SAelB,CAAC;AAEH,oBAAY,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,eAAO,MAAM,oBAAoB,qCAAqC,CAAC;AAEvE,eAAO,MAAM,aAAa;;;;;;UAqEK,CAAC"}
@@ -1,90 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright 2019 Palantir Technologies, Inc.
4
- *
5
- * Licensed under the MIT license. See LICENSE file in the project root for details.
6
- *
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.packageScript = exports.MSG_NO_SCRIPTS_BLOCK = exports.Options = void 0;
10
- const tslib_1 = require("tslib");
11
- const utils_1 = require("@monorepolint/utils");
12
- const jest_diff_1 = tslib_1.__importDefault(require("jest-diff"));
13
- const r = tslib_1.__importStar(require("runtypes"));
14
- exports.Options = r.Record({
15
- scripts: r.Dictionary(r.Union(r.String, r
16
- .Record({
17
- options: r.Array(r.String.Or(r.Undefined)),
18
- })
19
- .And(r.Partial({
20
- fixValue: r.Union(r.String, r.Undefined, r.Literal(false)),
21
- })))), // string => string
22
- });
23
- exports.MSG_NO_SCRIPTS_BLOCK = "No scripts block in package.json";
24
- exports.packageScript = {
25
- check: function expectPackageScript(context, options) {
26
- const packageJson = context.getPackageJson();
27
- if (packageJson.scripts === undefined) {
28
- context.addError({
29
- file: context.getPackageJsonPath(),
30
- message: exports.MSG_NO_SCRIPTS_BLOCK,
31
- fixer: () => {
32
- (0, utils_1.mutateJson)(context.getPackageJsonPath(), context.host, (input) => {
33
- input.scripts = {};
34
- return input;
35
- });
36
- },
37
- });
38
- return;
39
- }
40
- for (const [name, value] of Object.entries(options.scripts)) {
41
- const allowedValues = new Set();
42
- let fixValue;
43
- let allowEmpty = false;
44
- let fixToEmpty = false;
45
- if (typeof value === "string") {
46
- allowedValues.add(value);
47
- fixValue = value;
48
- }
49
- else {
50
- for (const q of value.options) {
51
- if (q === undefined) {
52
- allowEmpty = true;
53
- }
54
- allowedValues.add(q);
55
- }
56
- fixToEmpty = value.hasOwnProperty("fixValue") && value.fixValue === undefined;
57
- fixValue = value.fixValue;
58
- }
59
- const actualValue = packageJson.scripts[name];
60
- if (!allowedValues.has(actualValue) && !(allowEmpty === true && actualValue === undefined)) {
61
- let fixer;
62
- if (fixValue !== false && (fixValue !== undefined || fixToEmpty === true)) {
63
- const q = fixValue;
64
- fixer = () => {
65
- (0, utils_1.mutateJson)(context.getPackageJsonPath(), context.host, (input) => {
66
- if (fixToEmpty && q === undefined) {
67
- delete input.scripts[name];
68
- }
69
- else {
70
- input.scripts[name] = q;
71
- }
72
- return input;
73
- });
74
- };
75
- }
76
- const validOptionsString = Array.from(allowedValues.values())
77
- .map((a) => (a === undefined ? "(empty)" : `'${a}'`))
78
- .join(", ");
79
- context.addError({
80
- file: context.getPackageJsonPath(),
81
- message: `Expected standardized script entry for '${name}'. Valid options: ${validOptionsString}`,
82
- longMessage: (0, jest_diff_1.default)(validOptionsString + "\n", (packageJson.scripts[name] || "") + "\n"),
83
- fixer,
84
- });
85
- }
86
- }
87
- },
88
- optionsRuntype: exports.Options,
89
- };
90
- //# sourceMappingURL=packageScript.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageScript.js","sourceRoot":"","sources":["../src/packageScript.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,+CAA8D;AAC9D,kEAA6B;AAC7B,oDAA8B;AAEjB,QAAA,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,OAAO,EAAE,CAAC,CAAC,UAAU,CACnB,CAAC,CAAC,KAAK,CACL,CAAC,CAAC,MAAM,EACR,CAAC;SACE,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;KAC3C,CAAC;SACD,GAAG,CACF,CAAC,CAAC,OAAO,CAAC;QACR,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC3D,CAAC,CACH,CACJ,CACF,EAAE,mBAAmB;CACvB,CAAC,CAAC;AAIU,QAAA,oBAAoB,GAAG,kCAAkC,CAAC;AAE1D,QAAA,aAAa,GAAG;IAC3B,KAAK,EAAE,SAAS,mBAAmB,CAAC,OAAgB,EAAE,OAAgB;QACpE,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;QAC7C,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE;YACrC,OAAO,CAAC,QAAQ,CAAC;gBACf,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;gBAClC,OAAO,EAAE,4BAAoB;gBAC7B,KAAK,EAAE,GAAG,EAAE;oBACV,IAAA,kBAAU,EAAc,OAAO,CAAC,kBAAkB,EAAE,EAAE,OAAO,CAAC,IA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MAAM,CAAC,GAAG,QAAQ,CAAC;oBACnB,KAAK,GAAG,GAAG,EAAE;wBACX,IAAA,kBAAU,EAAc,OAAO,CAAC,kBAAkB,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;4BAC5E,IAAI,UAAU,IAAI,CAAC,KAAK,SAAS,EAAE;gCACjC,OAAO,KAAK,CAAC,OAAQ,CAAC,IAAI,CAAC,CAAC;6BAC7B;iCAAM;gCACL,KAAK,CAAC,OAAQ,CAAC,IAAI,CAAC,GAAG,CAAE,CAAC;6BAC3B;4BACD,OAAO,KAAK,CAAC;wBACf,CAAC,CAAC,CAAC;oBACL,CAAC,CAAC;iBACH;gBAED,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;qBAC1D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;qBACpD,IAAI,CAAC,IAAI,CAAC,CAAC;gBAEd,OAAO,CAAC,QAAQ,CAAC;oBACf,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;oBAClC,OAAO,EAAE,2CAA2C,IAAI,qBAAqB,kBAAkB,EAAE;oBACjG,WAAW,EAAE,IAAA,mBAAI,EAAC,kBAAkB,GAAG,IAAI,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;oBACtF,KAAK;iBACN,CAAC,CAAC;aACJ;SACF;IACH,CAAC;IACD,cAAc,EAAE,eAAO;CACM,CAAC"}
@@ -1,15 +0,0 @@
1
- /*!
2
- * Copyright 2019 Palantir Technologies, Inc.
3
- *
4
- * Licensed under the MIT license. See LICENSE file in the project root for details.
5
- *
6
- */
7
- import { RuleModule } from "@monorepolint/core";
8
- import * as r from "runtypes";
9
- export declare const requireDependency: RuleModule<r.Partial<{
10
- dependencies: r.Dictionary<r.String, string | number | symbol>;
11
- devDependencies: r.Dictionary<r.String, string | number | symbol>;
12
- peerDependencies: r.Dictionary<r.String, string | number | symbol>;
13
- optionalDependencies: r.Dictionary<r.String, string | number | symbol>;
14
- }, false>>;
15
- //# sourceMappingURL=requireDependency.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requireDependency.d.ts","sourceRoot":"","sources":["../src/requireDependency.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAW9B,eAAO,MAAM,iBAAiB;;;;;UA+CC,CAAC"}
@@ -1,65 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright 2019 Palantir Technologies, Inc.
4
- *
5
- * Licensed under the MIT license. See LICENSE file in the project root for details.
6
- *
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.requireDependency = void 0;
10
- const tslib_1 = require("tslib");
11
- const utils_1 = require("@monorepolint/utils");
12
- const jest_diff_1 = tslib_1.__importDefault(require("jest-diff"));
13
- const r = tslib_1.__importStar(require("runtypes"));
14
- const Options = r.Partial({
15
- dependencies: r.Dictionary(r.String),
16
- devDependencies: r.Dictionary(r.String),
17
- peerDependencies: r.Dictionary(r.String),
18
- optionalDependencies: r.Dictionary(r.String),
19
- });
20
- exports.requireDependency = {
21
- check: function expectPackageEntry(context, options) {
22
- const packageJson = context.getPackageJson();
23
- const packageJsonPath = context.getPackageJsonPath();
24
- [
25
- "dependencies",
26
- "devDependencies",
27
- "peerDependencies",
28
- "optionalDependencies",
29
- ].forEach((type) => {
30
- if (!options[type]) {
31
- return;
32
- }
33
- if (packageJson[type] === undefined) {
34
- context.addError({
35
- file: packageJsonPath,
36
- message: `No ${type} block, cannot add required ${type}.`,
37
- fixer: () => {
38
- (0, utils_1.mutateJson)(packageJsonPath, context.host, (input) => {
39
- input[type] = options[type];
40
- return input;
41
- });
42
- },
43
- });
44
- return;
45
- }
46
- for (const [dep, version] of Object.entries(options[type])) {
47
- if (packageJson[type][dep] !== version) {
48
- context.addError({
49
- file: packageJsonPath,
50
- message: `Expected dependency ${dep}@${version}`,
51
- longMessage: (0, jest_diff_1.default)(`${dep}@${version}\n`, `${dep}@${packageJson[type][dep] || "missing"}\n`),
52
- fixer: () => {
53
- (0, utils_1.mutateJson)(packageJsonPath, context.host, (input) => {
54
- input[type] = { ...input[type], [dep]: version };
55
- return input;
56
- });
57
- },
58
- });
59
- }
60
- }
61
- });
62
- },
63
- optionsRuntype: Options,
64
- };
65
- //# sourceMappingURL=requireDependency.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requireDependency.js","sourceRoot":"","sources":["../src/requireDependency.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,+CAA8D;AAC9D,kEAA6B;AAC7B,oDAA8B;AAE9B,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;IACxB,YAAY,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;IACpC,eAAe,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;IACvC,gBAAgB,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;IACxC,oBAAoB,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;CAC7C,CAAC,CAAC;AAIU,QAAA,iBAAiB,GAAG;IAC/B,KAAK,EAAE,SAAS,kBAAkB,CAAC,OAAgB,EAAE,OAAgB;QACnE,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;QAC7C,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAErD;YACE,cAAuB;YACvB,iBAA0B;YAC1B,kBAA2B;YAC3B,sBAA+B;SAChC,CAAC,OAAO,CAAC,CAAC,IAAI,EAA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,CAAC;4BACf,CAAC,CAAC,CAAC;wBACL,CAAC;qBACF,CAAC,CAAC;iBACJ;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,cAAc,EAAE,OAAO;CACM,CAAC"}
@@ -1,45 +0,0 @@
1
- /*!
2
- * Copyright 2019 Palantir Technologies, Inc.
3
- *
4
- * Licensed under the MIT license. See LICENSE file in the project root for details.
5
- *
6
- */
7
- import { RuleModule } from "@monorepolint/core";
8
- import * as r from "runtypes";
9
- declare const Options: r.Constraint<r.Partial<{
10
- file: r.String;
11
- generator: r.Function;
12
- tsconfigReferenceFile: r.String;
13
- template: r.Union<[r.Record<{}, false>, r.String]>;
14
- templateFile: r.String;
15
- excludedReferences: r.Union<[r.Array<r.String, false>, r.Literal<undefined>]>;
16
- additionalReferences: r.Union<[r.Array<r.String, false>, r.Literal<undefined>]>;
17
- }, false>, {
18
- file?: string | undefined;
19
- generator?: ((...args: any[]) => any) | undefined;
20
- tsconfigReferenceFile?: string | undefined;
21
- template?: string | {} | undefined;
22
- templateFile?: string | undefined;
23
- excludedReferences?: string[] | undefined;
24
- additionalReferences?: string[] | undefined;
25
- }, unknown>;
26
- export declare type Options = r.Static<typeof Options>;
27
- export declare const standardTsconfig: RuleModule<r.Constraint<r.Partial<{
28
- file: r.String;
29
- generator: r.Function;
30
- tsconfigReferenceFile: r.String;
31
- template: r.Union<[r.Record<{}, false>, r.String]>;
32
- templateFile: r.String;
33
- excludedReferences: r.Union<[r.Array<r.String, false>, r.Literal<undefined>]>;
34
- additionalReferences: r.Union<[r.Array<r.String, false>, r.Literal<undefined>]>;
35
- }, false>, {
36
- file?: string | undefined;
37
- generator?: ((...args: any[]) => any) | undefined;
38
- tsconfigReferenceFile?: string | undefined;
39
- template?: string | {} | undefined;
40
- templateFile?: string | undefined;
41
- excludedReferences?: string[] | undefined;
42
- additionalReferences?: string[] | undefined;
43
- }, unknown>>;
44
- export {};
45
- //# sourceMappingURL=standardTsconfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"standardTsconfig.d.ts","sourceRoot":"","sources":["../src/standardTsconfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAI9B,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;WAuBT,CAAC;AAEL,oBAAY,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;YAiCE,CAAC"}