@nrwl/linter 14.5.0-beta.0 → 14.5.0-beta.3

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/CHANGELOG.md CHANGED
@@ -3,6 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [14.5.0-beta.0](https://github.com/nrwl/nx/compare/14.4.2...14.5.0-beta.0) (2022-07-11)
6
+ # [14.5.0-beta.3](https://github.com/nrwl/nx/compare/14.4.2...14.5.0-beta.3) (2022-07-21)
7
7
 
8
8
  **Note:** Version bump only for package @nrwl/linter
package/migrations.json CHANGED
@@ -76,6 +76,18 @@
76
76
  "version": "14.2.3-beta.0",
77
77
  "description": "Adds @swc/core and @swc-node as a dev dep if you are using them (repeated due to prior mistake)",
78
78
  "factory": "./src/migrations/update-14-1-9/add-swc-deps-if-needed"
79
+ },
80
+ "experimental-to-utils-deps": {
81
+ "cli": "nx",
82
+ "version": "14.4.4",
83
+ "description": "Adds @typescript-eslint/utils as a dev dep",
84
+ "factory": "./src/migrations/update-14-4-4/experimental-to-utils-deps"
85
+ },
86
+ "experimental-to-utils-rules": {
87
+ "cli": "nx",
88
+ "version": "14.4.4",
89
+ "description": "Switch from @typescript-eslint/experimental-utils to @typescript-eslint/utils in all rules and rules.spec files",
90
+ "factory": "./src/migrations/update-14-4-4/experimental-to-utils-rules"
79
91
  }
80
92
  },
81
93
  "packageJsonUpdates": {
@@ -245,6 +257,14 @@
245
257
  "version": "^5.29.0"
246
258
  }
247
259
  }
260
+ },
261
+ "14.4.4": {
262
+ "version": "14.4.4",
263
+ "packages": {
264
+ "@typescript-eslint/utils": {
265
+ "version": "^5.29.0"
266
+ }
267
+ }
248
268
  }
249
269
  }
250
270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/linter",
3
- "version": "14.5.0-beta.0",
3
+ "version": "14.5.0-beta.3",
4
4
  "description": "The Linter plugin contains executors, generator, plugin and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,10 +33,10 @@
33
33
  "eslint": "^8.0.0"
34
34
  },
35
35
  "dependencies": {
36
- "@nrwl/devkit": "14.5.0-beta.0",
37
- "@nrwl/jest": "14.5.0-beta.0",
36
+ "@nrwl/devkit": "14.5.0-beta.3",
37
+ "@nrwl/jest": "14.5.0-beta.3",
38
38
  "@phenomnomnominal/tsquery": "4.1.1",
39
- "nx": "14.5.0-beta.0",
39
+ "nx": "14.5.0-beta.3",
40
40
  "tmp": "~0.2.1",
41
41
  "tslib": "^2.3.0"
42
42
  },
@@ -45,5 +45,5 @@
45
45
  "optional": true
46
46
  }
47
47
  },
48
- "gitHead": "438ea6cdfed60dc0f7f358e967650f004f2e7c42"
48
+ "gitHead": "8c7b76e8f1f42a33dfcbf7245664082cbc10f619"
49
49
  }
@@ -1,4 +1,4 @@
1
- import { TSESLint } from '@typescript-eslint/experimental-utils';
1
+ import { TSESLint } from '@typescript-eslint/utils';
2
2
  import { rule, RULE_NAME } from './<%= name %>';
3
3
 
4
4
  const ruleTester = new TSESLint.RuleTester({
@@ -14,7 +14,7 @@
14
14
  * https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/src/rules
15
15
  */
16
16
 
17
- import { ESLintUtils } from '@typescript-eslint/experimental-utils';
17
+ import { ESLintUtils } from '@typescript-eslint/utils';
18
18
 
19
19
  // NOTE: The rule will be available in ESLint configs as "@nrwl/nx/workspace/<%= name %>"
20
20
  export const RULE_NAME = '<%= name %>';
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export default function addTypescriptEslintUtilsIfNeeded(tree: Tree): Promise<void>;
@@ -0,0 +1,30 @@
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 workspace_rules_project_1 = require("../../generators/workspace-rules-project/workspace-rules-project");
6
+ const versions_1 = require("../../utils/versions");
7
+ function addTypescriptEslintUtilsIfNeeded(tree) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ try {
10
+ const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
11
+ let removed = false;
12
+ if (packageJson.devDependencies['@typescript-eslint/experimental-utils']) {
13
+ yield (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], ['@typescript-eslint/experimental-utils']);
14
+ removed = true;
15
+ }
16
+ if (packageJson.dependencies['@typescript-eslint/experimental-utils']) {
17
+ yield (0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@typescript-eslint/experimental-utils'], []);
18
+ removed = true;
19
+ }
20
+ if (removed || tree.exists(workspace_rules_project_1.WORKSPACE_PLUGIN_DIR)) {
21
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@typescript-eslint/utils': versions_1.typescriptESLintVersion });
22
+ yield (0, devkit_1.formatFiles)(tree);
23
+ }
24
+ return;
25
+ }
26
+ catch (_a) { }
27
+ });
28
+ }
29
+ exports.default = addTypescriptEslintUtilsIfNeeded;
30
+ //# sourceMappingURL=experimental-to-utils-deps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experimental-to-utils-deps.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/migrations/update-14-4-4/experimental-to-utils-deps.ts"],"names":[],"mappings":";;;AAAA,yCAMsB;AACtB,8GAAwG;AACxG,mDAA+D;AAE/D,SAA8B,gCAAgC,CAAC,IAAU;;QACvE,IAAI;YACF,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;YACnD,IAAI,OAAO,GAAG,KAAK,CAAC;YAEpB,IAAI,WAAW,CAAC,eAAe,CAAC,uCAAuC,CAAC,EAAE;gBACxE,MAAM,IAAA,0CAAiC,EACrC,IAAI,EACJ,EAAE,EACF,CAAC,uCAAuC,CAAC,CAC1C,CAAC;gBACF,OAAO,GAAG,IAAI,CAAC;aAChB;YAED,IAAI,WAAW,CAAC,YAAY,CAAC,uCAAuC,CAAC,EAAE;gBACrE,MAAM,IAAA,0CAAiC,EACrC,IAAI,EACJ,CAAC,uCAAuC,CAAC,EACzC,EAAE,CACH,CAAC;gBACF,OAAO,GAAG,IAAI,CAAC;aAChB;YAED,IAAI,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,8CAAoB,CAAC,EAAE;gBAChD,IAAA,qCAA4B,EAC1B,IAAI,EACJ,EAAE,EACF,EAAE,0BAA0B,EAAE,kCAAuB,EAAE,CACxD,CAAC;gBAEF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;aACzB;YACD,OAAO;SACR;QAAC,WAAM,GAAE;IACZ,CAAC;CAAA;AAlCD,mDAkCC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export default function experimentalToUtilsUpdate(tree: Tree): Promise<void>;
@@ -0,0 +1,38 @@
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 tsquery_1 = require("@phenomnomnominal/tsquery");
6
+ function updateFile(fileAst, fileContents) {
7
+ const importStatement = (0, tsquery_1.tsquery)(fileAst, 'ImportDeclaration StringLiteral[value=@typescript-eslint/experimental-utils]');
8
+ if (importStatement.length === 0) {
9
+ return;
10
+ }
11
+ const contentSlices = fileContents.split('@typescript-eslint/experimental-utils');
12
+ let updatedFileContents = '';
13
+ for (let i = 0; i < contentSlices.length / 2; i++) {
14
+ updatedFileContents += `${contentSlices[i]}@typescript-eslint/utils`;
15
+ }
16
+ updatedFileContents += contentSlices[contentSlices.length - 1];
17
+ return updatedFileContents;
18
+ }
19
+ function experimentalToUtilsUpdate(tree) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ try {
22
+ (0, devkit_1.visitNotIgnoredFiles)(tree, 'tools/eslint-rules', (path) => {
23
+ if (path.endsWith('.ts')) {
24
+ const fileContents = tree.read(path).toString('utf-8');
25
+ const fileAst = tsquery_1.tsquery.ast(fileContents);
26
+ const updatedContents = updateFile(fileAst, fileContents);
27
+ if (updatedContents) {
28
+ tree.write(path, updatedContents);
29
+ }
30
+ }
31
+ });
32
+ yield (0, devkit_1.formatFiles)(tree);
33
+ }
34
+ catch (_a) { }
35
+ });
36
+ }
37
+ exports.default = experimentalToUtilsUpdate;
38
+ //# sourceMappingURL=experimental-to-utils-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experimental-to-utils-rules.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/migrations/update-14-4-4/experimental-to-utils-rules.ts"],"names":[],"mappings":";;;AAAA,yCAAuE;AACvE,uDAAoD;AAEpD,SAAS,UAAU,CAAC,OAAY,EAAE,YAAoB;IACpD,MAAM,eAAe,GAAU,IAAA,iBAAO,EACpC,OAAO,EACP,8EAA8E,CAC/E,CAAC;IACF,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;QAChC,OAAO;KACR;IACD,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CACtC,uCAAuC,CACxC,CAAC;IACF,IAAI,mBAAmB,GAAG,EAAE,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACjD,mBAAmB,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,0BAA0B,CAAC;KACtE;IACD,mBAAmB,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/D,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,SAA8B,yBAAyB,CAAC,IAAU;;QAChE,IAAI;YACF,IAAA,6BAAoB,EAAC,IAAI,EAAE,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxD,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;oBACxB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;oBACvD,MAAM,OAAO,GAAG,iBAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;oBAE1C,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;oBAC1D,IAAI,eAAe,EAAE;wBACnB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;qBACnC;iBACF;YACH,CAAC,CAAC,CAAC;YAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAAC,WAAM,GAAE;IACZ,CAAC;CAAA;AAhBD,4CAgBC"}