@nx/eslint 23.0.0-beta.24 → 23.0.0-beta.25

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
@@ -1,23 +1,5 @@
1
1
  {
2
2
  "generators": {
3
- "update-typescript-eslint-v8.13.0": {
4
- "version": "20.2.0-beta.5",
5
- "description": "Update TypeScript ESLint packages to v8.13.0 if they are already on v8",
6
- "implementation": "./dist/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0",
7
- "requires": {
8
- "@typescript-eslint/parser": ">=8.0.0"
9
- },
10
- "documentation": "./dist/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.md"
11
- },
12
- "add-file-extensions-to-overrides": {
13
- "version": "20.3.0-beta.1",
14
- "description": "Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed)",
15
- "implementation": "./dist/src/migrations/update-20-3-0/add-file-extensions-to-overrides",
16
- "requires": {
17
- "eslint": ">=8.57.0"
18
- },
19
- "documentation": "./dist/src/migrations/update-20-3-0/add-file-extensions-to-overrides.md"
20
- },
21
3
  "update-executor-lint-inputs": {
22
4
  "version": "22.7.0-beta.12",
23
5
  "description": "Add missing inputs to @nx/eslint:lint executor target defaults",
@@ -36,78 +18,6 @@
36
18
  }
37
19
  },
38
20
  "packageJsonUpdates": {
39
- "20.4.0-typescript-eslint": {
40
- "version": "20.4.0-beta.1",
41
- "requires": {
42
- "typescript-eslint": ">8.0.0 <8.19.0"
43
- },
44
- "packages": {
45
- "typescript-eslint": {
46
- "version": "^8.19.0"
47
- },
48
- "@typescript-eslint/eslint-plugin": {
49
- "version": "^8.19.0"
50
- },
51
- "@typescript-eslint/parser": {
52
- "version": "^8.19.0"
53
- },
54
- "@typescript-eslint/utils": {
55
- "version": "^8.19.0"
56
- },
57
- "@typescript-eslint/rule-tester": {
58
- "version": "^8.19.0",
59
- "alwaysAddToPackageJson": false
60
- },
61
- "@typescript-eslint/scope-manager": {
62
- "version": "^8.19.0",
63
- "alwaysAddToPackageJson": false
64
- },
65
- "@typescript-eslint/typescript-estree": {
66
- "version": "^8.19.0",
67
- "alwaysAddToPackageJson": false
68
- }
69
- }
70
- },
71
- "20.4.0-@typescript-eslint": {
72
- "version": "20.4.0-beta.1",
73
- "requires": {
74
- "@typescript-eslint/eslint-plugin": ">8.0.0 <8.19.0"
75
- },
76
- "packages": {
77
- "typescript-eslint": {
78
- "version": "^8.19.0"
79
- },
80
- "@typescript-eslint/eslint-plugin": {
81
- "version": "^8.19.0"
82
- },
83
- "@typescript-eslint/parser": {
84
- "version": "^8.19.0"
85
- },
86
- "@typescript-eslint/utils": {
87
- "version": "^8.19.0"
88
- },
89
- "@typescript-eslint/rule-tester": {
90
- "version": "^8.19.0",
91
- "alwaysAddToPackageJson": false
92
- },
93
- "@typescript-eslint/scope-manager": {
94
- "version": "^8.19.0",
95
- "alwaysAddToPackageJson": false
96
- },
97
- "@typescript-eslint/typescript-estree": {
98
- "version": "^8.19.0",
99
- "alwaysAddToPackageJson": false
100
- }
101
- }
102
- },
103
- "20.7.0": {
104
- "version": "20.7.0-beta.4",
105
- "packages": {
106
- "eslint-config-prettier": {
107
- "version": "^10.0.0"
108
- }
109
- }
110
- },
111
21
  "21.2.0-typescript-eslint": {
112
22
  "version": "21.2.0-beta.0",
113
23
  "requires": {
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@nx/eslint",
3
- "version": "23.0.0-beta.24",
3
+ "version": "23.0.0-beta.25",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
7
7
  "dist",
8
8
  "!dist/tsconfig.tsbuildinfo",
9
- "!dist/spec",
10
9
  "migrations.json",
11
10
  "executors.json",
12
11
  "generators.json"
@@ -45,7 +44,8 @@
45
44
  "homepage": "https://nx.dev",
46
45
  "ng-update": {
47
46
  "requirements": {},
48
- "migrations": "./migrations.json"
47
+ "migrations": "./migrations.json",
48
+ "supportsOptionalUpdates": true
49
49
  },
50
50
  "generators": "./generators.json",
51
51
  "executors": "./executors.json",
@@ -73,17 +73,17 @@
73
73
  "peerDependencies": {
74
74
  "@zkochan/js-yaml": "0.0.7",
75
75
  "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0",
76
- "@nx/jest": "23.0.0-beta.24"
76
+ "@nx/jest": "23.0.0-beta.25"
77
77
  },
78
78
  "dependencies": {
79
79
  "semver": "^7.6.3",
80
80
  "tslib": "^2.3.0",
81
81
  "typescript": "~5.9.2",
82
- "@nx/js": "23.0.0-beta.24",
83
- "@nx/devkit": "23.0.0-beta.24"
82
+ "@nx/devkit": "23.0.0-beta.25",
83
+ "@nx/js": "23.0.0-beta.25"
84
84
  },
85
85
  "devDependencies": {
86
- "nx": "23.0.0-beta.24"
86
+ "nx": "23.0.0-beta.25"
87
87
  },
88
88
  "peerDependenciesMeta": {
89
89
  "@nx/jest": {
@@ -1,2 +0,0 @@
1
- import { type GeneratorCallback, type Tree } from '@nx/devkit';
2
- export default function (tree: Tree): Promise<GeneratorCallback>;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const devkit_1 = require("@nx/devkit");
5
- const internal_1 = require("@nx/devkit/internal");
6
- const semver_1 = require("semver");
7
- async function default_1(tree) {
8
- const devDependencies = {};
9
- // `@typescript-eslint/parser >=8.0.0` is enforced at the `requires` gate
10
- // in `migrations.json`. The per-package `gte('8.0.0') && lt('8.13.0')`
11
- // check below catches the lockstep-broken case where one of the four
12
- // typescript-eslint packages is at a different major than the parser.
13
- const checkPackageAndMigrate = (pkgName) => {
14
- const pkgVersion = (0, internal_1.getDeclaredPackageVersion)(tree, pkgName);
15
- if (!!pkgVersion && (0, semver_1.gte)(pkgVersion, '8.0.0') && (0, semver_1.lt)(pkgVersion, '8.13.0')) {
16
- devDependencies[pkgName] = '^8.13.0';
17
- }
18
- };
19
- checkPackageAndMigrate('typescript-eslint');
20
- checkPackageAndMigrate('@typescript-eslint/eslint-plugin');
21
- checkPackageAndMigrate('@typescript-eslint/parser');
22
- checkPackageAndMigrate('@typescript-eslint/utils');
23
- if (Object.keys(devDependencies).length > 0) {
24
- return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
25
- }
26
- return () => { };
27
- }
@@ -1,33 +0,0 @@
1
- #### Update TypeScript ESLint to v8.13.0
2
-
3
- Update TypeScript ESLint packages to v8.13.0 if they are already on v8
4
-
5
- #### Sample Code Changes
6
-
7
- This migration will update `typescript-eslint`, `@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser` and `@typescript-eslint/utils` to `8.13.0` if they are between version `8.0.0` and `8.13.0`.
8
-
9
- ##### Before
10
-
11
- ```json title="package.json"
12
- {
13
- "devDependencies": {
14
- "typescript-eslint": "^8.0.0",
15
- "@typescript-eslint/eslint-plugin": "^8.0.0",
16
- "@typescript-eslint/parser": "^8.0.0",
17
- "@typescript-eslint/utils": "^8.0.0"
18
- }
19
- }
20
- ```
21
-
22
- ##### After
23
-
24
- ```json title="package.json"
25
- {
26
- "devDependencies": {
27
- "typescript-eslint": "^8.13.0",
28
- "@typescript-eslint/eslint-plugin": "^8.13.0",
29
- "@typescript-eslint/parser": "^8.13.0",
30
- "@typescript-eslint/utils": "^8.13.0"
31
- }
32
- }
33
- ```
@@ -1,2 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const tslib_1 = require("tslib");
5
- const ts = tslib_1.__importStar(require("typescript"));
6
- const js_1 = require("@nx/js");
7
- async function default_1(tree) {
8
- let rootConfig;
9
- // NOTE: we don't support generating ESM base config currently so they are not handled.
10
- for (const candidate of ['eslint.config.js', 'eslint.config.cjs']) {
11
- if (tree.exists(candidate)) {
12
- rootConfig = candidate;
13
- break;
14
- }
15
- }
16
- if (!rootConfig)
17
- return;
18
- updateOverrideFileExtensions(tree, rootConfig, 'plugin:@nx/typescript', [`'**/*.ts'`, `'**/*.tsx'`], [`'**/*.cts'`, `'**/*.mts'`]);
19
- updateOverrideFileExtensions(tree, rootConfig, 'plugin:@nx/javascript', [`'**/*.js'`, `'**/*.jsx'`], [`'**/*.cjs'`, `'**/*.mjs'`]);
20
- }
21
- function updateOverrideFileExtensions(tree, configFile, plugin, matchingExts, newExts) {
22
- const content = tree.read(configFile, 'utf-8');
23
- const source = ts.createSourceFile('', content, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
24
- let compatNode;
25
- const spreadElementNodes = (0, js_1.findNodes)(source, ts.SyntaxKind.SpreadElement);
26
- for (const a of spreadElementNodes) {
27
- const assignmentNodes = (0, js_1.findNodes)(a, ts.SyntaxKind.PropertyAssignment);
28
- if (assignmentNodes.length === 0)
29
- continue;
30
- for (const b of assignmentNodes) {
31
- if (b.name.getText() === 'extends' &&
32
- b.initializer.getText().includes(plugin)) {
33
- compatNode = a;
34
- break;
35
- }
36
- }
37
- }
38
- if (compatNode) {
39
- const arrayNodes = (0, js_1.findNodes)(compatNode, ts.SyntaxKind.ArrayLiteralExpression);
40
- for (const a of arrayNodes) {
41
- if (matchingExts.every((ext) => a.elements.some((e) => e.getText() === ext))) {
42
- const exts = new Set(a.elements.map((e) => e.getText()));
43
- for (const ext of newExts) {
44
- exts.add(ext);
45
- }
46
- (0, js_1.replaceChange)(tree, source, configFile, a.getStart(a.getSourceFile()), `[${Array.from(exts).join(', ')}]`, a.getText()).getText();
47
- }
48
- }
49
- }
50
- }
@@ -1,83 +0,0 @@
1
- #### Update ESLint Config File Extensions in Overrides
2
-
3
- Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed)
4
-
5
- #### Sample Code Changes
6
-
7
- Add `.cjs`, `.mjs`, `.cts`, `.mts` file extensions to overrides converted using `convert-to-flat-config`
8
-
9
- ##### Before
10
-
11
- ```js title="eslint.config.js"
12
- const { FlatCompat } = require('@eslint/eslintrc');
13
- const js = require('@eslint/js');
14
- const nxEslintPlugin = require('@nx/eslint-plugin');
15
-
16
- const compat = new FlatCompat({
17
- baseDirectory: __dirname,
18
- recommendedConfig: js.configs.recommended,
19
- });
20
-
21
- module.exports = [
22
- ...compat
23
- .config({
24
- extends: ['plugin:@nx/typescript'],
25
- })
26
- .map((config) => ({
27
- ...config,
28
- files: ['**/*.ts', '**/*.tsx'],
29
- rules: {
30
- ...config.rules,
31
- },
32
- })),
33
- ...compat
34
- .config({
35
- extends: ['plugin:@nx/javascript'],
36
- })
37
- .map((config) => ({
38
- ...config,
39
- files: ['**/*.js', '**/*.jsx'],
40
- rules: {
41
- ...config.rules,
42
- },
43
- })),
44
- ];
45
- ```
46
-
47
- ##### After
48
-
49
- ```js title="eslint.config.js" {17,28}
50
- const { FlatCompat } = require('@eslint/eslintrc');
51
- const js = require('@eslint/js');
52
- const nxEslintPlugin = require('@nx/eslint-plugin');
53
-
54
- const compat = new FlatCompat({
55
- baseDirectory: __dirname,
56
- recommendedConfig: js.configs.recommended,
57
- });
58
-
59
- module.exports = [
60
- ...compat
61
- .config({
62
- extends: ['plugin:@nx/typescript'],
63
- })
64
- .map((config) => ({
65
- ...config,
66
- files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'],
67
- rules: {
68
- ...config.rules,
69
- },
70
- })),
71
- ...compat
72
- .config({
73
- extends: ['plugin:@nx/javascript'],
74
- })
75
- .map((config) => ({
76
- ...config,
77
- files: ['**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'],
78
- rules: {
79
- ...config.rules,
80
- },
81
- })),
82
- ];
83
- ```