@nx/nuxt 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/nuxt",
3
- "version": "19.7.4",
3
+ "version": "19.8.0-beta.1",
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": {
@@ -31,11 +31,11 @@
31
31
  "dependencies": {
32
32
  "tslib": "^2.3.0",
33
33
  "@nuxt/kit": "^3.10.0",
34
- "@nx/devkit": "19.7.4",
35
- "@nx/js": "19.7.4",
36
- "@nx/eslint": "19.7.4",
37
- "@nx/vue": "19.7.4",
38
- "@nx/vite": "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/vue": "19.8.0-beta.1",
38
+ "@nx/vite": "19.8.0-beta.1",
39
39
  "@phenomnomnominal/tsquery": "~5.0.1"
40
40
  },
41
41
  "peerDependencies": {},
@@ -51,4 +51,4 @@
51
51
  },
52
52
  "type": "commonjs",
53
53
  "types": "./index.d.ts"
54
- }
54
+ }
@@ -4,8 +4,10 @@ exports.addLinting = addLinting;
4
4
  const eslint_1 = require("@nx/eslint");
5
5
  const path_1 = require("nx/src/utils/path");
6
6
  const devkit_1 = require("@nx/devkit");
7
- const vue_1 = require("@nx/vue");
7
+ const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
8
8
  const versions_1 = require("./versions");
9
+ const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
10
+ // TODO(colum): Look into the recommended set up using `withNuxt` inside eslint.config.mjs. https://eslint.nuxt.com/packages/config
9
11
  async function addLinting(host, options) {
10
12
  const tasks = [];
11
13
  if (options.linter === 'eslint') {
@@ -19,20 +21,25 @@ async function addLinting(host, options) {
19
21
  addPlugin: true,
20
22
  });
21
23
  tasks.push(lintTask);
22
- (0, vue_1.editEslintConfigFiles)(host, options.projectRoot);
23
- (0, devkit_1.updateJson)(host, (0, path_1.joinPathFragments)(options.projectRoot, '.eslintrc.json'), (json) => {
24
- const { extends: pluginExtends, ignorePatterns: pluginIgnorePatters, ...config } = json;
25
- return {
26
- extends: ['@nuxt/eslint-config', ...(pluginExtends || [])],
27
- ignorePatterns: [
28
- ...(pluginIgnorePatters || []),
29
- '.nuxt/**',
30
- '.output/**',
31
- 'node_modules',
32
- ],
33
- ...config,
34
- };
35
- });
24
+ if ((0, eslint_file_1.isEslintConfigSupported)(host, options.projectRoot)) {
25
+ editEslintConfigFiles(host, options.projectRoot);
26
+ const addExtendsTask = (0, eslint_file_1.addExtendsToLintConfig)(host, options.projectRoot, ['@nuxt/eslint-config'], true);
27
+ tasks.push(addExtendsTask);
28
+ if ((0, flat_config_1.useFlatConfig)(host)) {
29
+ (0, eslint_file_1.addOverrideToLintConfig)(host, options.projectRoot, {
30
+ files: ['**/*.vue'],
31
+ languageOptions: {
32
+ parserOptions: { parser: '@typescript-eslint/parser' },
33
+ },
34
+ } // languageOptions is not in eslintrc format but for flat config
35
+ );
36
+ }
37
+ (0, eslint_file_1.addIgnoresToLintConfig)(host, options.projectRoot, [
38
+ '.nuxt/**',
39
+ '.output/**',
40
+ 'node_modules',
41
+ ]);
42
+ }
36
43
  const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
37
44
  '@nuxt/eslint-config': versions_1.nuxtEslintConfigVersion,
38
45
  });
@@ -40,3 +47,40 @@ async function addLinting(host, options) {
40
47
  }
41
48
  return (0, devkit_1.runTasksInSerial)(...tasks);
42
49
  }
50
+ function editEslintConfigFiles(tree, projectRoot) {
51
+ const hasVueFiles = (o) => o.files &&
52
+ (Array.isArray(o.files)
53
+ ? o.files.some((f) => f.endsWith('*.vue'))
54
+ : o.files.endsWith('*.vue'));
55
+ const addVueFiles = (o) => {
56
+ if (!o.files) {
57
+ o.files = ['*.vue'];
58
+ }
59
+ else if (Array.isArray(o.files)) {
60
+ o.files.push('*.vue');
61
+ }
62
+ else {
63
+ o.files = [o.files, '*.vue'];
64
+ }
65
+ };
66
+ if ((0, eslint_file_1.lintConfigHasOverride)(tree, projectRoot, (o) => o.parserOptions && !hasVueFiles(o), true)) {
67
+ (0, eslint_file_1.updateOverrideInLintConfig)(tree, projectRoot, (o) => !!o.parserOptions, (o) => {
68
+ addVueFiles(o);
69
+ return o;
70
+ });
71
+ }
72
+ else {
73
+ (0, eslint_file_1.replaceOverridesInLintConfig)(tree, projectRoot, [
74
+ {
75
+ files: ['*.ts', '*.tsx', '*.js', '*.jsx', '*.vue'],
76
+ rules: {},
77
+ },
78
+ ]);
79
+ }
80
+ if ((0, eslint_file_1.lintConfigHasOverride)(tree, '', (o) => o.rules?.['@nx/enforce-module-boundaries'] && !hasVueFiles(o), true)) {
81
+ (0, eslint_file_1.updateOverrideInLintConfig)(tree, '', (o) => !!o.rules?.['@nx/enforce-module-boundaries'], (o) => {
82
+ addVueFiles(o);
83
+ return o;
84
+ });
85
+ }
86
+ }
@@ -3,4 +3,4 @@ export declare const h3Version = "^1.8.2";
3
3
  export declare const nuxtVersion = "^3.10.0";
4
4
  export declare const nuxtDevtoolsVersion = "1.0.0";
5
5
  export declare const nuxtUiTemplatesVersion = "^1.3.1";
6
- export declare const nuxtEslintConfigVersion = "~0.3.6";
6
+ export declare const nuxtEslintConfigVersion = "~0.5.6";
@@ -8,4 +8,4 @@ exports.nuxtVersion = '^3.10.0';
8
8
  exports.nuxtDevtoolsVersion = '1.0.0';
9
9
  exports.nuxtUiTemplatesVersion = '^1.3.1';
10
10
  // linting deps
11
- exports.nuxtEslintConfigVersion = '~0.3.6';
11
+ exports.nuxtEslintConfigVersion = '~0.5.6';