@nx/next 24.1.0-beta.0 → 24.1.0-beta.2
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/dist/src/generators/application/lib/add-linting.js +107 -32
- package/dist/src/migrations/update-24-1-0/spread-eslint-config-next.d.ts +2 -0
- package/dist/src/migrations/update-24-1-0/spread-eslint-config-next.js +373 -0
- package/dist/src/migrations/update-24-1-0/spread-eslint-config-next.md +58 -0
- package/dist/src/utils/eslint-config-next-conflicts.d.ts +15 -0
- package/dist/src/utils/eslint-config-next-conflicts.js +125 -0
- package/dist/src/utils/flat-config-source.d.ts +25 -0
- package/dist/src/utils/flat-config-source.js +206 -0
- package/dist/src/utils/versions.d.ts +2 -2
- package/dist/src/utils/versions.js +1 -1
- package/migrations.json +64 -0
- package/package.json +12 -12
|
@@ -3,13 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addLinting = addLinting;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const
|
|
7
|
-
const internal_2 = require("@nx/
|
|
6
|
+
const semver_1 = require("semver");
|
|
7
|
+
const internal_2 = require("@nx/react/internal");
|
|
8
|
+
const internal_3 = require("@nx/eslint/internal");
|
|
9
|
+
const eslint_config_next_conflicts_1 = require("../../../utils/eslint-config-next-conflicts");
|
|
10
|
+
const flat_config_source_1 = require("../../../utils/flat-config-source");
|
|
8
11
|
const version_utils_1 = require("../../../utils/version-utils");
|
|
9
|
-
const
|
|
12
|
+
const versions_1 = require("../../../utils/versions");
|
|
13
|
+
const internal_4 = require("@nx/js/internal");
|
|
10
14
|
async function addLinting(host, options) {
|
|
11
15
|
const tasks = [];
|
|
12
|
-
|
|
16
|
+
const isNext16App = options.linter === 'eslint' && (await (0, version_utils_1.isNext16)(host));
|
|
17
|
+
const declaredEslintConfigNextVersion = (0, internal_1.getResolvedPackageVersion)(host, 'eslint-config-next');
|
|
18
|
+
if (isNext16App &&
|
|
19
|
+
declaredEslintConfigNextVersion &&
|
|
20
|
+
(0, semver_1.major)(declaredEslintConfigNextVersion) >= 16 &&
|
|
21
|
+
!(0, internal_3.useFlatConfig)(host)) {
|
|
22
|
+
throw new Error(`The workspace uses the eslintrc config format and declares eslint-config-next v${(0, semver_1.major)(declaredEslintConfigNextVersion)}. ` +
|
|
23
|
+
`eslint-config-next v16 and later ship only a flat config, which an eslintrc config cannot extend. ` +
|
|
24
|
+
`Declare eslint-config-next ${versions_1.eslintConfigNext15Version} to keep the eslintrc format, or convert the workspace to flat config with "nx g @nx/eslint:convert-to-flat-config".`);
|
|
25
|
+
}
|
|
26
|
+
tasks.push(await (0, internal_4.addLintingToProject)(host, {
|
|
13
27
|
oxlintPlugins: ['nextjs', 'react', 'react-perf', 'jsx-a11y'],
|
|
14
28
|
linter: options.linter,
|
|
15
29
|
project: options.projectName,
|
|
@@ -23,15 +37,59 @@ async function addLinting(host, options) {
|
|
|
23
37
|
}));
|
|
24
38
|
// Everything below configures ESLint — predefined configs, `extends`, ignore
|
|
25
39
|
// entries — which have no equivalent in other linters.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
let usesFlatNextConfigs = isNext16App && (0, internal_3.useFlatConfig)(host);
|
|
41
|
+
if (options.linter === 'eslint' && (0, internal_3.isEslintConfigSupported)(host)) {
|
|
42
|
+
let addsNextConfig = true;
|
|
43
|
+
if ((0, internal_3.useFlatConfig)(host)) {
|
|
44
|
+
const configPath = (0, internal_3.findFlatConfigFile)(host, options.appProjectRoot);
|
|
45
|
+
// Adding to an existing setup could widen one scoped to some files or
|
|
46
|
+
// register a second copy of a plugin.
|
|
47
|
+
addsNextConfig = !(0, flat_config_source_1.configuresNextLint)((0, flat_config_source_1.parseFlatConfig)(host.read(configPath, 'utf-8')));
|
|
48
|
+
if (!addsNextConfig) {
|
|
49
|
+
devkit_1.logger.warn(`${configPath} already sets up Next.js linting, so the Next.js lint config was not added to it. ` +
|
|
50
|
+
`Check that it applies the Next.js rules to the files of the "${options.projectName}" project.`);
|
|
51
|
+
}
|
|
52
|
+
if (isNext16App) {
|
|
53
|
+
const rootConfigWithConflictingPlugin = (0, eslint_config_next_conflicts_1.findRootConfigWithConflictingPlugin)(host, (0, eslint_config_next_conflicts_1.getEslintMajorVersion)(host));
|
|
54
|
+
if (rootConfigWithConflictingPlugin) {
|
|
55
|
+
if (addsNextConfig) {
|
|
56
|
+
// ESLint rejects eslint-config-next's own copies of React plugins the root
|
|
57
|
+
// config already registers, so add only the Next.js plugin and its rules.
|
|
58
|
+
if (declaresNextEslintPackageBelow16(host, '@next/eslint-plugin-next')) {
|
|
59
|
+
// Generators keep a declared version, and the plugin's flat
|
|
60
|
+
// `configs['core-web-vitals']` starts in v16.
|
|
61
|
+
tasks.push((0, internal_3.addExtendsToLintConfig)(host, options.appProjectRoot, {
|
|
62
|
+
name: 'plugin:@next/next/core-web-vitals',
|
|
63
|
+
needCompatFixup: true,
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
else if (!(0, internal_3.addPluginConfigToFlatLintConfig)(host, options.appProjectRoot, 'nextEslintPluginNext', '@next/eslint-plugin-next', 'core-web-vitals', { insertAtTheEnd: false })) {
|
|
67
|
+
addsNextConfig = false;
|
|
68
|
+
warnNextConfigNotAdded(configPath, 'nextEslintPluginNext', 'the "core-web-vitals" config of @next/eslint-plugin-next', options.projectName);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (addsNextConfig) {
|
|
72
|
+
devkit_1.logger.warn(`The ESLint config of the "${options.projectName}" project uses the "core-web-vitals" config of @next/eslint-plugin-next instead of eslint-config-next. ` +
|
|
73
|
+
`The root config ${rootConfigWithConflictingPlugin} registers react, react-hooks, import or jsx-a11y, which eslint-config-next also registers, and ESLint fails when two configs register different copies of one plugin. ` +
|
|
74
|
+
'The two may be the same copy, which ESLint accepts. To check, spread eslint-config-next/core-web-vitals in place of the "core-web-vitals" config and run lint. Keep the spread if lint reports no "Cannot redefine plugin" error. ' +
|
|
75
|
+
`Otherwise, files that ${rootConfigWithConflictingPlugin} does not lint with those plugins get no React, React Hooks, jsx-a11y or import rules.`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Generators keep a declared version, which can predate v16.
|
|
80
|
+
usesFlatNextConfigs = !declaresNextEslintPackageBelow16(host, 'eslint-config-next');
|
|
81
|
+
if (usesFlatNextConfigs &&
|
|
82
|
+
addsNextConfig &&
|
|
83
|
+
!(0, internal_3.addSpreadConfigToFlatLintConfig)(host, options.appProjectRoot, 'nextVitals', 'eslint-config-next/core-web-vitals', { insertAtTheEnd: false })) {
|
|
84
|
+
addsNextConfig = false;
|
|
85
|
+
warnNextConfigNotAdded(configPath, 'nextVitals', 'a spread of eslint-config-next/core-web-vitals', options.projectName);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
31
88
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
89
|
+
(0, internal_3.addPredefinedConfigToFlatLintConfig)(host, options.appProjectRoot, 'flat/react-typescript', { checkBaseConfig: true });
|
|
90
|
+
if (!usesFlatNextConfigs && addsNextConfig) {
|
|
91
|
+
// eslint-config-next < 16 has no flat config, so load it through FlatCompat.
|
|
92
|
+
const addExtendsTask = (0, internal_3.addExtendsToLintConfig)(host, options.appProjectRoot, [
|
|
35
93
|
{ name: 'next', needCompatFixup: true },
|
|
36
94
|
{
|
|
37
95
|
name: 'next/core-web-vitals',
|
|
@@ -42,45 +100,62 @@ async function addLinting(host, options) {
|
|
|
42
100
|
}
|
|
43
101
|
}
|
|
44
102
|
else {
|
|
45
|
-
const addExtendsTask = (0,
|
|
103
|
+
const addExtendsTask = (0, internal_3.addExtendsToLintConfig)(host, options.appProjectRoot, [
|
|
46
104
|
'plugin:@nx/react-typescript',
|
|
47
105
|
{ name: 'next', needCompatFixup: true },
|
|
48
106
|
{ name: 'next/core-web-vitals', needCompatFixup: true },
|
|
49
107
|
]);
|
|
50
108
|
tasks.push(addExtendsTask);
|
|
51
109
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
'
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
110
|
+
if (addsNextConfig) {
|
|
111
|
+
(0, internal_3.updateOverrideInLintConfig)(host, options.appProjectRoot, (o) => Array.isArray(o.files) &&
|
|
112
|
+
o.files.some((f) => f.match(/\*\.ts$/)) &&
|
|
113
|
+
o.files.some((f) => f.match(/\*\.tsx$/)) &&
|
|
114
|
+
o.files.some((f) => f.match(/\*\.js$/)) &&
|
|
115
|
+
o.files.some((f) => f.match(/\*\.jsx$/)), (o) => ({
|
|
116
|
+
...o,
|
|
117
|
+
rules: {
|
|
118
|
+
...o.rules,
|
|
119
|
+
'@next/next/no-html-link-for-pages': [
|
|
120
|
+
'error',
|
|
121
|
+
`${options.appProjectRoot}/pages`,
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
(0, internal_3.addIgnoresToLintConfig)(host, options.appProjectRoot, [
|
|
67
127
|
'.next/**/*',
|
|
68
128
|
...(options.isTsSolutionSetup ? ['**/out-tsc'] : []),
|
|
69
129
|
]);
|
|
70
130
|
}
|
|
71
131
|
if (options.linter === 'eslint' && !options.skipPackageJson) {
|
|
72
|
-
|
|
132
|
+
// A Next.js 16 app that extends `next` through FlatCompat or eslintrc needs
|
|
133
|
+
// the v15 packages that Next.js 15 apps get.
|
|
134
|
+
const eslintConfigNextVersion = isNext16App && !usesFlatNextConfigs
|
|
135
|
+
? versions_1.eslintConfigNext15Version
|
|
136
|
+
: await (0, version_utils_1.getEslintConfigNextDependenciesVersionsToInstall)(host);
|
|
73
137
|
// eslint-config-next pulls in unrs-resolver via
|
|
74
138
|
// eslint-import-resolver-typescript, whose postinstall only fetches a
|
|
75
139
|
// fallback binding for platforms its prebuilt optional dependencies miss.
|
|
76
140
|
(0, internal_1.acknowledgeBuildScripts)(host, (0, devkit_1.detectPackageManager)(host.root), {
|
|
77
141
|
'unrs-resolver': false,
|
|
78
142
|
});
|
|
79
|
-
|
|
80
|
-
...react_1.extraEslintDependencies.devDependencies,
|
|
143
|
+
const nextLintDependencies = {
|
|
81
144
|
'eslint-config-next': eslintConfigNextVersion,
|
|
82
145
|
'@next/eslint-plugin-next': eslintConfigNextVersion,
|
|
83
|
-
}
|
|
146
|
+
};
|
|
147
|
+
// eslint-config-next 16 brings its own React plugins.
|
|
148
|
+
tasks.push(usesFlatNextConfigs
|
|
149
|
+
? (0, devkit_1.addDependenciesToPackageJson)(host, {}, nextLintDependencies, undefined, true)
|
|
150
|
+
: (0, internal_2.addExtraEslintDependencies)(host, nextLintDependencies));
|
|
84
151
|
}
|
|
85
152
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
86
153
|
}
|
|
154
|
+
function warnNextConfigNotAdded(configPath, variableName, config, projectName) {
|
|
155
|
+
devkit_1.logger.warn(`The Next.js lint config was not added to ${configPath}, because it already uses the name "${variableName}" or does not export an array literal. ` +
|
|
156
|
+
`Add ${config} to it to lint the "${projectName}" project with the Next.js rules.`);
|
|
157
|
+
}
|
|
158
|
+
function declaresNextEslintPackageBelow16(tree, packageName) {
|
|
159
|
+
const version = (0, internal_1.getResolvedPackageVersion)(tree, packageName);
|
|
160
|
+
return !!version && (0, semver_1.major)(version) < 16;
|
|
161
|
+
}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/eslint/internal");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
7
|
+
const eslint_config_next_conflicts_1 = require("../../utils/eslint-config-next-conflicts");
|
|
8
|
+
const flat_config_source_1 = require("../../utils/flat-config-source");
|
|
9
|
+
const NEXT_VITALS = 'nextVitals';
|
|
10
|
+
const NEXT_VITALS_IMPORT = 'eslint-config-next/core-web-vitals';
|
|
11
|
+
const NEXT_PLUGIN_IMPORT = '@next/eslint-plugin-next';
|
|
12
|
+
// The name the @nx/eslint generators give the exported config array.
|
|
13
|
+
const CONFIG_VARIABLE = 'eslintConfig';
|
|
14
|
+
const GENERATED_COMPAT_CONFIGS = ['next', 'next/core-web-vitals'];
|
|
15
|
+
// Modules of the FlatCompat and `@next/next` setup that Nx generated next to the Next.js entries.
|
|
16
|
+
const SETUP_MODULES = new Set([
|
|
17
|
+
NEXT_PLUGIN_IMPORT,
|
|
18
|
+
'@eslint/compat',
|
|
19
|
+
'@eslint/eslintrc',
|
|
20
|
+
'@eslint/js',
|
|
21
|
+
'path',
|
|
22
|
+
'url',
|
|
23
|
+
'node:path',
|
|
24
|
+
'node:url',
|
|
25
|
+
]);
|
|
26
|
+
const RULE_FROM_NEXT_REGISTERED_PLUGIN = /^(?:react|jsx-a11y|import)\/[\w-]+$/;
|
|
27
|
+
let tsModule;
|
|
28
|
+
async function update(tree) {
|
|
29
|
+
tsModule ??= (0, internal_2.ensureTypescript)();
|
|
30
|
+
const eslintMajor = (0, eslint_config_next_conflicts_1.getEslintMajorVersion)(tree);
|
|
31
|
+
const rootConfigWithConflictingPlugin = (0, eslint_config_next_conflicts_1.findRootConfigWithConflictingPlugin)(tree, eslintMajor);
|
|
32
|
+
const nextSteps = [];
|
|
33
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, '', (path) => {
|
|
34
|
+
if (!(0, internal_1.isFlatConfig)(path)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const source = (0, flat_config_source_1.parseFlatConfig)(tree.read(path, 'utf-8'));
|
|
38
|
+
const usage = (0, flat_config_source_1.getEslintConfigNextUsage)(source);
|
|
39
|
+
if (!usage.registersNextPlugin && !usage.extendsNextThroughCompat) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let reason;
|
|
43
|
+
let suggestNextPluginConfig = false;
|
|
44
|
+
if (usage.importsEslintConfigNext) {
|
|
45
|
+
reason = 'it already imports eslint-config-next';
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const configWithConflictingPlugin = (0, eslint_config_next_conflicts_1.findConfigWithConflictingPlugin)(tree, path, eslintMajor);
|
|
49
|
+
const conflictingConfig = configWithConflictingPlugin === path
|
|
50
|
+
? 'it'
|
|
51
|
+
: (configWithConflictingPlugin ?? rootConfigWithConflictingPlugin);
|
|
52
|
+
if (conflictingConfig) {
|
|
53
|
+
const updated = addNextPluginConfig(source);
|
|
54
|
+
if (updated) {
|
|
55
|
+
tree.write(path, updated);
|
|
56
|
+
nextSteps.push(getNextPluginConfigNote(path, conflictingConfig));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
reason = getConflictingPluginsReason(conflictingConfig);
|
|
60
|
+
suggestNextPluginConfig = true;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const updated = spreadNextVitals(source);
|
|
64
|
+
if (updated) {
|
|
65
|
+
tree.write(path, updated);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
reason = 'its Next.js entries differ from the ones Nx generates';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
nextSteps.push(getNextStep(path, source, usage.extendsNextThroughCompat, reason, suggestNextPluginConfig));
|
|
72
|
+
});
|
|
73
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
74
|
+
return nextSteps.length
|
|
75
|
+
? { nextSteps, agentContext: nextSteps }
|
|
76
|
+
: { skipAgentic: true };
|
|
77
|
+
}
|
|
78
|
+
function findGeneratedNextEntries(source) {
|
|
79
|
+
const elements = getExportedArrayElements(source);
|
|
80
|
+
if (!elements) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const bindings = (0, flat_config_source_1.getModuleBindings)(source);
|
|
84
|
+
const pluginElements = elements.filter((element) => getGeneratedNextPluginBinding(element, bindings) !== undefined);
|
|
85
|
+
const compatElements = elements.filter(isGeneratedCompatElement);
|
|
86
|
+
if (pluginElements.length === 1 && !compatElements.length) {
|
|
87
|
+
return {
|
|
88
|
+
elements,
|
|
89
|
+
generated: new Set(pluginElements),
|
|
90
|
+
pluginBinding: getGeneratedNextPluginBinding(pluginElements[0], bindings),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const compatConfigs = new Set(compatElements
|
|
94
|
+
.flatMap((element) => getCompatExtendsCall(element).arguments)
|
|
95
|
+
.map((argument) => argument.text));
|
|
96
|
+
if (!pluginElements.length &&
|
|
97
|
+
compatConfigs.size === GENERATED_COMPAT_CONFIGS.length) {
|
|
98
|
+
return {
|
|
99
|
+
elements,
|
|
100
|
+
generated: new Set(compatElements),
|
|
101
|
+
pluginBinding: undefined,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
function replaceGeneratedNextEntries(source, { elements, generated }, text) {
|
|
107
|
+
const changes = [];
|
|
108
|
+
elements.forEach((element, index) => {
|
|
109
|
+
if (!generated.has(element)) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!changes.length) {
|
|
113
|
+
changes.push({
|
|
114
|
+
type: devkit_1.ChangeType.Delete,
|
|
115
|
+
start: element.getStart(),
|
|
116
|
+
length: element.end - element.getStart(),
|
|
117
|
+
}, { type: devkit_1.ChangeType.Insert, index: element.getStart(), text });
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const previous = elements[index - 1];
|
|
121
|
+
changes.push({
|
|
122
|
+
type: devkit_1.ChangeType.Delete,
|
|
123
|
+
start: previous.end,
|
|
124
|
+
length: element.end - previous.end,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return (0, devkit_1.applyChangesToString)(source.getFullText(), changes);
|
|
129
|
+
}
|
|
130
|
+
// Returns undefined when the file has Next.js entries Nx did not generate or already uses `nextVitals`.
|
|
131
|
+
function spreadNextVitals(source) {
|
|
132
|
+
const entries = findGeneratedNextEntries(source);
|
|
133
|
+
if (!entries || hasIdentifier(source, NEXT_VITALS)) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
let updated = replaceGeneratedNextEntries(source, entries, `...${NEXT_VITALS}`);
|
|
137
|
+
updated = (0, internal_1.addImportToFlatConfig)(updated, NEXT_VITALS, NEXT_VITALS_IMPORT);
|
|
138
|
+
updated = removeUnusedSetup(updated);
|
|
139
|
+
updated = nameExportedArray(updated);
|
|
140
|
+
return hasNextEntries(updated) ? undefined : updated;
|
|
141
|
+
}
|
|
142
|
+
// Replaces only the `@next/next` registration. The FlatCompat `next` configs also
|
|
143
|
+
// registered react, import and jsx-a11y, whose rules the file may set.
|
|
144
|
+
function addNextPluginConfig(source) {
|
|
145
|
+
const entries = findGeneratedNextEntries(source);
|
|
146
|
+
if (!entries?.pluginBinding) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
const updated = replaceGeneratedNextEntries(source, entries, `${entries.pluginBinding}.configs['core-web-vitals']`);
|
|
150
|
+
return hasNextEntries(updated) ? undefined : updated;
|
|
151
|
+
}
|
|
152
|
+
function hasNextEntries(content) {
|
|
153
|
+
const usage = (0, flat_config_source_1.getEslintConfigNextUsage)((0, flat_config_source_1.parseFlatConfig)(content));
|
|
154
|
+
return usage.registersNextPlugin || usage.extendsNextThroughCompat;
|
|
155
|
+
}
|
|
156
|
+
// `{ plugins: { '@next/next': nextEslintPluginNext } }`
|
|
157
|
+
function getGeneratedNextPluginBinding(element, bindings) {
|
|
158
|
+
if (!tsModule.isObjectLiteralExpression(element) ||
|
|
159
|
+
element.properties.length !== 1) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
const [plugins] = element.properties;
|
|
163
|
+
if (!tsModule.isPropertyAssignment(plugins) ||
|
|
164
|
+
(0, flat_config_source_1.getPropertyName)(plugins.name) !== 'plugins' ||
|
|
165
|
+
!tsModule.isObjectLiteralExpression(plugins.initializer) ||
|
|
166
|
+
plugins.initializer.properties.length !== 1) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
const [plugin] = plugins.initializer.properties;
|
|
170
|
+
return tsModule.isPropertyAssignment(plugin) &&
|
|
171
|
+
(0, flat_config_source_1.getPropertyName)(plugin.name) === '@next/next' &&
|
|
172
|
+
tsModule.isIdentifier(plugin.initializer) &&
|
|
173
|
+
bindings.get(plugin.initializer.text) === NEXT_PLUGIN_IMPORT
|
|
174
|
+
? plugin.initializer.text
|
|
175
|
+
: undefined;
|
|
176
|
+
}
|
|
177
|
+
// `...compat.extends('next', ...)` or `...fixupConfigRules(compat.extends('next'))`
|
|
178
|
+
function isGeneratedCompatElement(element) {
|
|
179
|
+
if (!tsModule.isSpreadElement(element)) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
const call = getCompatExtendsCall(element);
|
|
183
|
+
return (!!call &&
|
|
184
|
+
call.arguments.length > 0 &&
|
|
185
|
+
call.arguments.every((argument) => tsModule.isStringLiteralLike(argument) &&
|
|
186
|
+
GENERATED_COMPAT_CONFIGS.includes(argument.text)));
|
|
187
|
+
}
|
|
188
|
+
function getCompatExtendsCall(element) {
|
|
189
|
+
if (!tsModule.isSpreadElement(element)) {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
let expression = element.expression;
|
|
193
|
+
if (tsModule.isCallExpression(expression) &&
|
|
194
|
+
tsModule.isIdentifier(expression.expression) &&
|
|
195
|
+
expression.expression.text === 'fixupConfigRules' &&
|
|
196
|
+
expression.arguments.length === 1) {
|
|
197
|
+
expression = expression.arguments[0];
|
|
198
|
+
}
|
|
199
|
+
return tsModule.isCallExpression(expression) &&
|
|
200
|
+
tsModule.isPropertyAccessExpression(expression.expression) &&
|
|
201
|
+
tsModule.isIdentifier(expression.expression.expression) &&
|
|
202
|
+
expression.expression.expression.text === 'compat' &&
|
|
203
|
+
expression.expression.name.text === 'extends'
|
|
204
|
+
? expression
|
|
205
|
+
: undefined;
|
|
206
|
+
}
|
|
207
|
+
function removeUnusedSetup(content) {
|
|
208
|
+
while (true) {
|
|
209
|
+
const source = (0, flat_config_source_1.parseFlatConfig)(content);
|
|
210
|
+
const unused = source.statements.filter((statement) => (isCompatDeclaration(statement) &&
|
|
211
|
+
!isReferencedOutside(source, ['compat'], statement)) ||
|
|
212
|
+
(0, flat_config_source_1.getImports)(statement).some(({ module, names }) => SETUP_MODULES.has(module) &&
|
|
213
|
+
!isReferencedOutside(source, names, statement)));
|
|
214
|
+
if (!unused.length) {
|
|
215
|
+
return content;
|
|
216
|
+
}
|
|
217
|
+
content = (0, devkit_1.applyChangesToString)(content, unused.map((statement) => {
|
|
218
|
+
const start = statement.getStart();
|
|
219
|
+
const end = content[statement.end] === '\n' ? statement.end + 1 : statement.end;
|
|
220
|
+
return { type: devkit_1.ChangeType.Delete, start, length: end - start };
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function isCompatDeclaration(statement) {
|
|
225
|
+
if (!tsModule.isVariableStatement(statement) ||
|
|
226
|
+
statement.declarationList.declarations.length !== 1) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
const [declaration] = statement.declarationList.declarations;
|
|
230
|
+
return (tsModule.isIdentifier(declaration.name) &&
|
|
231
|
+
declaration.name.text === 'compat' &&
|
|
232
|
+
!!declaration.initializer &&
|
|
233
|
+
tsModule.isNewExpression(declaration.initializer) &&
|
|
234
|
+
tsModule.isIdentifier(declaration.initializer.expression) &&
|
|
235
|
+
declaration.initializer.expression.text === 'FlatCompat');
|
|
236
|
+
}
|
|
237
|
+
function isReferencedOutside(source, names, statement) {
|
|
238
|
+
let referenced = false;
|
|
239
|
+
const visit = (node) => {
|
|
240
|
+
if (referenced || node === statement) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (tsModule.isIdentifier(node) && names.includes(node.text)) {
|
|
244
|
+
referenced = true;
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
tsModule.forEachChild(node, visit);
|
|
248
|
+
};
|
|
249
|
+
visit(source);
|
|
250
|
+
return referenced;
|
|
251
|
+
}
|
|
252
|
+
function getConflictingPluginsReason(config) {
|
|
253
|
+
return `${config} registers react, react-hooks, import or jsx-a11y, which eslint-config-next also registers. ESLint fails when two configs register different copies of one plugin`;
|
|
254
|
+
}
|
|
255
|
+
function getNextPluginConfigNote(path, conflictingConfig) {
|
|
256
|
+
return [
|
|
257
|
+
`${path} now uses the "core-web-vitals" config of "${NEXT_PLUGIN_IMPORT}" instead of eslint-config-next, because ${getConflictingPluginsReason(conflictingConfig)}.`,
|
|
258
|
+
`The two may be the same copy, which ESLint accepts. To check, spread eslint-config-next/core-web-vitals in place of the "core-web-vitals" config in ${path} and run lint. Keep the spread if lint reports no "Cannot redefine plugin" error.`,
|
|
259
|
+
`Otherwise, files that ${conflictingConfig} does not lint with those plugins get no React, React Hooks, jsx-a11y or import rules.`,
|
|
260
|
+
`Rules and eslint-disable comments that name a react/, jsx-a11y/ or import/ rule, in ${path} or in the files it lints, make lint fail unless another config registers that plugin. Delete or rewrite them.`,
|
|
261
|
+
].join(' ');
|
|
262
|
+
}
|
|
263
|
+
function getNextStep(path, source, extendsNextThroughCompat, reason, suggestNextPluginConfig) {
|
|
264
|
+
const problem = extendsNextThroughCompat
|
|
265
|
+
? 'extends the "next" configs through FlatCompat, which fails because eslint-config-next 16 only ships flat configs'
|
|
266
|
+
: 'registers the "@next/next" plugin directly instead of through eslint-config-next';
|
|
267
|
+
const rules = findRulesFromNextRegisteredPlugins(source);
|
|
268
|
+
const fix = suggestNextPluginConfig
|
|
269
|
+
? [
|
|
270
|
+
`Replace the Next.js entries with the "core-web-vitals" config of "${NEXT_PLUGIN_IMPORT}", which registers only the Next.js plugin.`,
|
|
271
|
+
...(rules.length
|
|
272
|
+
? [
|
|
273
|
+
`Its references to ${rules.join(', ')} then need another config to register those plugins.`,
|
|
274
|
+
]
|
|
275
|
+
: []),
|
|
276
|
+
]
|
|
277
|
+
: [
|
|
278
|
+
`Replace the Next.js entries with a spread of the default export of "${NEXT_VITALS_IMPORT}".`,
|
|
279
|
+
...(rules.length
|
|
280
|
+
? [
|
|
281
|
+
`Its references to ${rules.join(', ')} keep working after that, because eslint-config-next registers those plugins.`,
|
|
282
|
+
]
|
|
283
|
+
: []),
|
|
284
|
+
];
|
|
285
|
+
return [
|
|
286
|
+
`${path} ${problem}.`,
|
|
287
|
+
`The migration did not update it because ${reason}.`,
|
|
288
|
+
...fix,
|
|
289
|
+
].join(' ');
|
|
290
|
+
}
|
|
291
|
+
function findRulesFromNextRegisteredPlugins(source) {
|
|
292
|
+
const rules = new Set();
|
|
293
|
+
const visit = (node) => {
|
|
294
|
+
if (tsModule.isStringLiteralLike(node) &&
|
|
295
|
+
RULE_FROM_NEXT_REGISTERED_PLUGIN.test(node.text)) {
|
|
296
|
+
rules.add(node.text);
|
|
297
|
+
}
|
|
298
|
+
tsModule.forEachChild(node, visit);
|
|
299
|
+
};
|
|
300
|
+
visit(source);
|
|
301
|
+
return [...rules];
|
|
302
|
+
}
|
|
303
|
+
function getExportedArrayElements(source) {
|
|
304
|
+
for (const statement of source.statements) {
|
|
305
|
+
if (tsModule.isExportAssignment(statement) && !statement.isExportEquals) {
|
|
306
|
+
const exported = tsModule.isIdentifier(statement.expression)
|
|
307
|
+
? findConstInitializer(source, statement.expression.text)
|
|
308
|
+
: statement.expression;
|
|
309
|
+
if (exported && tsModule.isArrayLiteralExpression(exported)) {
|
|
310
|
+
return exported.elements;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (tsModule.isExpressionStatement(statement) &&
|
|
314
|
+
tsModule.isBinaryExpression(statement.expression) &&
|
|
315
|
+
statement.expression.operatorToken.kind ===
|
|
316
|
+
tsModule.SyntaxKind.EqualsToken &&
|
|
317
|
+
statement.expression.left.getText() === 'module.exports' &&
|
|
318
|
+
tsModule.isArrayLiteralExpression(statement.expression.right)) {
|
|
319
|
+
return statement.expression.right.elements;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return undefined;
|
|
323
|
+
}
|
|
324
|
+
// A `let` or `var` is skipped because a later assignment can replace its value.
|
|
325
|
+
function findConstInitializer(source, name) {
|
|
326
|
+
for (const statement of source.statements) {
|
|
327
|
+
if (!tsModule.isVariableStatement(statement) ||
|
|
328
|
+
(statement.declarationList.flags & tsModule.NodeFlags.BlockScoped) !==
|
|
329
|
+
tsModule.NodeFlags.Const) {
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
const declaration = statement.declarationList.declarations.find((declaration) => tsModule.isIdentifier(declaration.name) &&
|
|
333
|
+
declaration.name.text === name);
|
|
334
|
+
if (declaration) {
|
|
335
|
+
return declaration.initializer;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return undefined;
|
|
339
|
+
}
|
|
340
|
+
// eslint-config-next turns on `import/no-anonymous-default-export`, which reports `export default [...]`.
|
|
341
|
+
function nameExportedArray(content) {
|
|
342
|
+
const source = (0, flat_config_source_1.parseFlatConfig)(content);
|
|
343
|
+
const exportDefault = source.statements.find((statement) => tsModule.isExportAssignment(statement) && !statement.isExportEquals);
|
|
344
|
+
if (!exportDefault ||
|
|
345
|
+
!tsModule.isArrayLiteralExpression(exportDefault.expression)) {
|
|
346
|
+
return content;
|
|
347
|
+
}
|
|
348
|
+
let name = CONFIG_VARIABLE;
|
|
349
|
+
for (let suffix = 2; hasIdentifier(source, name); suffix++) {
|
|
350
|
+
name = `${CONFIG_VARIABLE}${suffix}`;
|
|
351
|
+
}
|
|
352
|
+
const start = exportDefault.getStart();
|
|
353
|
+
return (0, devkit_1.applyChangesToString)(content, [
|
|
354
|
+
{
|
|
355
|
+
type: devkit_1.ChangeType.Delete,
|
|
356
|
+
start,
|
|
357
|
+
length: exportDefault.expression.getStart() - start,
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
type: devkit_1.ChangeType.Insert,
|
|
361
|
+
index: start,
|
|
362
|
+
text: `const ${name} = `,
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
type: devkit_1.ChangeType.Insert,
|
|
366
|
+
index: exportDefault.end,
|
|
367
|
+
text: `\n\nexport default ${name};`,
|
|
368
|
+
},
|
|
369
|
+
]);
|
|
370
|
+
}
|
|
371
|
+
function hasIdentifier(source, name) {
|
|
372
|
+
return isReferencedOutside(source, [name], undefined);
|
|
373
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#### Spread `eslint-config-next` in Next.js flat ESLint configs
|
|
2
|
+
|
|
3
|
+
Replaces the Next.js entries Nx generated in flat ESLint configs with a spread of `eslint-config-next/core-web-vitals`. eslint-config-next 16.4 is the first release that patches its bundled plugins for ESLint 10. The migration handles two generated shapes:
|
|
4
|
+
|
|
5
|
+
- Next.js 16 apps registered the `@next/next` plugin without the `eslint-config-next` rule set.
|
|
6
|
+
- Next.js 15 apps and configs converted from `.eslintrc` files extended `next` and `next/core-web-vitals` through `FlatCompat`. That fails on eslint-config-next 16, which ships only flat configs.
|
|
7
|
+
|
|
8
|
+
The migration also removes the `@next/eslint-plugin-next`, `FlatCompat` and `fixupConfigRules` setup once no other entry uses it.
|
|
9
|
+
|
|
10
|
+
When the migration spreads eslint-config-next in an ESM config, it also names the exported array (`const eslintConfig = [...]; export default eslintConfig;`). eslint-config-next turns on `import/no-anonymous-default-export`, which reports `export default [...]`. If the config already uses the name `eslintConfig`, the export takes the first unused name of `eslintConfig2`, `eslintConfig3` and so on.
|
|
11
|
+
|
|
12
|
+
The config, or a config at the workspace root, may register the `react`, `react-hooks`, `import` or `jsx-a11y` plugin, directly or through a local module it loads by a relative path that names the file. eslint-config-next registers those plugins too, and ESLint fails when two configs register different copies of one plugin. In that case the migration replaces the `@next/next` registration with the `core-web-vitals` config of `@next/eslint-plugin-next`, which registers only the Next.js plugin. Files that the other config does not lint with those plugins get no React, React Hooks, jsx-a11y or import rules. Rules and directive comments that name a `react/`, `jsx-a11y/` or `import/` rule then fail in that config and the files it lints, unless another config registers the plugin. The migration lists each config it changes this way.
|
|
13
|
+
|
|
14
|
+
The migration finds such a plugin when one of those files loads the plugin's package or a file inside it, names a config that registers the plugin (such as `flat/react`), or has a `plugins` object with the plugin's name. It checks each local module as a whole, except for type-only imports, and counts every registration it finds. The conflict is possible, not certain: the other config may register the same copy of the plugin, which ESLint accepts, or register it only in a config the app does not use. To check, spread `eslint-config-next/core-web-vitals` in place of the `core-web-vitals` config and run lint. Keep the spread if lint reports no `Cannot redefine plugin` error. The migration misses any other registration, such as a plugin that an npm config package registers, or a module loaded by a computed path, without its file extension or through a directory. It then spreads eslint-config-next, and ESLint fails with `Cannot redefine plugin` until you replace the spread with the `core-web-vitals` config of `@next/eslint-plugin-next` by hand.
|
|
15
|
+
|
|
16
|
+
It leaves a config unchanged and lists it, with the steps to finish by hand, when:
|
|
17
|
+
|
|
18
|
+
- the config already imports `eslint-config-next`.
|
|
19
|
+
- the config, or a config at the workspace root, registers one of those plugins and the config extends `next` through `FlatCompat`. The `next` configs also registered `react`, `import` and `jsx-a11y`, and rules in the config may reference them.
|
|
20
|
+
- the Next.js entries differ from the ones Nx generates.
|
|
21
|
+
|
|
22
|
+
#### Sample code changes
|
|
23
|
+
|
|
24
|
+
##### Before
|
|
25
|
+
|
|
26
|
+
```js title="apps/my-app/eslint.config.mjs"
|
|
27
|
+
import nextEslintPluginNext from '@next/eslint-plugin-next';
|
|
28
|
+
import nx from '@nx/eslint-plugin';
|
|
29
|
+
import baseConfig from '../../eslint.config.mjs';
|
|
30
|
+
|
|
31
|
+
export default [
|
|
32
|
+
{ plugins: { '@next/next': nextEslintPluginNext } },
|
|
33
|
+
...nx.configs['flat/react-typescript'],
|
|
34
|
+
...baseConfig,
|
|
35
|
+
{
|
|
36
|
+
ignores: ['.next/**/*'],
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
##### After
|
|
42
|
+
|
|
43
|
+
```js title="apps/my-app/eslint.config.mjs"
|
|
44
|
+
import nextVitals from 'eslint-config-next/core-web-vitals';
|
|
45
|
+
import nx from '@nx/eslint-plugin';
|
|
46
|
+
import baseConfig from '../../eslint.config.mjs';
|
|
47
|
+
|
|
48
|
+
const eslintConfig = [
|
|
49
|
+
...nextVitals,
|
|
50
|
+
...nx.configs['flat/react-typescript'],
|
|
51
|
+
...baseConfig,
|
|
52
|
+
{
|
|
53
|
+
ignores: ['.next/**/*'],
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
export default eslintConfig;
|
|
58
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
export declare function getEslintMajorVersion(tree: Tree): number;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the first root ESLint config that registers a plugin eslint-config-next
|
|
5
|
+
* also registers, directly or through a local module it imports. Generated
|
|
6
|
+
* project configs spread the root config, so its plugins load next to theirs.
|
|
7
|
+
*/
|
|
8
|
+
export declare function findRootConfigWithConflictingPlugin(tree: Tree, eslintMajor: number): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Returns `configPath`, or the first local module reachable through its imports,
|
|
11
|
+
* that registers a plugin eslint-config-next also registers. Only a relative
|
|
12
|
+
* specifier that names an existing file is followed, so a module loaded without
|
|
13
|
+
* its extension, through a directory or from an npm config package is not found.
|
|
14
|
+
*/
|
|
15
|
+
export declare function findConfigWithConflictingPlugin(tree: Tree, configPath: string, eslintMajor: number): string | undefined;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEslintMajorVersion = getEslintMajorVersion;
|
|
4
|
+
exports.findRootConfigWithConflictingPlugin = findRootConfigWithConflictingPlugin;
|
|
5
|
+
exports.findConfigWithConflictingPlugin = findConfigWithConflictingPlugin;
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const internal_1 = require("@nx/eslint/internal");
|
|
8
|
+
const internal_2 = require("@nx/js/internal");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const semver_1 = require("semver");
|
|
11
|
+
const flat_config_source_1 = require("./flat-config-source");
|
|
12
|
+
// The plugins eslint-config-next registers. ESLint fails when two configs
|
|
13
|
+
// register different copies of one plugin.
|
|
14
|
+
const CONFLICTING_PLUGIN_MODULES = [
|
|
15
|
+
'eslint-plugin-react',
|
|
16
|
+
'eslint-plugin-react-hooks',
|
|
17
|
+
'eslint-plugin-import',
|
|
18
|
+
'eslint-plugin-jsx-a11y',
|
|
19
|
+
];
|
|
20
|
+
const CONFLICTING_PLUGIN_NAMES = new Set([
|
|
21
|
+
'react',
|
|
22
|
+
'react-hooks',
|
|
23
|
+
'import',
|
|
24
|
+
'jsx-a11y',
|
|
25
|
+
]);
|
|
26
|
+
// `flat/react-base` registers `import` below ESLint v10 and `import-x` from v10 on.
|
|
27
|
+
const CONFLICTING_CONFIG_REFERENCE_BELOW_ESLINT_10 = /^(?:flat\/react(?:-base|-jsx)?|plugin:(?:react|react-hooks|import|jsx-a11y)\/.+)$/;
|
|
28
|
+
const CONFLICTING_CONFIG_REFERENCE = /^(?:flat\/react(?:-jsx)?|plugin:(?:react|react-hooks|import|jsx-a11y)\/.+)$/;
|
|
29
|
+
let tsModule;
|
|
30
|
+
// Without a declared ESLint, the version the linting generators would install.
|
|
31
|
+
function getEslintMajorVersion(tree) {
|
|
32
|
+
const version = (0, internal_1.getInstalledEslintVersion)(tree) ?? (0, internal_1.versions)(tree).eslintVersion;
|
|
33
|
+
return (0, semver_1.coerce)(version)?.major ?? 10;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns the first root ESLint config that registers a plugin eslint-config-next
|
|
37
|
+
* also registers, directly or through a local module it imports. Generated
|
|
38
|
+
* project configs spread the root config, so its plugins load next to theirs.
|
|
39
|
+
*/
|
|
40
|
+
function findRootConfigWithConflictingPlugin(tree, eslintMajor) {
|
|
41
|
+
return tree
|
|
42
|
+
.children('')
|
|
43
|
+
.filter((file) => (0, internal_1.isEslintConfigFile)(file) && tree.isFile(file))
|
|
44
|
+
.find((file) => findConfigWithConflictingPlugin(tree, file, eslintMajor) !== undefined);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns `configPath`, or the first local module reachable through its imports,
|
|
48
|
+
* that registers a plugin eslint-config-next also registers. Only a relative
|
|
49
|
+
* specifier that names an existing file is followed, so a module loaded without
|
|
50
|
+
* its extension, through a directory or from an npm config package is not found.
|
|
51
|
+
*/
|
|
52
|
+
function findConfigWithConflictingPlugin(tree, configPath, eslintMajor) {
|
|
53
|
+
const visited = new Set();
|
|
54
|
+
const find = (file) => {
|
|
55
|
+
if (visited.has(file)) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
visited.add(file);
|
|
59
|
+
const source = (0, flat_config_source_1.parseFlatConfig)(tree.read(file, 'utf-8'));
|
|
60
|
+
if (registersConflictingPlugin(source, eslintMajor)) {
|
|
61
|
+
return file;
|
|
62
|
+
}
|
|
63
|
+
for (const specifier of getLocalModuleSpecifiers(source)) {
|
|
64
|
+
const imported = resolveLocalModule(tree, file, specifier);
|
|
65
|
+
const found = imported && find(imported);
|
|
66
|
+
if (found) {
|
|
67
|
+
return found;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
};
|
|
72
|
+
return find(configPath);
|
|
73
|
+
}
|
|
74
|
+
function getLocalModuleSpecifiers(source) {
|
|
75
|
+
tsModule ??= (0, internal_2.ensureTypescript)();
|
|
76
|
+
const specifiers = [];
|
|
77
|
+
const visit = (node) => {
|
|
78
|
+
const specifier = (0, flat_config_source_1.getLoadedModuleSpecifier)(node);
|
|
79
|
+
if (specifier !== undefined && /^\.\.?\//.test(specifier)) {
|
|
80
|
+
specifiers.push(specifier);
|
|
81
|
+
}
|
|
82
|
+
tsModule.forEachChild(node, visit);
|
|
83
|
+
};
|
|
84
|
+
visit(source);
|
|
85
|
+
return specifiers;
|
|
86
|
+
}
|
|
87
|
+
// Matches subpaths too: `eslint-plugin-react/configs/recommended.js` registers `react`.
|
|
88
|
+
function isConflictingPluginModule(specifier) {
|
|
89
|
+
return CONFLICTING_PLUGIN_MODULES.some((module) => specifier === module || specifier.startsWith(`${module}/`));
|
|
90
|
+
}
|
|
91
|
+
function resolveLocalModule(tree, importer, specifier) {
|
|
92
|
+
const path = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(importer), specifier);
|
|
93
|
+
return !isOutsideWorkspace(path) && tree.isFile(path) ? path : undefined;
|
|
94
|
+
}
|
|
95
|
+
function isOutsideWorkspace(path) {
|
|
96
|
+
return path === '..' || path.startsWith('../');
|
|
97
|
+
}
|
|
98
|
+
// Any load of one of the plugins counts, so a plugin registered under a
|
|
99
|
+
// computed key is found when its object comes from one of those packages.
|
|
100
|
+
function registersConflictingPlugin(source, eslintMajor) {
|
|
101
|
+
const configReference = eslintMajor < 10
|
|
102
|
+
? CONFLICTING_CONFIG_REFERENCE_BELOW_ESLINT_10
|
|
103
|
+
: CONFLICTING_CONFIG_REFERENCE;
|
|
104
|
+
tsModule ??= (0, internal_2.ensureTypescript)();
|
|
105
|
+
let found = false;
|
|
106
|
+
const visit = (node) => {
|
|
107
|
+
if (found) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const specifier = (0, flat_config_source_1.getLoadedModuleSpecifier)(node);
|
|
111
|
+
if ((specifier !== undefined && isConflictingPluginModule(specifier)) ||
|
|
112
|
+
(tsModule.isStringLiteralLike(node) && configReference.test(node.text)) ||
|
|
113
|
+
(tsModule.isPropertyAssignment(node) &&
|
|
114
|
+
(0, flat_config_source_1.getPropertyName)(node.name) === 'plugins' &&
|
|
115
|
+
tsModule.isObjectLiteralExpression(node.initializer) &&
|
|
116
|
+
node.initializer.properties.some((property) => property.name &&
|
|
117
|
+
CONFLICTING_PLUGIN_NAMES.has((0, flat_config_source_1.getPropertyName)(property.name))))) {
|
|
118
|
+
found = true;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
tsModule.forEachChild(node, visit);
|
|
122
|
+
};
|
|
123
|
+
visit(source);
|
|
124
|
+
return found;
|
|
125
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
export declare function parseFlatConfig(content: string): ts.SourceFile;
|
|
3
|
+
export declare function getModuleBindings(source: ts.SourceFile): Map<string, string>;
|
|
4
|
+
export declare function getImports(statement: ts.Statement): {
|
|
5
|
+
module: string;
|
|
6
|
+
names: string[];
|
|
7
|
+
}[];
|
|
8
|
+
export declare function getPropertyName(name: ts.PropertyName): string | undefined;
|
|
9
|
+
export declare function getLoadedModuleSpecifier(node: ts.Node): string | undefined;
|
|
10
|
+
export interface EslintConfigNextUsage {
|
|
11
|
+
/** Loads `eslint-config-next` or one of its flat configs. */
|
|
12
|
+
importsEslintConfigNext: boolean;
|
|
13
|
+
/** Registers the `@next/next` plugin, as Nx generated for Next.js 16 apps. */
|
|
14
|
+
registersNextPlugin: boolean;
|
|
15
|
+
/** Extends `next` or a `next/*` config through FlatCompat, as Nx generated for earlier Next.js versions. */
|
|
16
|
+
extendsNextThroughCompat: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function getEslintConfigNextUsage(source: ts.SourceFile): EslintConfigNextUsage;
|
|
19
|
+
/**
|
|
20
|
+
* Whether a flat config sets up Next.js linting in any form: a load of an
|
|
21
|
+
* eslint-config-next entry with Next.js rules or of `@next/eslint-plugin-next`,
|
|
22
|
+
* a `@next/next` plugin registration, a FlatCompat extend of such a `next`
|
|
23
|
+
* config, or a string starting with `@next/next/`, such as a rule name.
|
|
24
|
+
*/
|
|
25
|
+
export declare function configuresNextLint(source: ts.SourceFile): boolean;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFlatConfig = parseFlatConfig;
|
|
4
|
+
exports.getModuleBindings = getModuleBindings;
|
|
5
|
+
exports.getImports = getImports;
|
|
6
|
+
exports.getPropertyName = getPropertyName;
|
|
7
|
+
exports.getLoadedModuleSpecifier = getLoadedModuleSpecifier;
|
|
8
|
+
exports.getEslintConfigNextUsage = getEslintConfigNextUsage;
|
|
9
|
+
exports.configuresNextLint = configuresNextLint;
|
|
10
|
+
const internal_1 = require("@nx/js/internal");
|
|
11
|
+
// Loaded by parseFlatConfig. The other helpers only take nodes it produced.
|
|
12
|
+
let tsModule;
|
|
13
|
+
function parseFlatConfig(content) {
|
|
14
|
+
tsModule ??= (0, internal_1.ensureTypescript)();
|
|
15
|
+
return tsModule.createSourceFile('', content, tsModule.ScriptTarget.Latest, true, tsModule.ScriptKind.TS);
|
|
16
|
+
}
|
|
17
|
+
function getModuleBindings(source) {
|
|
18
|
+
const bindings = new Map();
|
|
19
|
+
for (const statement of source.statements) {
|
|
20
|
+
for (const { module, names } of getImports(statement)) {
|
|
21
|
+
names.forEach((name) => bindings.set(name, module));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return bindings;
|
|
25
|
+
}
|
|
26
|
+
function getImports(statement) {
|
|
27
|
+
if (tsModule.isImportDeclaration(statement)) {
|
|
28
|
+
const clause = statement.importClause;
|
|
29
|
+
if (!clause || !tsModule.isStringLiteral(statement.moduleSpecifier)) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
const names = clause.name ? [clause.name.text] : [];
|
|
33
|
+
if (clause.namedBindings) {
|
|
34
|
+
if (tsModule.isNamespaceImport(clause.namedBindings)) {
|
|
35
|
+
names.push(clause.namedBindings.name.text);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
names.push(...clause.namedBindings.elements.map((element) => element.name.text));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return [{ module: statement.moduleSpecifier.text, names }];
|
|
42
|
+
}
|
|
43
|
+
if (tsModule.isVariableStatement(statement) &&
|
|
44
|
+
statement.declarationList.declarations.length === 1) {
|
|
45
|
+
const [declaration] = statement.declarationList.declarations;
|
|
46
|
+
const initializer = declaration.initializer;
|
|
47
|
+
if (!initializer ||
|
|
48
|
+
!tsModule.isCallExpression(initializer) ||
|
|
49
|
+
!tsModule.isIdentifier(initializer.expression) ||
|
|
50
|
+
initializer.expression.text !== 'require' ||
|
|
51
|
+
initializer.arguments.length !== 1 ||
|
|
52
|
+
!tsModule.isStringLiteral(initializer.arguments[0])) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
module: initializer.arguments[0].text,
|
|
58
|
+
names: getBoundNames(declaration.name),
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
function getBoundNames(name) {
|
|
65
|
+
if (tsModule.isIdentifier(name)) {
|
|
66
|
+
return [name.text];
|
|
67
|
+
}
|
|
68
|
+
const names = [];
|
|
69
|
+
for (const element of name.elements) {
|
|
70
|
+
if (!tsModule.isOmittedExpression(element)) {
|
|
71
|
+
names.push(...getBoundNames(element.name));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return names;
|
|
75
|
+
}
|
|
76
|
+
function getPropertyName(name) {
|
|
77
|
+
return tsModule.isIdentifier(name) ||
|
|
78
|
+
tsModule.isStringLiteral(name) ||
|
|
79
|
+
tsModule.isNoSubstitutionTemplateLiteral(name)
|
|
80
|
+
? name.text
|
|
81
|
+
: undefined;
|
|
82
|
+
}
|
|
83
|
+
// The specifier of an import, re-export, `require`, `import x = require()` or
|
|
84
|
+
// `import()` that loads a module at runtime. Type-only imports and exports are
|
|
85
|
+
// erased before it runs.
|
|
86
|
+
function getLoadedModuleSpecifier(node) {
|
|
87
|
+
let specifier;
|
|
88
|
+
if (tsModule.isImportDeclaration(node)) {
|
|
89
|
+
specifier = node.importClause?.isTypeOnly
|
|
90
|
+
? undefined
|
|
91
|
+
: node.moduleSpecifier;
|
|
92
|
+
}
|
|
93
|
+
else if (tsModule.isExportDeclaration(node)) {
|
|
94
|
+
specifier = node.isTypeOnly ? undefined : node.moduleSpecifier;
|
|
95
|
+
}
|
|
96
|
+
else if (tsModule.isImportEqualsDeclaration(node) &&
|
|
97
|
+
tsModule.isExternalModuleReference(node.moduleReference)) {
|
|
98
|
+
specifier = node.isTypeOnly ? undefined : node.moduleReference.expression;
|
|
99
|
+
}
|
|
100
|
+
else if (tsModule.isCallExpression(node) &&
|
|
101
|
+
node.arguments.length === 1 &&
|
|
102
|
+
((tsModule.isIdentifier(node.expression) &&
|
|
103
|
+
node.expression.text === 'require') ||
|
|
104
|
+
node.expression.kind === tsModule.SyntaxKind.ImportKeyword)) {
|
|
105
|
+
specifier = node.arguments[0];
|
|
106
|
+
}
|
|
107
|
+
return specifier && tsModule.isStringLiteralLike(specifier)
|
|
108
|
+
? specifier.text
|
|
109
|
+
: undefined;
|
|
110
|
+
}
|
|
111
|
+
function getEslintConfigNextUsage(source) {
|
|
112
|
+
const usage = {
|
|
113
|
+
importsEslintConfigNext: false,
|
|
114
|
+
registersNextPlugin: false,
|
|
115
|
+
extendsNextThroughCompat: false,
|
|
116
|
+
};
|
|
117
|
+
const visit = (node) => {
|
|
118
|
+
if (isEslintConfigNextSpecifier(getLoadedModuleSpecifier(node))) {
|
|
119
|
+
usage.importsEslintConfigNext = true;
|
|
120
|
+
}
|
|
121
|
+
else if (isPluginsObjectWithKey(node, '@next/next')) {
|
|
122
|
+
usage.registersNextPlugin = true;
|
|
123
|
+
}
|
|
124
|
+
else if (isCompatCallExtendingNext(node)) {
|
|
125
|
+
usage.extendsNextThroughCompat = true;
|
|
126
|
+
}
|
|
127
|
+
tsModule.forEachChild(node, visit);
|
|
128
|
+
};
|
|
129
|
+
visit(source);
|
|
130
|
+
return usage;
|
|
131
|
+
}
|
|
132
|
+
// eslint-config-next entries without Next.js rules, with v15's file spellings.
|
|
133
|
+
const ESLINT_CONFIG_NEXT_ENTRIES_WITHOUT_NEXT_RULES = new Set([
|
|
134
|
+
'eslint-config-next/typescript',
|
|
135
|
+
'eslint-config-next/typescript.js',
|
|
136
|
+
'eslint-config-next/parser',
|
|
137
|
+
'eslint-config-next/parser.js',
|
|
138
|
+
]);
|
|
139
|
+
/**
|
|
140
|
+
* Whether a flat config sets up Next.js linting in any form: a load of an
|
|
141
|
+
* eslint-config-next entry with Next.js rules or of `@next/eslint-plugin-next`,
|
|
142
|
+
* a `@next/next` plugin registration, a FlatCompat extend of such a `next`
|
|
143
|
+
* config, or a string starting with `@next/next/`, such as a rule name.
|
|
144
|
+
*/
|
|
145
|
+
function configuresNextLint(source) {
|
|
146
|
+
let found = false;
|
|
147
|
+
const visit = (node) => {
|
|
148
|
+
if (found) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const specifier = getLoadedModuleSpecifier(node);
|
|
152
|
+
if ((isEslintConfigNextSpecifier(specifier) &&
|
|
153
|
+
!ESLINT_CONFIG_NEXT_ENTRIES_WITHOUT_NEXT_RULES.has(specifier)) ||
|
|
154
|
+
specifier === '@next/eslint-plugin-next' ||
|
|
155
|
+
specifier?.startsWith('@next/eslint-plugin-next/') ||
|
|
156
|
+
isPluginsObjectWithKey(node, '@next/next') ||
|
|
157
|
+
isCompatCallExtendingNext(node, isNextConfigNameWithNextRules) ||
|
|
158
|
+
(tsModule.isStringLiteralLike(node) &&
|
|
159
|
+
node.text.startsWith('@next/next/'))) {
|
|
160
|
+
found = true;
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
tsModule.forEachChild(node, visit);
|
|
164
|
+
};
|
|
165
|
+
visit(source);
|
|
166
|
+
return found;
|
|
167
|
+
}
|
|
168
|
+
function isPluginsObjectWithKey(node, key) {
|
|
169
|
+
return (tsModule.isPropertyAssignment(node) &&
|
|
170
|
+
getPropertyName(node.name) === 'plugins' &&
|
|
171
|
+
tsModule.isObjectLiteralExpression(node.initializer) &&
|
|
172
|
+
node.initializer.properties.some((property) => property.name && getPropertyName(property.name) === key));
|
|
173
|
+
}
|
|
174
|
+
// Matches `compat.extends('next', ...)` and `compat.config({ extends: ['next'] })`.
|
|
175
|
+
function isCompatCallExtendingNext(node, isConfigName = isNextConfigName) {
|
|
176
|
+
if (!tsModule.isCallExpression(node) ||
|
|
177
|
+
!tsModule.isPropertyAccessExpression(node.expression)) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
switch (node.expression.name.text) {
|
|
181
|
+
case 'extends':
|
|
182
|
+
return node.arguments.some(isConfigName);
|
|
183
|
+
case 'config':
|
|
184
|
+
return node.arguments.some((argument) => tsModule.isObjectLiteralExpression(argument) &&
|
|
185
|
+
argument.properties.some((property) => tsModule.isPropertyAssignment(property) &&
|
|
186
|
+
getPropertyName(property.name) === 'extends' &&
|
|
187
|
+
(isConfigName(property.initializer) ||
|
|
188
|
+
(tsModule.isArrayLiteralExpression(property.initializer) &&
|
|
189
|
+
property.initializer.elements.some(isConfigName)))));
|
|
190
|
+
default:
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function isEslintConfigNextSpecifier(specifier) {
|
|
195
|
+
return (specifier === 'eslint-config-next' ||
|
|
196
|
+
!!specifier?.startsWith('eslint-config-next/'));
|
|
197
|
+
}
|
|
198
|
+
function isNextConfigName(node) {
|
|
199
|
+
return (tsModule.isStringLiteralLike(node) &&
|
|
200
|
+
(node.text === 'next' || node.text.startsWith('next/')));
|
|
201
|
+
}
|
|
202
|
+
// ESLint resolves an eslintrc `next/<name>` to `eslint-config-next/<name>`.
|
|
203
|
+
function isNextConfigNameWithNextRules(node) {
|
|
204
|
+
return (isNextConfigName(node) &&
|
|
205
|
+
!ESLINT_CONFIG_NEXT_ENTRIES_WITHOUT_NEXT_RULES.has(node.text.replace(/^next\//, 'eslint-config-next/')));
|
|
206
|
+
}
|
|
@@ -4,10 +4,10 @@ export declare const next16Version = "~16.4.1";
|
|
|
4
4
|
export declare const next15Version = "~15.5.28";
|
|
5
5
|
export declare const next14Version = "~14.2.35";
|
|
6
6
|
export declare const nextVersion = "~16.4.1";
|
|
7
|
-
export declare const eslintConfigNext16Version = "^16.
|
|
7
|
+
export declare const eslintConfigNext16Version = "^16.4.0";
|
|
8
8
|
export declare const eslintConfigNext15Version = "^15.5.18";
|
|
9
9
|
export declare const eslintConfigNext14Version = "^15.5.18";
|
|
10
|
-
export declare const eslintConfigNextVersion = "^16.
|
|
10
|
+
export declare const eslintConfigNextVersion = "^16.4.0";
|
|
11
11
|
export declare const sassVersion = "1.97.2";
|
|
12
12
|
export declare const tsLibVersion = "^2.3.0";
|
|
13
13
|
export declare const svgrWebpackVersion = "^8.0.1";
|
|
@@ -8,7 +8,7 @@ exports.next16Version = '~16.4.1';
|
|
|
8
8
|
exports.next15Version = '~15.5.28';
|
|
9
9
|
exports.next14Version = '~14.2.35';
|
|
10
10
|
exports.nextVersion = exports.next16Version;
|
|
11
|
-
exports.eslintConfigNext16Version = '^16.
|
|
11
|
+
exports.eslintConfigNext16Version = '^16.4.0';
|
|
12
12
|
exports.eslintConfigNext15Version = '^15.5.18';
|
|
13
13
|
// eslint-config-next 14 lacks ESLint v9 support, so Next.js 14 (being removed) uses 15.
|
|
14
14
|
exports.eslintConfigNext14Version = '^15.5.18';
|
package/migrations.json
CHANGED
|
@@ -47,6 +47,17 @@
|
|
|
47
47
|
"version": "24.0.0-beta.3",
|
|
48
48
|
"description": "Migrate deprecated next configuration helpers while preserving custom behavior.",
|
|
49
49
|
"prompt": "./dist/src/migrations/update-24-0-0/migrate-config-helpers.md"
|
|
50
|
+
},
|
|
51
|
+
"update-24-1-0-spread-eslint-config-next": {
|
|
52
|
+
"version": "24.1.0-beta.2",
|
|
53
|
+
"requires": {
|
|
54
|
+
"next": ">=16.0.0",
|
|
55
|
+
"eslint": ">=10.0.0",
|
|
56
|
+
"eslint-config-next": ">=16.4.0"
|
|
57
|
+
},
|
|
58
|
+
"description": "Replaces the Next.js entries Nx generated in flat ESLint configs, the `@next/next` plugin registration or the `next` configs extended through FlatCompat, with a spread of `eslint-config-next/core-web-vitals`.",
|
|
59
|
+
"implementation": "./dist/src/migrations/update-24-1-0/spread-eslint-config-next",
|
|
60
|
+
"documentation": "./dist/src/migrations/update-24-1-0/spread-eslint-config-next.md"
|
|
50
61
|
}
|
|
51
62
|
},
|
|
52
63
|
"packageJsonUpdates": {
|
|
@@ -122,6 +133,59 @@
|
|
|
122
133
|
"alwaysAddToPackageJson": false
|
|
123
134
|
}
|
|
124
135
|
}
|
|
136
|
+
},
|
|
137
|
+
"24.1.0-eslint-config-next": {
|
|
138
|
+
"version": "24.1.0-beta.2",
|
|
139
|
+
"requires": {
|
|
140
|
+
"eslint-config-next": ">=16.0.0 <16.4.0"
|
|
141
|
+
},
|
|
142
|
+
"packages": {
|
|
143
|
+
"eslint-config-next": {
|
|
144
|
+
"version": "^16.4.0",
|
|
145
|
+
"alwaysAddToPackageJson": false
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"24.1.0-@next/eslint-plugin-next-14": {
|
|
150
|
+
"version": "24.1.0-beta.2",
|
|
151
|
+
"requires": {
|
|
152
|
+
"@next/eslint-plugin-next": ">=14.0.0 <15.0.0",
|
|
153
|
+
"next": ">=16.0.0",
|
|
154
|
+
"eslint": ">=10.0.0"
|
|
155
|
+
},
|
|
156
|
+
"packages": {
|
|
157
|
+
"@next/eslint-plugin-next": {
|
|
158
|
+
"version": "^16.4.0",
|
|
159
|
+
"alwaysAddToPackageJson": false
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"24.1.0-@next/eslint-plugin-next-15": {
|
|
164
|
+
"version": "24.1.0-beta.2",
|
|
165
|
+
"requires": {
|
|
166
|
+
"@next/eslint-plugin-next": ">=15.0.0 <16.0.0",
|
|
167
|
+
"next": ">=16.0.0",
|
|
168
|
+
"eslint": ">=10.0.0"
|
|
169
|
+
},
|
|
170
|
+
"packages": {
|
|
171
|
+
"@next/eslint-plugin-next": {
|
|
172
|
+
"version": "^16.4.0",
|
|
173
|
+
"alwaysAddToPackageJson": false
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"24.1.0-@next/eslint-plugin-next": {
|
|
178
|
+
"version": "24.1.0-beta.2",
|
|
179
|
+
"requires": {
|
|
180
|
+
"@next/eslint-plugin-next": ">=16.0.0 <16.4.0",
|
|
181
|
+
"eslint": ">=10.0.0"
|
|
182
|
+
},
|
|
183
|
+
"packages": {
|
|
184
|
+
"@next/eslint-plugin-next": {
|
|
185
|
+
"version": "^16.4.0",
|
|
186
|
+
"alwaysAddToPackageJson": false
|
|
187
|
+
}
|
|
188
|
+
}
|
|
125
189
|
}
|
|
126
190
|
}
|
|
127
191
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "24.1.0-beta.
|
|
3
|
+
"version": "24.1.0-beta.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Next.js plugin for Nx infers tasks and provides generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Playwright, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"next": ">=14.0.0 <17.0.0",
|
|
74
|
-
"@nx/webpack": "24.1.0-beta.
|
|
74
|
+
"@nx/webpack": "24.1.0-beta.2"
|
|
75
75
|
},
|
|
76
76
|
"peerDependenciesMeta": {
|
|
77
77
|
"@nx/webpack": {
|
|
@@ -79,26 +79,26 @@
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@nx/devkit": "24.1.0-beta.
|
|
82
|
+
"@nx/devkit": "24.1.0-beta.2",
|
|
83
83
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
84
84
|
"copy-webpack-plugin": "^14.0.0",
|
|
85
85
|
"ignore": "^7.0.5",
|
|
86
86
|
"semver": "^7.6.3",
|
|
87
87
|
"tslib": "^2.3.0",
|
|
88
88
|
"webpack-merge": "^5.8.0",
|
|
89
|
-
"@nx/js": "24.1.0-beta.
|
|
90
|
-
"@nx/eslint": "24.1.0-beta.
|
|
91
|
-
"@nx/react": "24.1.0-beta.
|
|
92
|
-
"@nx/web": "24.1.0-beta.
|
|
89
|
+
"@nx/js": "24.1.0-beta.2",
|
|
90
|
+
"@nx/eslint": "24.1.0-beta.2",
|
|
91
|
+
"@nx/react": "24.1.0-beta.2",
|
|
92
|
+
"@nx/web": "24.1.0-beta.2",
|
|
93
93
|
"@phenomnomnominal/tsquery": "~6.2.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@nx/cypress": "24.1.0-beta.
|
|
97
|
-
"@nx/playwright": "24.1.0-beta.
|
|
98
|
-
"@nx/vitest": "24.1.0-beta.
|
|
99
|
-
"@nx/webpack": "24.1.0-beta.
|
|
96
|
+
"@nx/cypress": "24.1.0-beta.2",
|
|
97
|
+
"@nx/playwright": "24.1.0-beta.2",
|
|
98
|
+
"@nx/vitest": "24.1.0-beta.2",
|
|
99
|
+
"@nx/webpack": "24.1.0-beta.2",
|
|
100
100
|
"next": "15.5.28",
|
|
101
|
-
"nx": "24.1.0-beta.
|
|
101
|
+
"nx": "24.1.0-beta.2"
|
|
102
102
|
},
|
|
103
103
|
"publishConfig": {
|
|
104
104
|
"access": "public"
|