@nx/nuxt 23.2.0-beta.2 → 23.2.0-beta.4

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.
@@ -4,6 +4,7 @@ exports.applicationGenerator = applicationGenerator;
4
4
  exports.applicationGeneratorInternal = applicationGeneratorInternal;
5
5
  const tslib_1 = require("tslib");
6
6
  const internal_1 = require("@nx/devkit/internal");
7
+ const internal_2 = require("@nx/eslint/internal");
7
8
  const devkit_1 = require("@nx/devkit");
8
9
  const init_1 = tslib_1.__importDefault(require("../init/init"));
9
10
  const normalize_options_1 = require("./lib/normalize-options");
@@ -20,7 +21,7 @@ const node_child_process_1 = require("node:child_process");
20
21
  const node_fs_1 = require("node:fs");
21
22
  const node_path_1 = require("node:path");
22
23
  const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
23
- const internal_2 = require("@nx/js/internal");
24
+ const internal_3 = require("@nx/js/internal");
24
25
  async function applicationGenerator(tree, schema) {
25
26
  return await applicationGeneratorInternal(tree, {
26
27
  useProjectJson: true,
@@ -30,7 +31,7 @@ async function applicationGenerator(tree, schema) {
30
31
  async function applicationGeneratorInternal(tree, schema) {
31
32
  (0, assert_supported_nuxt_version_1.assertSupportedNuxtVersion)(tree);
32
33
  const tasks = [];
33
- const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(tree, true, // nuxt always adds plugins
34
+ const addTsPlugin = (0, internal_3.shouldConfigureTsSolutionSetup)(tree, true, // nuxt always adds plugins
34
35
  schema.useTsSolution);
35
36
  const jsInitTask = await (0, js_1.initGenerator)(tree, {
36
37
  ...schema,
@@ -115,7 +116,7 @@ async function applicationGeneratorInternal(tree, schema) {
115
116
  // If we are using the new TS solution
116
117
  // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
117
118
  if (options.isUsingTsSolutionConfig) {
118
- await (0, internal_2.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
119
+ await (0, internal_3.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
119
120
  }
120
121
  tasks.push(await (0, add_linting_1.addLinting)(tree, {
121
122
  projectName: options.projectName,
@@ -123,6 +124,7 @@ async function applicationGeneratorInternal(tree, schema) {
123
124
  linter: options.linter ?? 'eslint',
124
125
  unitTestRunner: options.unitTestRunner,
125
126
  rootProject: options.rootProject,
127
+ enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
126
128
  }));
127
129
  if (options.unitTestRunner === 'vitest') {
128
130
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
@@ -140,7 +142,7 @@ async function applicationGeneratorInternal(tree, schema) {
140
142
  if (options.js)
141
143
  (0, devkit_1.toJS)(tree);
142
144
  if (options.isUsingTsSolutionConfig) {
143
- (0, internal_2.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
145
+ (0, internal_3.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
144
146
  jsx: 'preserve',
145
147
  jsxImportSource: 'vue',
146
148
  module: 'esnext',
@@ -150,7 +152,7 @@ async function applicationGeneratorInternal(tree, schema) {
150
152
  ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
151
153
  : undefined);
152
154
  }
153
- (0, internal_2.sortPackageJsonFields)(tree, options.appProjectRoot);
155
+ (0, internal_3.sortPackageJsonFields)(tree, options.appProjectRoot);
154
156
  if (!options.skipFormat)
155
157
  await (0, devkit_1.formatFiles)(tree);
156
158
  tasks.push(() => {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addE2e = addE2e;
4
4
  const internal_1 = require("@nx/devkit/internal");
5
+ const internal_2 = require("@nx/eslint/internal");
5
6
  const devkit_1 = require("@nx/devkit");
6
7
  const versions_1 = require("../../../utils/versions");
7
8
  async function addE2e(host, options) {
@@ -80,7 +81,7 @@ async function addE2e(host, options) {
80
81
  directory: 'src',
81
82
  js: false,
82
83
  linter: options.linter,
83
- setParserOptionsProject: options.setParserOptionsProject,
84
+ enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
84
85
  webServerAddress: e2eWebServerInfo.e2eCiBaseUrl,
85
86
  webServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
86
87
  addPlugin: true,
@@ -12,6 +12,10 @@ export interface Schema {
12
12
  js?: boolean;
13
13
  skipPackageJson?: boolean;
14
14
  rootProject?: boolean;
15
+ enableTypedLinting?: boolean;
16
+ /**
17
+ * @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
18
+ */
15
19
  setParserOptionsProject?: boolean;
16
20
  style?: 'css' | 'scss' | 'none';
17
21
  nxCloudToken?: string;
@@ -99,11 +99,17 @@
99
99
  ]
100
100
  }
101
101
  },
102
- "setParserOptionsProject": {
102
+ "enableTypedLinting": {
103
103
  "type": "boolean",
104
- "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
104
+ "description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
105
105
  "default": false
106
106
  },
107
+ "setParserOptionsProject": {
108
+ "type": "boolean",
109
+ "description": "Deprecated alias for `enableTypedLinting`.",
110
+ "default": false,
111
+ "x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
112
+ },
107
113
  "useProjectJson": {
108
114
  "type": "boolean",
109
115
  "description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
@@ -7,4 +7,9 @@ export declare function addLinting(host: Tree, options: {
7
7
  projectRoot: string;
8
8
  unitTestRunner?: 'vitest' | 'none';
9
9
  rootProject?: boolean;
10
+ enableTypedLinting?: boolean;
11
+ /**
12
+ * @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
13
+ */
14
+ setParserOptionsProject?: boolean;
10
15
  }): Promise<GeneratorCallback>;
@@ -9,6 +9,7 @@ const versions_1 = require("./versions");
9
9
  async function addLinting(host, options) {
10
10
  const tasks = [];
11
11
  if (options.linter === 'eslint') {
12
+ const enableTypedLinting = (0, internal_1.isTypedLintingEnabled)(options);
12
13
  const lintTask = await (0, eslint_1.lintProjectGenerator)(host, {
13
14
  linter: options.linter,
14
15
  project: options.projectName,
@@ -16,6 +17,7 @@ async function addLinting(host, options) {
16
17
  unitTestRunner: options.unitTestRunner,
17
18
  skipFormat: true,
18
19
  rootProject: options.rootProject,
20
+ enableTypedLinting,
19
21
  addPlugin: true,
20
22
  });
21
23
  tasks.push(lintTask);
@@ -30,8 +32,11 @@ async function addLinting(host, options) {
30
32
  };
31
33
  if ((0, internal_1.isEslintConfigSupported)(host, options.projectRoot)) {
32
34
  if (isFlatConfig) {
33
- // For flat config: Generate eslint.config.mjs using createConfigForNuxt
34
- generateNuxtFlatEslintConfig(host, options.projectRoot);
35
+ // For flat config: Generate eslint.config.mjs using createConfigForNuxt.
36
+ // Pass `enableTypedLinting` so the projectService block is inlined into
37
+ // the template (the file's top-level export is a call expression chain,
38
+ // not an array literal, so post-hoc AST insertion doesn't work).
39
+ generateNuxtFlatEslintConfig(host, options.projectRoot, enableTypedLinting);
35
40
  }
36
41
  else {
37
42
  // For legacy: Use extends with the old @nuxt/eslint-config
@@ -54,7 +59,7 @@ async function addLinting(host, options) {
54
59
  * Generates a flat ESLint config for Nuxt using createConfigForNuxt from @nuxt/eslint-config/flat.
55
60
  * This is the recommended approach for Nuxt v4+ and ESLint flat config.
56
61
  */
57
- function generateNuxtFlatEslintConfig(tree, projectRoot) {
62
+ function generateNuxtFlatEslintConfig(tree, projectRoot, enableTypedLinting) {
58
63
  const eslintFile = (0, internal_1.findEslintFile)(tree, projectRoot);
59
64
  if (!eslintFile)
60
65
  return;
@@ -65,6 +70,21 @@ function generateNuxtFlatEslintConfig(tree, projectRoot) {
65
70
  const depth = projectRoot.split('/').filter(Boolean).length;
66
71
  const rootConfigRelativePath = depth > 0 ? '../'.repeat(depth) : './';
67
72
  let configContent;
73
+ const typedLintingBlock = enableTypedLinting
74
+ ? `
75
+ {
76
+ files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'],
77
+ languageOptions: {
78
+ parserOptions: {
79
+ projectService: true,
80
+ // \`projectService\` conflicts with a \`parserOptions.project\` set by any config
81
+ // merged into this one. Remove this once you know none of them set it.
82
+ project: null,
83
+ tsconfigRootDir: ${isCjs ? '__dirname' : 'import.meta.dirname'},
84
+ },
85
+ },
86
+ },`
87
+ : '';
68
88
  if (isCjs) {
69
89
  // CJS flat config
70
90
  configContent = `const { createConfigForNuxt } = require('@nuxt/eslint-config/flat');
@@ -76,7 +96,7 @@ module.exports = createConfigForNuxt({
76
96
  typescript: true,
77
97
  },
78
98
  })${projectRoot !== '.' ? `\n .prepend(...baseConfig)` : ''}
79
- .append(
99
+ .append(${typedLintingBlock}
80
100
  {
81
101
  files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'],
82
102
  rules: {
@@ -100,7 +120,7 @@ export default createConfigForNuxt({
100
120
  typescript: true,
101
121
  },
102
122
  })${projectRoot !== '.' ? `\n .prepend(...baseConfig)` : ''}
103
- .append(
123
+ .append(${typedLintingBlock}
104
124
  {
105
125
  files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'],
106
126
  rules: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/nuxt",
3
- "version": "23.2.0-beta.2",
3
+ "version": "23.2.0-beta.4",
4
4
  "private": false,
5
5
  "description": "The Nuxt plugin for Nx contains executors and generators for managing Nuxt applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -60,20 +60,22 @@
60
60
  "dependencies": {
61
61
  "tslib": "^2.3.0",
62
62
  "semver": "^7.6.3",
63
- "@nx/js": "23.2.0-beta.2",
64
- "@nx/devkit": "23.2.0-beta.2",
65
- "@nx/vue": "23.2.0-beta.2",
66
- "@nx/eslint": "23.2.0-beta.2",
67
- "@nx/vite": "23.2.0-beta.2",
68
- "@nx/vitest": "23.2.0-beta.2"
63
+ "@nx/devkit": "23.2.0-beta.4",
64
+ "@nx/vue": "23.2.0-beta.4",
65
+ "@nx/eslint": "23.2.0-beta.4",
66
+ "@nx/js": "23.2.0-beta.4",
67
+ "@nx/vite": "23.2.0-beta.4",
68
+ "@nx/vitest": "23.2.0-beta.4"
69
69
  },
70
70
  "devDependencies": {
71
- "nx": "23.2.0-beta.2"
71
+ "nx": "23.2.0-beta.4"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "nuxt": ">=3.0.0 <5.0.0",
75
75
  "@nuxt/schema": "^3.0.0 || ^4.0.0",
76
- "@nuxt/kit": "^3.0.0 || ^4.0.0"
76
+ "@nuxt/kit": "^3.0.0 || ^4.0.0",
77
+ "@nx/playwright": "23.2.0-beta.4",
78
+ "@nx/cypress": "23.2.0-beta.4"
77
79
  },
78
80
  "peerDependenciesMeta": {
79
81
  "nuxt": {
@@ -84,6 +86,12 @@
84
86
  },
85
87
  "@nuxt/kit": {
86
88
  "optional": true
89
+ },
90
+ "@nx/cypress": {
91
+ "optional": true
92
+ },
93
+ "@nx/playwright": {
94
+ "optional": true
87
95
  }
88
96
  },
89
97
  "publishConfig": {