@nrwl/linter 13.3.0-beta.3 → 13.3.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/migrations.json CHANGED
@@ -58,6 +58,12 @@
58
58
  "version": "12.9.0-beta.0",
59
59
  "description": "Remove ESLint parserOptions.project config if no rules requiring type-checking are in use",
60
60
  "factory": "./src/migrations/update-12-4-0/remove-eslint-project-config-if-no-type-checking-rules"
61
+ },
62
+ "eslint-8-updates": {
63
+ "cli": "nx",
64
+ "version": "13.3.0-beta.0",
65
+ "description": "Update eslint-rules jest.config.js in order to support ESLint v8 exports mapping, remove category field",
66
+ "factory": "./src/migrations/update-13-3-0/eslint-8-updates"
61
67
  }
62
68
  },
63
69
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/linter",
3
- "version": "13.3.0-beta.3",
3
+ "version": "13.3.0",
4
4
  "description": "Lint Plugin for Nx",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,8 +30,9 @@
30
30
  "builders": "./executors.json",
31
31
  "schematics": "./generators.json",
32
32
  "dependencies": {
33
- "@nrwl/devkit": "13.3.0-beta.3",
34
- "@nrwl/jest": "13.3.0-beta.3",
33
+ "@phenomnomnominal/tsquery": "4.1.1",
34
+ "@nrwl/devkit": "13.3.0",
35
+ "@nrwl/jest": "13.3.0",
35
36
  "eslint": "8.2.0",
36
37
  "glob": "7.1.4",
37
38
  "minimatch": "3.0.4",
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export default function eslint8Updates(tree: Tree): Promise<void>;
@@ -0,0 +1,43 @@
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 jest_1 = require("@nrwl/jest");
6
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
7
+ function eslint8Updates(tree) {
8
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
9
+ try {
10
+ const existingJestConfigPath = (0, devkit_1.normalizePath)('tools/eslint-rules/jest.config.js');
11
+ // Add extra config to the jest.config.js file to allow ESLint 8 exports mapping to work with jest
12
+ (0, jest_1.addPropertyToJestConfig)(tree, existingJestConfigPath, 'moduleNameMapper', {
13
+ '@eslint/eslintrc': '@eslint/eslintrc/dist/eslintrc-universal.cjs',
14
+ });
15
+ (0, devkit_1.visitNotIgnoredFiles)(tree, 'tools/eslint-rules', (path) => {
16
+ if (!path.endsWith('.ts')) {
17
+ return;
18
+ }
19
+ const fileContents = tree.read(path).toString('utf-8');
20
+ const fileAst = tsquery_1.tsquery.ast(fileContents);
21
+ const isESLintRuleFile = (0, tsquery_1.tsquery)(fileAst, 'PropertyAccessExpression[expression.escapedText=ESLintUtils][name.escapedText=RuleCreator]').length > 0;
22
+ if (!isESLintRuleFile) {
23
+ return;
24
+ }
25
+ const categoryPropertyAssignmentNode = (0, tsquery_1.tsquery)(fileAst, 'PropertyAssignment[name.escapedText=meta] PropertyAssignment[name.escapedText=docs] PropertyAssignment[name.escapedText=category]')[0];
26
+ if (!categoryPropertyAssignmentNode) {
27
+ return;
28
+ }
29
+ let end = categoryPropertyAssignmentNode.getEnd();
30
+ if (fileContents.substring(end, end + 1) === ',') {
31
+ end++;
32
+ }
33
+ const updatedContents = fileContents.slice(0, categoryPropertyAssignmentNode.getFullStart()) +
34
+ fileContents.slice(end);
35
+ tree.write(path, updatedContents);
36
+ });
37
+ yield (0, devkit_1.formatFiles)(tree);
38
+ }
39
+ catch (_a) { }
40
+ });
41
+ }
42
+ exports.default = eslint8Updates;
43
+ //# sourceMappingURL=eslint-8-updates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eslint-8-updates.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/migrations/update-13-3-0/eslint-8-updates.ts"],"names":[],"mappings":";;;AAAA,yCAKsB;AACtB,qCAAqD;AACrD,uDAAoD;AAE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eAAe,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;YAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAAC,WAAM,GAAE;IACZ,CAAC;CAAA;AA5CD,iCA4CC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.eslintConfigPrettierVersion = exports.eslintVersion = exports.typescriptESLintVersion = exports.buildAngularVersion = exports.tslintToEslintConfigVersion = exports.tslintVersion = exports.nxVersion = void 0;
4
- exports.nxVersion = '13.3.0-beta.3';
4
+ exports.nxVersion = '13.3.0';
5
5
  exports.tslintVersion = '~6.1.0';
6
6
  exports.tslintToEslintConfigVersion = '^2.4.0';
7
7
  exports.buildAngularVersion = '~13.0.0';