@nrwl/linter 15.7.0 → 15.8.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/migrations.json +6 -0
- package/package.json +3 -3
- package/src/generators/init/init.js +2 -0
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/utils/eslint-targets.d.ts +2 -0
- package/src/generators/utils/eslint-targets.js +13 -0
- package/src/generators/utils/eslint-targets.js.map +1 -0
- package/src/migrations/update-15-0-0/add-eslint-inputs.js +2 -9
- package/src/migrations/update-15-0-0/add-eslint-inputs.js.map +1 -1
- package/src/migrations/update-15-7-1/add-eslint-ignore.d.ts +2 -0
- package/src/migrations/update-15-7-1/add-eslint-ignore.js +42 -0
- package/src/migrations/update-15-7-1/add-eslint-ignore.js.map +1 -0
- package/src/utils/testing.d.ts +1 -1
package/migrations.json
CHANGED
@@ -53,6 +53,12 @@
|
|
53
53
|
"version": "15.0.0-beta.0",
|
54
54
|
"description": "Stop hashing eslint config files for build targets and dependent tasks",
|
55
55
|
"factory": "./src/migrations/update-15-0-0/add-eslint-inputs"
|
56
|
+
},
|
57
|
+
"add-eslint-ignore": {
|
58
|
+
"cli": "nx",
|
59
|
+
"version": "15.7.1-beta.0",
|
60
|
+
"description": "Add node_modules to root eslint ignore",
|
61
|
+
"factory": "./src/migrations/update-15-7-1/add-eslint-ignore"
|
56
62
|
}
|
57
63
|
},
|
58
64
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nrwl/linter",
|
3
|
-
"version": "15.
|
3
|
+
"version": "15.8.0-beta.0",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Linter plugin for Nx contains executors, generators and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.",
|
6
6
|
"repository": {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"eslint": "^8.0.0"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@nrwl/devkit": "15.
|
36
|
+
"@nrwl/devkit": "15.8.0-beta.0",
|
37
37
|
"@phenomnomnominal/tsquery": "4.1.1",
|
38
38
|
"tmp": "~0.2.1",
|
39
39
|
"tslib": "^2.3.0"
|
@@ -47,5 +47,5 @@
|
|
47
47
|
"access": "public"
|
48
48
|
},
|
49
49
|
"types": "./index.d.ts",
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "ae5d6e5c48bd4684f341206d2249a0f5783cb4bb"
|
51
51
|
}
|
@@ -21,6 +21,7 @@ function addTargetDefaults(tree) {
|
|
21
21
|
(_d = (_f = nxJson.targetDefaults.lint).inputs) !== null && _d !== void 0 ? _d : (_f.inputs = [
|
22
22
|
'default',
|
23
23
|
`{workspaceRoot}/.eslintrc.json`,
|
24
|
+
`{workspaceRoot}/.eslintignore`,
|
24
25
|
]);
|
25
26
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
26
27
|
}
|
@@ -32,6 +33,7 @@ function initEsLint(tree, options) {
|
|
32
33
|
(0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nrwl/linter'], []);
|
33
34
|
}
|
34
35
|
(0, devkit_1.writeJson)(tree, '.eslintrc.json', (0, global_eslint_config_1.getGlobalEsLintConfiguration)(options.unitTestRunner, options.rootProject));
|
36
|
+
tree.write('.eslintignore', 'node_modules\n');
|
35
37
|
addTargetDefaults(tree);
|
36
38
|
if (tree.exists('.vscode/extensions.json')) {
|
37
39
|
(0, devkit_1.updateJson)(tree, '.vscode/extensions.json', (json) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/init/init.ts"],"names":[],"mappings":";;;AACA,yCAOsB;AACtB,mDAK8B;AAG9B,sDAAsD;AACtD,iEAAsE;AAStE,SAAS,iBAAiB,CAAC,IAAU;;;IACnC,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;IAEhC,MAAM,iBAAiB,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAE,UAAU,CAAC;IACzD,IAAI,iBAAiB,EAAE;QACrB,wBAAwB;QACxB,iBAAiB,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACxD,iBAAiB;QACjB,MAAM,CAAC,WAAW,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;KACxE;IAED,MAAA,MAAM,CAAC,cAAc,oCAArB,MAAM,CAAC,cAAc,GAAK,EAAE,EAAC;IAE7B,YAAA,MAAM,CAAC,cAAc,EAAC,IAAI,uCAAJ,IAAI,GAAK,EAAE,EAAC;IAClC,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,EAAC,MAAM,uCAAN,MAAM,GAAK;QACpC,SAAS;QACT,gCAAgC;
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/init/init.ts"],"names":[],"mappings":";;;AACA,yCAOsB;AACtB,mDAK8B;AAG9B,sDAAsD;AACtD,iEAAsE;AAStE,SAAS,iBAAiB,CAAC,IAAU;;;IACnC,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;IAEhC,MAAM,iBAAiB,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAE,UAAU,CAAC;IACzD,IAAI,iBAAiB,EAAE;QACrB,wBAAwB;QACxB,iBAAiB,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACxD,iBAAiB;QACjB,MAAM,CAAC,WAAW,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;KACxE;IAED,MAAA,MAAM,CAAC,cAAc,oCAArB,MAAM,CAAC,cAAc,GAAK,EAAE,EAAC;IAE7B,YAAA,MAAM,CAAC,cAAc,EAAC,IAAI,uCAAJ,IAAI,GAAK,EAAE,EAAC;IAClC,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,EAAC,MAAM,uCAAN,MAAM,GAAK;QACpC,SAAS;Q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kC,EAAE,kCAAuB;YAC3D,MAAM,EAAE,wBAAa;YACrB,wBAAwB,EAAE,sCAA2B;SACtD,CACF;QACH,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;AACf,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAU,EAAE,OAA0B;IACtE,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC;AAFD,8CAEC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getEslintTargets = void 0;
|
4
|
+
const executor_options_utils_1 = require("@nrwl/workspace/src/utilities/executor-options-utils");
|
5
|
+
function getEslintTargets(tree) {
|
6
|
+
const eslintTargetNames = new Set();
|
7
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/linter:eslint', (_, __, target) => {
|
8
|
+
eslintTargetNames.add(target);
|
9
|
+
});
|
10
|
+
return eslintTargetNames;
|
11
|
+
}
|
12
|
+
exports.getEslintTargets = getEslintTargets;
|
13
|
+
//# sourceMappingURL=eslint-targets.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"eslint-targets.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/utils/eslint-targets.ts"],"names":[],"mappings":";;;AACA,iGAA8F;AAE9F,SAAgB,gBAAgB,CAAC,IAAU;IACzC,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5C,IAAA,+CAAsB,EAAC,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;QACpE,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAND,4CAMC"}
|
@@ -2,8 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
5
|
-
const executor_options_utils_1 = require("@nrwl/workspace/src/utilities/executor-options-utils");
|
6
5
|
const eslint_file_1 = require("../../generators/utils/eslint-file");
|
6
|
+
const eslint_targets_1 = require("../../generators/utils/eslint-targets");
|
7
7
|
function addEslintInputs(tree) {
|
8
8
|
var _a, _b, _c, _d;
|
9
9
|
var _e;
|
@@ -15,7 +15,7 @@ function addEslintInputs(tree) {
|
|
15
15
|
productionFileset.add(`!{projectRoot}/${globalEslintFile}`);
|
16
16
|
nxJson.namedInputs.production = Array.from(productionFileset);
|
17
17
|
}
|
18
|
-
for (const targetName of getEslintTargets(tree)) {
|
18
|
+
for (const targetName of (0, eslint_targets_1.getEslintTargets)(tree)) {
|
19
19
|
(_b = nxJson.targetDefaults) !== null && _b !== void 0 ? _b : (nxJson.targetDefaults = {});
|
20
20
|
const lintTargetDefaults = ((_c = (_e = nxJson.targetDefaults)[targetName]) !== null && _c !== void 0 ? _c : (_e[targetName] = {}));
|
21
21
|
(_d = lintTargetDefaults.inputs) !== null && _d !== void 0 ? _d : (lintTargetDefaults.inputs = [
|
@@ -30,11 +30,4 @@ function addEslintInputs(tree) {
|
|
30
30
|
});
|
31
31
|
}
|
32
32
|
exports.default = addEslintInputs;
|
33
|
-
function getEslintTargets(tree) {
|
34
|
-
const eslintTargetNames = new Set();
|
35
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/linter:eslint', (_, __, target) => {
|
36
|
-
eslintTargetNames.add(target);
|
37
|
-
});
|
38
|
-
return eslintTargetNames;
|
39
|
-
}
|
40
33
|
//# sourceMappingURL=add-eslint-inputs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"add-eslint-inputs.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/migrations/update-15-0-0/add-eslint-inputs.ts"],"names":[],"mappings":";;;AAAA,yCAMsB;AACtB,
|
1
|
+
{"version":3,"file":"add-eslint-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AAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;;CACzB;AA/BD,kCA+BC"}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
5
|
+
const eslint_file_1 = require("../../generators/utils/eslint-file");
|
6
|
+
const eslint_targets_1 = require("../../generators/utils/eslint-targets");
|
7
|
+
function addEslintIgnore(tree) {
|
8
|
+
var _a, _b;
|
9
|
+
var _c;
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
11
|
+
const nxJson = (0, devkit_1.readJson)(tree, 'nx.json');
|
12
|
+
const globalEslintFile = eslint_file_1.eslintConfigFileWhitelist.find((file) => tree.exists(file));
|
13
|
+
if (globalEslintFile) {
|
14
|
+
if (tree.exists('.eslintignore')) {
|
15
|
+
const content = tree.read('.eslintignore', 'utf-8');
|
16
|
+
if (!content.includes('node_modules')) {
|
17
|
+
tree.write('.eslintignore', `node_modules\n${content}`);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
tree.write('.eslintignore', 'node_modules\n');
|
22
|
+
}
|
23
|
+
for (const targetName of (0, eslint_targets_1.getEslintTargets)(tree)) {
|
24
|
+
(_a = nxJson.targetDefaults) !== null && _a !== void 0 ? _a : (nxJson.targetDefaults = {});
|
25
|
+
const lintTargetDefaults = ((_b = (_c = nxJson.targetDefaults)[targetName]) !== null && _b !== void 0 ? _b : (_c[targetName] = {}));
|
26
|
+
const lintIgnorePath = (0, devkit_1.joinPathFragments)('{workspaceRoot}', globalEslintFile);
|
27
|
+
if (lintTargetDefaults.inputs) {
|
28
|
+
if (!lintTargetDefaults.inputs.includes(lintIgnorePath)) {
|
29
|
+
lintTargetDefaults.inputs.push(lintIgnorePath);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
lintTargetDefaults.inputs = ['default', lintIgnorePath];
|
34
|
+
}
|
35
|
+
}
|
36
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
37
|
+
yield (0, devkit_1.formatFiles)(tree);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
}
|
41
|
+
exports.default = addEslintIgnore;
|
42
|
+
//# sourceMappingURL=add-eslint-ignore.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"add-eslint-ignore.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/migrations/update-15-7-1/add-eslint-ignore.ts"],"names":[],"mappings":";;;AAAA,yCAMsB;AACtB,oEAA+E;AAC/E,0EAAyE;AAEzE,SAA8B,eAAe,CAAC,IAAU;;;;QACtD,MAAM,MAAM,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAEzC,MAAM,gBAAgB,GAAG,uCAAyB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAC/D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAClB,CAAC;QAEF,IAAI,gBAAgB,EAAE;YACpB,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;gBAChC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;gBACpD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;oBACrC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,iBAAiB,OAAO,EAAE,CAAC,CAAC;iBACzD;aACF;iBAAM;gBACL,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;aAC/C;YAED,KAAK,MAAM,UAAU,IAAI,IAAA,iCAAgB,EAAC,IAAI,CAAC,EAAE;gBAC/C,MAAA,MAAM,CAAC,cAAc,oCAArB,MAAM,CAAC,cAAc,GAAK,EAAE,EAAC;gBAC7B,MAAM,kBAAkB,GAAG,aAAC,MAAM,CAAC,cAAc,EAAC,UAAU,wCAAV,UAAU,IAAM,EAAE,EAAC,CAAC;gBAEtE,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,iBAAiB,EACjB,gBAAgB,CACjB,CAAC;gBAEF,IAAI,kBAAkB,CAAC,MAAM,EAAE;oBAC7B,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;wBACvD,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;qBAChD;iBACF;qBAAM;oBACL,kBAAkB,CAAC,MAAM,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;iBACzD;aACF;YAED,IAAA,qBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC3B,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;;CACF;AAtCD,kCAsCC"}
|
package/src/utils/testing.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Tree } from '@angular-devkit/schematics';
|
1
|
+
import type { Tree } from '@angular-devkit/schematics';
|
2
2
|
export declare function runMigration<T extends object = any>(migrationName: string, options: T, tree: Tree): Promise<import("@angular-devkit/schematics/testing").UnitTestTree>;
|