@nx/next 23.2.0-beta.5 → 23.2.0-beta.7

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.
@@ -1,4 +1,4 @@
1
- export async function GET(request: Request) {
1
+ export async function GET(_request: Request) {
2
2
  return new Response('Hello, from API!')
3
3
  }
4
4
 
@@ -1,3 +1,5 @@
1
+ /* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
2
+ are inline SVGs, which have no tag to swap the role for. */
1
3
  <%_ if (style !== 'none') { var wrapper = 'div'; _%>
2
4
  import styles from './page.module.<%= style %>';
3
5
  <% } else { var wrapper = 'div'; } %>
@@ -1,3 +1,5 @@
1
+ /* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
2
+ are inline SVGs, which have no tag to swap the role for. */
1
3
  <%_ if (style !== 'none') { var wrapper = 'div'; _%>
2
4
  import styles from './<%= fileName %>.module.<%= style %>';
3
5
  <% } else { var wrapper = 'div'; } %>
@@ -47,7 +47,6 @@ async function addE2e(host, options) {
47
47
  }
48
48
  const e2eTask = await configurationGenerator(host, {
49
49
  ...options,
50
- linter: 'eslint',
51
50
  project: options.e2eProjectName,
52
51
  directory: 'src',
53
52
  skipFormat: true,
@@ -1,27 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addLinting = addLinting;
4
- const eslint_1 = require("@nx/eslint");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const react_1 = require("@nx/react");
7
6
  const internal_1 = require("@nx/eslint/internal");
8
7
  const version_utils_1 = require("../../../utils/version-utils");
8
+ const internal_2 = require("@nx/js/internal");
9
9
  async function addLinting(host, options) {
10
- if (options.linter !== 'eslint')
11
- return () => { };
12
10
  const tasks = [];
13
- tasks.push(await (0, eslint_1.lintProjectGenerator)(host, {
11
+ tasks.push(await (0, internal_2.addLintingToProject)(host, {
12
+ oxlintPlugins: ['nextjs', 'react', 'react-perf', 'jsx-a11y'],
14
13
  linter: options.linter,
15
14
  project: options.projectName,
16
15
  tsConfigPaths: [
17
16
  (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
18
17
  ],
19
18
  unitTestRunner: options.unitTestRunner,
20
- skipFormat: true,
21
19
  rootProject: options.rootProject,
22
20
  enableTypedLinting: (0, internal_1.isTypedLintingEnabled)(options),
23
21
  addPlugin: options.addPlugin,
22
+ skipPackageJson: options.skipPackageJson,
24
23
  }));
24
+ // Everything below configures ESLint — predefined configs, `extends`, ignore
25
+ // entries — which have no equivalent in other linters.
25
26
  if (options.linter === 'eslint' && (0, internal_1.isEslintConfigSupported)(host)) {
26
27
  if ((0, internal_1.useFlatConfig)(host)) {
27
28
  (0, internal_1.addPredefinedConfigToFlatLintConfig)(host, options.appProjectRoot, 'flat/react-typescript', { checkBaseConfig: true });
@@ -67,7 +68,7 @@ async function addLinting(host, options) {
67
68
  ...(options.isTsSolutionSetup ? ['**/out-tsc'] : []),
68
69
  ]);
69
70
  }
70
- if (!options.skipPackageJson) {
71
+ if (options.linter === 'eslint' && !options.skipPackageJson) {
71
72
  const eslintConfigNextVersion = await (0, version_utils_1.getEslintConfigNextDependenciesVersionsToInstall)(host);
72
73
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, react_1.extraEslintDependencies.dependencies, {
73
74
  ...react_1.extraEslintDependencies.devDependencies,
@@ -39,7 +39,7 @@ async function normalizeOptions(host, options) {
39
39
  e2eProjectRoot,
40
40
  e2eTestRunner: options.e2eTestRunner || 'playwright',
41
41
  fileName,
42
- linter: options.linter || 'eslint',
42
+ linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
43
43
  outputPath,
44
44
  parsedTags,
45
45
  projectName: appProjectName,
@@ -1,4 +1,4 @@
1
- import type { Linter, LinterType } from '@nx/eslint';
1
+ import type { LinterType } from '@nx/js';
2
2
  import type { SupportedStyles } from '@nx/react';
3
3
 
4
4
  export interface Schema {
@@ -9,7 +9,7 @@ export interface Schema {
9
9
  tags?: string;
10
10
  unitTestRunner?: 'jest' | 'none';
11
11
  e2eTestRunner?: 'cypress' | 'playwright' | 'none';
12
- linter?: Linter | LinterType;
12
+ linter?: LinterType;
13
13
  js?: boolean;
14
14
  enableTypedLinting?: boolean;
15
15
  /**
@@ -48,11 +48,9 @@
48
48
  }
49
49
  },
50
50
  "linter": {
51
- "description": "The tool to use for running lint checks.",
51
+ "description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
52
52
  "type": "string",
53
- "enum": ["eslint", "none"],
54
- "default": "none",
55
- "x-prompt": "Which linter would you like to use?",
53
+ "enum": ["eslint", "oxlint", "none"],
56
54
  "x-priority": "important"
57
55
  },
58
56
  "skipFormat": {
@@ -1,6 +1,8 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { Schema } from '../schema';
3
+ import type { LinterType } from '@nx/js';
3
4
  export interface NormalizedSchema extends Schema {
5
+ linter: LinterType;
4
6
  importPath: string;
5
7
  projectRoot: string;
6
8
  isUsingTsSolutionConfig: boolean;
@@ -19,6 +19,9 @@ async function normalizeOptions(host, options) {
19
19
  const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
20
20
  return {
21
21
  ...options,
22
+ // Resolved after the spread: the framework's ESLint shaping is guarded on
23
+ // `=== 'eslint'`, and an unresolved `undefined` would skip all of it.
24
+ linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
22
25
  importPath,
23
26
  projectRoot,
24
27
  isUsingTsSolutionConfig,
@@ -1,4 +1,4 @@
1
- import type { Linter, LinterType } from '@nx/eslint';
1
+ import type { LinterType } from '@nx/js';
2
2
  import type { SupportedStyles } from '@nx/react';
3
3
 
4
4
  export interface Schema {
@@ -11,7 +11,7 @@ export interface Schema {
11
11
  routing?: boolean;
12
12
  appProject?: string;
13
13
  unitTestRunner: 'jest' | 'vitest' | 'none';
14
- linter: Linter | LinterType;
14
+ linter?: LinterType;
15
15
  component?: boolean;
16
16
  publishable?: boolean;
17
17
  /** @deprecated Use bundler instead. */
@@ -56,11 +56,9 @@
56
56
  "x-priority": "important"
57
57
  },
58
58
  "linter": {
59
- "description": "The tool to use for running lint checks.",
59
+ "description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
60
60
  "type": "string",
61
- "enum": ["eslint", "none"],
62
- "default": "none",
63
- "x-prompt": "Which linter would you like to use?",
61
+ "enum": ["eslint", "oxlint", "none"],
64
62
  "x-priority": "important"
65
63
  },
66
64
  "unitTestRunner": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/next",
3
- "version": "23.2.0-beta.5",
3
+ "version": "23.2.0-beta.7",
4
4
  "private": false,
5
5
  "description": "The Next.js plugin for Nx contains executors and 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": {
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "peerDependencies": {
70
70
  "next": ">=14.0.0 <17.0.0",
71
- "@nx/webpack": "23.2.0-beta.5"
71
+ "@nx/webpack": "23.2.0-beta.7"
72
72
  },
73
73
  "peerDependenciesMeta": {
74
74
  "@nx/webpack": {
@@ -83,17 +83,17 @@
83
83
  "tslib": "^2.3.0",
84
84
  "webpack-merge": "^5.8.0",
85
85
  "@phenomnomnominal/tsquery": "~6.2.0",
86
- "@nx/devkit": "23.2.0-beta.5",
87
- "@nx/js": "23.2.0-beta.5",
88
- "@nx/eslint": "23.2.0-beta.5",
89
- "@nx/react": "23.2.0-beta.5",
90
- "@nx/web": "23.2.0-beta.5"
86
+ "@nx/devkit": "23.2.0-beta.7",
87
+ "@nx/js": "23.2.0-beta.7",
88
+ "@nx/eslint": "23.2.0-beta.7",
89
+ "@nx/react": "23.2.0-beta.7",
90
+ "@nx/web": "23.2.0-beta.7"
91
91
  },
92
92
  "devDependencies": {
93
- "@nx/cypress": "23.2.0-beta.5",
94
- "@nx/playwright": "23.2.0-beta.5",
95
- "@nx/webpack": "23.2.0-beta.5",
96
- "nx": "23.2.0-beta.5"
93
+ "@nx/cypress": "23.2.0-beta.7",
94
+ "@nx/playwright": "23.2.0-beta.7",
95
+ "@nx/webpack": "23.2.0-beta.7",
96
+ "nx": "23.2.0-beta.7"
97
97
  },
98
98
  "publishConfig": {
99
99
  "access": "public"