@nx/vue 19.7.4 → 19.8.0-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/vue",
3
- "version": "19.7.4",
3
+ "version": "19.8.0-beta.1",
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": {
@@ -31,11 +31,11 @@
31
31
  "dependencies": {
32
32
  "minimatch": "9.0.3",
33
33
  "tslib": "^2.3.0",
34
- "@nx/devkit": "19.7.4",
35
- "@nx/js": "19.7.4",
36
- "@nx/eslint": "19.7.4",
37
- "@nx/vite": "19.7.4",
38
- "@nx/web": "19.7.4"
34
+ "@nx/devkit": "19.8.0-beta.1",
35
+ "@nx/js": "19.8.0-beta.1",
36
+ "@nx/eslint": "19.8.0-beta.1",
37
+ "@nx/vite": "19.8.0-beta.1",
38
+ "@nx/web": "19.8.0-beta.1"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -51,4 +51,4 @@
51
51
  },
52
52
  "type": "commonjs",
53
53
  "types": "./index.d.ts"
54
- }
54
+ }
@@ -1,5 +1,6 @@
1
1
  import { Tree } from 'nx/src/generators/tree';
2
2
  import { Linter, LinterType } from '@nx/eslint';
3
+ import { GeneratorCallback } from '@nx/devkit';
3
4
  export declare function addLinting(host: Tree, options: {
4
5
  linter: Linter | LinterType;
5
6
  name: string;
@@ -9,5 +10,4 @@ export declare function addLinting(host: Tree, options: {
9
10
  skipPackageJson?: boolean;
10
11
  rootProject?: boolean;
11
12
  addPlugin?: boolean;
12
- }, projectType: 'lib' | 'app'): Promise<import("@nx/devkit").GeneratorCallback>;
13
- export declare function editEslintConfigFiles(tree: Tree, projectRoot: string): void;
13
+ }, projectType: 'lib' | 'app'): Promise<GeneratorCallback>;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addLinting = addLinting;
4
- exports.editEslintConfigFiles = editEslintConfigFiles;
5
4
  const eslint_1 = require("@nx/eslint");
6
5
  const path_1 = require("nx/src/utils/path");
7
6
  const devkit_1 = require("@nx/devkit");
8
7
  const lint_1 = require("./lint");
9
8
  const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
9
+ const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
10
10
  async function addLinting(host, options, projectType) {
11
11
  if (options.linter === eslint_1.Linter.EsLint) {
12
+ const tasks = [];
12
13
  const lintTask = await (0, eslint_1.lintProjectGenerator)(host, {
13
14
  linter: options.linter,
14
15
  project: options.name,
@@ -21,18 +22,24 @@ async function addLinting(host, options, projectType) {
21
22
  rootProject: options.rootProject,
22
23
  addPlugin: options.addPlugin,
23
24
  });
24
- (0, eslint_file_1.addExtendsToLintConfig)(host, options.projectRoot, [
25
- 'plugin:vue/vue3-essential',
26
- 'eslint:recommended',
27
- '@vue/eslint-config-typescript',
28
- '@vue/eslint-config-prettier/skip-formatting',
29
- ]);
25
+ tasks.push(lintTask);
26
+ if ((0, flat_config_1.useFlatConfig)(host)) {
27
+ }
28
+ else {
29
+ const addExtendsTask = (0, eslint_file_1.addExtendsToLintConfig)(host, options.projectRoot, [
30
+ 'plugin:vue/vue3-essential',
31
+ 'eslint:recommended',
32
+ '@vue/eslint-config-typescript',
33
+ '@vue/eslint-config-prettier/skip-formatting',
34
+ ].filter(Boolean));
35
+ tasks.push(addExtendsTask);
36
+ }
30
37
  editEslintConfigFiles(host, options.projectRoot);
31
- let installTask = () => { };
32
38
  if (!options.skipPackageJson) {
33
- installTask = (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
39
+ const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
40
+ tasks.push(installTask);
34
41
  }
35
- return (0, devkit_1.runTasksInSerial)(lintTask, installTask);
42
+ return (0, devkit_1.runTasksInSerial)(...tasks);
36
43
  }
37
44
  else {
38
45
  return () => { };
@@ -55,19 +62,39 @@ function editEslintConfigFiles(tree, projectRoot) {
55
62
  }
56
63
  };
57
64
  if ((0, eslint_file_1.isEslintConfigSupported)(tree, projectRoot)) {
58
- if ((0, eslint_file_1.lintConfigHasOverride)(tree, projectRoot, (o) => o.parserOptions && !hasVueFiles(o), true)) {
59
- (0, eslint_file_1.updateOverrideInLintConfig)(tree, projectRoot, (o) => !!o.parserOptions, (o) => {
60
- addVueFiles(o);
61
- return o;
65
+ if ((0, flat_config_1.useFlatConfig)(tree)) {
66
+ (0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(tree, projectRoot, 'flat/recommended', 'vue', 'eslint-plugin-vue');
67
+ // This allows .vue files to be parsed
68
+ (0, eslint_file_1.addOverrideToLintConfig)(tree, projectRoot, {
69
+ files: ['**/*.vue'],
70
+ languageOptions: {
71
+ parserOptions: {
72
+ parser: '@typescript-eslint/parser',
73
+ },
74
+ },
75
+ } // languageOptions is not present on eslintrc override, but it is for flat config
76
+ );
77
+ // Add an empty rules object to users know how to add/override rules
78
+ (0, eslint_file_1.addOverrideToLintConfig)(tree, projectRoot, {
79
+ files: ['*.ts', '*.tsx', '*.js', '*.jsx', '*.vue'],
80
+ rules: { 'vue/multi-word-component-names': 'off' },
62
81
  });
63
82
  }
64
83
  else {
65
- (0, eslint_file_1.replaceOverridesInLintConfig)(tree, projectRoot, [
66
- {
67
- files: ['*.ts', '*.tsx', '*.js', '*.jsx', '*.vue'],
68
- rules: { 'vue/multi-word-component-names': 'off' },
69
- },
70
- ]);
84
+ if ((0, eslint_file_1.lintConfigHasOverride)(tree, projectRoot, (o) => o.parserOptions && !hasVueFiles(o), true)) {
85
+ (0, eslint_file_1.updateOverrideInLintConfig)(tree, projectRoot, (o) => !!o.parserOptions, (o) => {
86
+ addVueFiles(o);
87
+ return o;
88
+ });
89
+ }
90
+ else {
91
+ (0, eslint_file_1.replaceOverridesInLintConfig)(tree, projectRoot, [
92
+ {
93
+ files: ['*.ts', '*.tsx', '*.js', '*.jsx', '*.vue'],
94
+ rules: { 'vue/multi-word-component-names': 'off' },
95
+ },
96
+ ]);
97
+ }
71
98
  }
72
99
  }
73
100
  // Edit root config too