@nx/vue 24.1.0-beta.1 → 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.
@@ -0,0 +1,2 @@
1
+ import { type MigrationReturnObject, type Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<MigrationReturnObject>;
@@ -0,0 +1,34 @@
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 posix_1 = require("node:path/posix");
7
+ // eslintrc resolves `plugin:vue/` and `plugin:eslint-plugin-vue/` to the same plugin.
8
+ const VUE3_CONFIG_REFERENCE = /(plugin:(?:eslint-plugin-)?vue\/)vue3-(essential|strongly-recommended|recommended)(?![\w-])/g;
9
+ const VUE3_CONFIG_NAME = /vue3-(?:essential|strongly-recommended|recommended)(?![\w-])/;
10
+ async function update(tree) {
11
+ const remaining = [];
12
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '', (path) => {
13
+ if (!(0, internal_1.isEslintConfigFile)(path) && (0, posix_1.basename)(path) !== 'package.json') {
14
+ return;
15
+ }
16
+ const content = tree.read(path, 'utf-8');
17
+ if (!content?.includes('vue3-')) {
18
+ return;
19
+ }
20
+ const updated = content.replace(VUE3_CONFIG_REFERENCE, '$1$2');
21
+ if (updated !== content) {
22
+ tree.write(path, updated);
23
+ }
24
+ if (VUE3_CONFIG_NAME.test(updated)) {
25
+ remaining.push(path);
26
+ }
27
+ });
28
+ await (0, devkit_1.formatFiles)(tree);
29
+ if (!remaining.length) {
30
+ return { skipAgentic: true };
31
+ }
32
+ const nextSteps = remaining.map((path) => `${path} references an eslint-plugin-vue "vue3-" config in a form the migration does not rewrite. eslint-plugin-vue 10 removed those configs: use the name without the "vue3-" prefix, which targets Vue 3.`);
33
+ return { nextSteps, agentContext: nextSteps };
34
+ }
@@ -0,0 +1,23 @@
1
+ #### Rename the `vue3-` eslint-plugin-vue configs
2
+
3
+ eslint-plugin-vue 10 removed the `vue3-essential`, `vue3-strongly-recommended` and `vue3-recommended` configs. Their Vue 3 rules now ship under `essential`, `strongly-recommended` and `recommended`. The migration renames `plugin:vue/vue3-<name>` and `plugin:eslint-plugin-vue/vue3-<name>` references in eslintrc files, flat configs and the `eslintConfig` field of `package.json` files.
4
+
5
+ It lists ESLint config files that still reference a `vue3-` config in another form, such as `vue.configs['vue3-essential']`, so you can update them by hand.
6
+
7
+ #### Sample code changes
8
+
9
+ ##### Before
10
+
11
+ ```json title="apps/my-app/.eslintrc.json"
12
+ {
13
+ "extends": ["plugin:vue/vue3-essential", "eslint:recommended"]
14
+ }
15
+ ```
16
+
17
+ ##### After
18
+
19
+ ```json title="apps/my-app/.eslintrc.json"
20
+ {
21
+ "extends": ["plugin:vue/essential", "eslint:recommended"]
22
+ }
23
+ ```
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addLinting = addLinting;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const internal_1 = require("@nx/eslint/internal");
5
+ const internal_1 = require("@nx/devkit/internal");
6
+ const internal_2 = require("@nx/eslint/internal");
6
7
  const versions_1 = require("./versions");
7
- const internal_2 = require("@nx/js/internal");
8
+ const internal_3 = require("@nx/js/internal");
8
9
  async function addLinting(host, options, projectType) {
9
10
  const tasks = [];
10
- tasks.push(await (0, internal_2.addLintingToProject)(host, {
11
+ tasks.push(await (0, internal_3.addLintingToProject)(host, {
11
12
  oxlintPlugins: ['vue'],
12
13
  linter: options.linter,
13
14
  project: options.projectName,
@@ -22,11 +23,11 @@ async function addLinting(host, options, projectType) {
22
23
  // Everything below configures ESLint — predefined configs, `extends`, ignore
23
24
  // entries — which have no equivalent in other linters.
24
25
  if (options.linter === 'eslint') {
25
- if ((0, internal_1.useFlatConfig)(host)) {
26
+ if ((0, internal_2.useFlatConfig)(host)) {
26
27
  }
27
28
  else {
28
- const addExtendsTask = (0, internal_1.addExtendsToLintConfig)(host, options.projectRoot, [
29
- 'plugin:vue/vue3-essential',
29
+ const addExtendsTask = (0, internal_2.addExtendsToLintConfig)(host, options.projectRoot, [
30
+ getVueEssentialConfig(host),
30
31
  'eslint:recommended',
31
32
  '@vue/eslint-config-typescript',
32
33
  '@vue/eslint-config-prettier/skip-formatting',
@@ -38,11 +39,13 @@ async function addLinting(host, options, projectType) {
38
39
  '@vue/eslint-config-prettier': versions_1.vueEslintConfigPrettierVersion,
39
40
  '@vue/eslint-config-typescript': versions_1.vueEslintConfigTypescriptVersion,
40
41
  'eslint-plugin-vue': versions_1.eslintPluginVueVersion,
42
+ // eslint-plugin-vue v10 takes its parser as a peer dependency.
43
+ 'vue-eslint-parser': versions_1.vueEslintParserVersion,
41
44
  };
42
- if ((0, internal_1.isEslintConfigSupported)(host, options.projectRoot) &&
43
- (0, internal_1.useFlatConfig)(host)) {
45
+ if ((0, internal_2.isEslintConfigSupported)(host, options.projectRoot) &&
46
+ (0, internal_2.useFlatConfig)(host)) {
44
47
  devDependencies['@typescript-eslint/parser'] =
45
- (0, internal_1.versions)(host).typescriptESLintVersion;
48
+ (0, internal_2.versions)(host).typescriptESLintVersion;
46
49
  }
47
50
  if (!options.skipPackageJson) {
48
51
  const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies, undefined, true);
@@ -51,6 +54,13 @@ async function addLinting(host, options, projectType) {
51
54
  }
52
55
  return (0, devkit_1.runTasksInSerial)(...tasks);
53
56
  }
57
+ // On eslint-plugin-vue 9, `essential` is the Vue 2 config; 10 renamed `vue3-essential` to `essential`.
58
+ function getVueEssentialConfig(tree) {
59
+ const version = (0, internal_1.getResolvedPackageVersion)(tree, 'eslint-plugin-vue', versions_1.eslintPluginVueVersion);
60
+ return version && Number(version.split('.')[0]) < 10
61
+ ? 'plugin:vue/vue3-essential'
62
+ : 'plugin:vue/essential';
63
+ }
54
64
  function editEslintConfigFiles(tree, projectRoot) {
55
65
  const hasVueFiles = (o) => o.files &&
56
66
  (Array.isArray(o.files)
@@ -67,11 +77,11 @@ function editEslintConfigFiles(tree, projectRoot) {
67
77
  o.files = [o.files, '*.vue'];
68
78
  }
69
79
  };
70
- if ((0, internal_1.isEslintConfigSupported)(tree, projectRoot)) {
71
- if ((0, internal_1.useFlatConfig)(tree)) {
72
- (0, internal_1.addPredefinedConfigToFlatLintConfig)(tree, projectRoot, 'flat/recommended', { moduleName: 'vue', moduleImportPath: 'eslint-plugin-vue' });
80
+ if ((0, internal_2.isEslintConfigSupported)(tree, projectRoot)) {
81
+ if ((0, internal_2.useFlatConfig)(tree)) {
82
+ (0, internal_2.addPredefinedConfigToFlatLintConfig)(tree, projectRoot, 'flat/recommended', { moduleName: 'vue', moduleImportPath: 'eslint-plugin-vue' });
73
83
  // This allows .vue files to be parsed
74
- (0, internal_1.addOverrideToLintConfig)(tree, projectRoot, {
84
+ (0, internal_2.addOverrideToLintConfig)(tree, projectRoot, {
75
85
  files: ['**/*.vue'],
76
86
  languageOptions: {
77
87
  parserOptions: {
@@ -81,20 +91,20 @@ function editEslintConfigFiles(tree, projectRoot) {
81
91
  } // languageOptions is not present on eslintrc override, but it is for flat config
82
92
  );
83
93
  // Add an empty rules object to users know how to add/override rules
84
- (0, internal_1.addOverrideToLintConfig)(tree, projectRoot, {
94
+ (0, internal_2.addOverrideToLintConfig)(tree, projectRoot, {
85
95
  files: ['*.ts', '*.tsx', '*.js', '*.jsx', '*.vue'],
86
96
  rules: { 'vue/multi-word-component-names': 'off' },
87
97
  });
88
98
  }
89
99
  else {
90
- if ((0, internal_1.lintConfigHasOverride)(tree, projectRoot, (o) => o.parserOptions && !hasVueFiles(o), true)) {
91
- (0, internal_1.updateOverrideInLintConfig)(tree, projectRoot, (o) => !!o.parserOptions, (o) => {
100
+ if ((0, internal_2.lintConfigHasOverride)(tree, projectRoot, (o) => o.parserOptions && !hasVueFiles(o), true)) {
101
+ (0, internal_2.updateOverrideInLintConfig)(tree, projectRoot, (o) => !!o.parserOptions, (o) => {
92
102
  addVueFiles(o);
93
103
  return o;
94
104
  });
95
105
  }
96
106
  else {
97
- (0, internal_1.replaceOverridesInLintConfig)(tree, projectRoot, [
107
+ (0, internal_2.replaceOverridesInLintConfig)(tree, projectRoot, [
98
108
  {
99
109
  files: ['*.ts', '*.tsx', '*.js', '*.jsx', '*.vue'],
100
110
  rules: { 'vue/multi-word-component-names': 'off' },
@@ -104,11 +114,11 @@ function editEslintConfigFiles(tree, projectRoot) {
104
114
  }
105
115
  }
106
116
  // Edit root config too
107
- if (!(0, internal_1.isEslintConfigSupported)(tree)) {
117
+ if (!(0, internal_2.isEslintConfigSupported)(tree)) {
108
118
  return;
109
119
  }
110
- if ((0, internal_1.lintConfigHasOverride)(tree, '', (o) => o.rules?.['@nx/enforce-module-boundaries'] && !hasVueFiles(o), true)) {
111
- (0, internal_1.updateOverrideInLintConfig)(tree, '', (o) => !!o.rules?.['@nx/enforce-module-boundaries'], (o) => {
120
+ if ((0, internal_2.lintConfigHasOverride)(tree, '', (o) => o.rules?.['@nx/enforce-module-boundaries'] && !hasVueFiles(o), true)) {
121
+ (0, internal_2.updateOverrideInLintConfig)(tree, '', (o) => !!o.rules?.['@nx/enforce-module-boundaries'], (o) => {
112
122
  addVueFiles(o);
113
123
  return o;
114
124
  });
@@ -6,8 +6,9 @@ export declare const vueRouterVersion = "^4.5.0";
6
6
  export declare const vueTestUtilsVersion = "^2.4.6";
7
7
  export declare const vitePluginVueVersion = "^6.0.1";
8
8
  export declare const vueEslintConfigPrettierVersion = "^10.2.0";
9
- export declare const vueEslintConfigTypescriptVersion = "^14.6.0";
10
- export declare const eslintPluginVueVersion = "^9.16.1";
9
+ export declare const vueEslintConfigTypescriptVersion = "^14.7.0";
10
+ export declare const eslintPluginVueVersion = "^10.8.0";
11
+ export declare const vueEslintParserVersion = "^10.4.1";
11
12
  export declare const postcssVersion = "8.4.21";
12
13
  export declare const autoprefixerVersion = "10.4.13";
13
14
  export declare const sassVersion = "^1.97.2";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sassVersion = exports.autoprefixerVersion = exports.postcssVersion = exports.eslintPluginVueVersion = exports.vueEslintConfigTypescriptVersion = exports.vueEslintConfigPrettierVersion = exports.vitePluginVueVersion = exports.vueTestUtilsVersion = exports.vueRouterVersion = exports.vueTscVersion = exports.vueVersion = exports.minSupportedVueVersion = exports.nxVersion = void 0;
3
+ exports.sassVersion = exports.autoprefixerVersion = exports.postcssVersion = exports.vueEslintParserVersion = exports.eslintPluginVueVersion = exports.vueEslintConfigTypescriptVersion = exports.vueEslintConfigPrettierVersion = exports.vitePluginVueVersion = exports.vueTestUtilsVersion = exports.vueRouterVersion = exports.vueTscVersion = exports.vueVersion = exports.minSupportedVueVersion = exports.nxVersion = void 0;
4
4
  const path_1 = require("path");
5
5
  exports.nxVersion = require((0, path_1.join)('@nx/vue', 'package.json')).version;
6
6
  // Lowest Vue major the plugin supports. Vue 2 is EOL (2023-12-31); the plugin
@@ -15,8 +15,9 @@ exports.vueTestUtilsVersion = '^2.4.6';
15
15
  exports.vitePluginVueVersion = '^6.0.1';
16
16
  // linting deps
17
17
  exports.vueEslintConfigPrettierVersion = '^10.2.0';
18
- exports.vueEslintConfigTypescriptVersion = '^14.6.0';
19
- exports.eslintPluginVueVersion = '^9.16.1';
18
+ exports.vueEslintConfigTypescriptVersion = '^14.7.0';
19
+ exports.eslintPluginVueVersion = '^10.8.0';
20
+ exports.vueEslintParserVersion = '^10.4.1';
20
21
  exports.postcssVersion = '8.4.21';
21
22
  exports.autoprefixerVersion = '10.4.13';
22
23
  // other deps
package/migrations.json CHANGED
@@ -1,5 +1,15 @@
1
1
  {
2
- "generators": {},
2
+ "generators": {
3
+ "update-24-1-0-rename-vue3-eslint-configs": {
4
+ "version": "24.1.0-beta.2",
5
+ "requires": {
6
+ "eslint-plugin-vue": ">=10.0.0"
7
+ },
8
+ "description": "Renames the `vue3-essential`, `vue3-strongly-recommended` and `vue3-recommended` ESLint configs, which eslint-plugin-vue 10 removed, to `essential`, `strongly-recommended` and `recommended`.",
9
+ "implementation": "./dist/src/migrations/update-24-1-0/rename-vue3-eslint-configs",
10
+ "documentation": "./dist/src/migrations/update-24-1-0/rename-vue3-eslint-configs.md"
11
+ }
12
+ },
3
13
  "packageJsonUpdates": {
4
14
  "22.0.0": {
5
15
  "version": "22.0.0-beta.8",
@@ -12,6 +22,34 @@
12
22
  "alwaysAddToPackageJson": false
13
23
  }
14
24
  }
25
+ },
26
+ "24.1.0-eslint-plugin-vue": {
27
+ "version": "24.1.0-beta.2",
28
+ "requires": {
29
+ "eslint-plugin-vue": ">=9.0.0 <10.8.0"
30
+ },
31
+ "packages": {
32
+ "eslint-plugin-vue": {
33
+ "version": "^10.8.0",
34
+ "alwaysAddToPackageJson": false
35
+ },
36
+ "vue-eslint-parser": {
37
+ "version": "^10.4.1",
38
+ "addToPackageJson": "devDependencies"
39
+ }
40
+ }
41
+ },
42
+ "24.1.0-vue-eslint-config-typescript": {
43
+ "version": "24.1.0-beta.2",
44
+ "requires": {
45
+ "@vue/eslint-config-typescript": ">=14.0.0 <14.7.0"
46
+ },
47
+ "packages": {
48
+ "@vue/eslint-config-typescript": {
49
+ "version": "^14.7.0",
50
+ "alwaysAddToPackageJson": false
51
+ }
52
+ }
15
53
  }
16
54
  }
17
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/vue",
3
- "version": "24.1.0-beta.1",
3
+ "version": "24.1.0-beta.2",
4
4
  "private": false,
5
5
  "description": "The Vue plugin for Nx contains executors and generators for managing Vue 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": {
@@ -61,26 +61,26 @@
61
61
  }
62
62
  },
63
63
  "dependencies": {
64
- "@nx/devkit": "24.1.0-beta.1",
65
- "@nx/eslint": "24.1.0-beta.1",
66
- "@nx/js": "24.1.0-beta.1",
67
- "@nx/vite": "24.1.0-beta.1",
68
- "@nx/vitest": "24.1.0-beta.1",
69
- "@nx/web": "24.1.0-beta.1",
64
+ "@nx/devkit": "24.1.0-beta.2",
65
+ "@nx/eslint": "24.1.0-beta.2",
66
+ "@nx/js": "24.1.0-beta.2",
67
+ "@nx/vite": "24.1.0-beta.2",
68
+ "@nx/vitest": "24.1.0-beta.2",
69
+ "@nx/web": "24.1.0-beta.2",
70
70
  "picomatch": "^4.0.7",
71
71
  "tslib": "^2.3.0"
72
72
  },
73
73
  "devDependencies": {
74
- "nx": "24.1.0-beta.1"
74
+ "nx": "24.1.0-beta.2"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"
78
78
  },
79
79
  "peerDependencies": {
80
- "@nx/cypress": "24.1.0-beta.1",
81
- "@nx/playwright": "24.1.0-beta.1",
82
- "@nx/rsbuild": "24.1.0-beta.1",
83
- "@nx/storybook": "24.1.0-beta.1",
80
+ "@nx/cypress": "24.1.0-beta.2",
81
+ "@nx/playwright": "24.1.0-beta.2",
82
+ "@nx/rsbuild": "24.1.0-beta.2",
83
+ "@nx/storybook": "24.1.0-beta.2",
84
84
  "vue": "^3.0.0",
85
85
  "vue-router": "^4.0.0",
86
86
  "vue-tsc": "^2.0.0",