@nx/remix 23.2.0-beta.6 → 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.
@@ -6,12 +6,12 @@ const tslib_1 = require("tslib");
6
6
  const internal_1 = require("@nx/devkit/internal");
7
7
  const devkit_1 = require("@nx/devkit");
8
8
  const js_1 = require("@nx/js");
9
+ const internal_2 = require("@nx/js/internal");
9
10
  const testing_config_utils_1 = require("../../utils/testing-config-utils");
10
11
  const versions_1 = require("../../utils/versions");
11
12
  const init_1 = tslib_1.__importDefault(require("../init/init"));
12
13
  const update_dependencies_1 = require("../utils/update-dependencies");
13
14
  const lib_1 = require("./lib");
14
- const internal_2 = require("@nx/js/internal");
15
15
  function remixApplicationGenerator(tree, options) {
16
16
  return remixApplicationGeneratorInternal(tree, {
17
17
  addPlugin: true,
@@ -147,7 +147,16 @@ async function remixApplicationGeneratorInternal(tree, _options) {
147
147
  else {
148
148
  tree.delete((0, devkit_1.joinPathFragments)(options.projectRoot, `tests/routes/_index.spec.tsx`));
149
149
  }
150
- if (options.linter !== 'none') {
150
+ if (options.linter !== 'eslint' && options.linter !== 'none') {
151
+ tasks.push(await (0, internal_2.addLintingToProject)(tree, {
152
+ oxlintPlugins: ['react', 'react-perf', 'jsx-a11y'],
153
+ unitTestRunner: options.unitTestRunner,
154
+ linter: options.linter,
155
+ project: options.projectName,
156
+ addPlugin: options.addPlugin,
157
+ }));
158
+ }
159
+ if (options.linter === 'eslint') {
151
160
  const { lintProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/eslint', versions_1.nxVersion);
152
161
  const { addIgnoresToLintConfig, } = require('@nx/eslint/internal');
153
162
  const eslintTask = await lintProjectGenerator(tree, {
@@ -5,6 +5,8 @@
5
5
  Delete this file and get started with your project!
6
6
  * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7
7
  */
8
+ /* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
9
+ are inline SVGs, which have no tag to swap the role for. */
8
10
  export function NxWelcome({ title }: { title: string }) {
9
11
  return (
10
12
  <>
@@ -5,6 +5,8 @@
5
5
  Delete this file and get started with your project!
6
6
  * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7
7
  */
8
+ /* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
9
+ are inline SVGs, which have no tag to swap the role for. */
8
10
  export function NxWelcome({ title }: { title: string }) {
9
11
  return (
10
12
  <>
@@ -5,6 +5,8 @@
5
5
  Delete this file and get started with your project!
6
6
  * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7
7
  */
8
+ /* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
9
+ are inline SVGs, which have no tag to swap the role for. */
8
10
  export function NxWelcome({ title }: { title: string }) {
9
11
  return (
10
12
  <>
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export declare function ignoreViteTempFiles(tree: Tree, projectRoot?: string | undefined): Promise<void>;
3
- export declare function isEslintInstalled(tree: Tree): boolean;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ignoreViteTempFiles = ignoreViteTempFiles;
4
- exports.isEslintInstalled = isEslintInstalled;
5
4
  const devkit_1 = require("@nx/devkit");
5
+ const internal_1 = require("@nx/js/internal");
6
6
  const versions_1 = require("../../../utils/versions");
7
7
  async function ignoreViteTempFiles(tree, projectRoot) {
8
8
  addViteTempFilesToGitIgnore(tree);
@@ -23,7 +23,9 @@ function addViteTempFilesToGitIgnore(tree) {
23
23
  tree.write('.gitignore', gitIgnoreContents);
24
24
  }
25
25
  async function ignoreViteTempFilesInEslintConfig(tree, projectRoot) {
26
- if (!isEslintInstalled(tree)) {
26
+ // Checked before `ensurePackage` so an Oxlint workspace does not install
27
+ // `@nx/eslint` only for `isEslintConfigSupported` to send it straight back.
28
+ if (!(0, internal_1.detectLinters)(tree).includes('eslint')) {
27
29
  return;
28
30
  }
29
31
  (0, devkit_1.ensurePackage)('@nx/eslint', versions_1.nxVersion);
@@ -46,15 +48,3 @@ async function ignoreViteTempFilesInEslintConfig(tree, projectRoot) {
46
48
  '**/vitest.config.*.timestamp*',
47
49
  ]);
48
50
  }
49
- function isEslintInstalled(tree) {
50
- try {
51
- require('eslint');
52
- return true;
53
- }
54
- catch { }
55
- // it might not be installed yet, but it might be in the tree pending install
56
- const { devDependencies, dependencies } = tree.exists('package.json')
57
- ? (0, devkit_1.readJson)(tree, 'package.json')
58
- : {};
59
- return !!devDependencies?.['eslint'] || !!dependencies?.['eslint'];
60
- }
@@ -26,7 +26,7 @@ async function normalizeOptions(tree, options) {
26
26
  : [];
27
27
  return {
28
28
  ...options,
29
- linter: options.linter ?? 'eslint',
29
+ linter: await (0, internal_2.normalizeLinterOption)(tree, options.linter),
30
30
  projectName: appProjectName,
31
31
  projectRoot,
32
32
  importPath,
@@ -1,10 +1,10 @@
1
- import type { Linter, LinterType } from '@nx/eslint';
1
+ import type { LinterType } from '@nx/js';
2
2
 
3
3
  export interface NxRemixGeneratorSchema {
4
4
  directory: string;
5
5
  name?: string;
6
6
  tags?: string;
7
- linter?: Linter | LinterType;
7
+ linter?: LinterType;
8
8
  unitTestRunner?: 'vitest' | 'jest' | 'none';
9
9
  e2eTestRunner?: 'cypress' | 'playwright' | 'none';
10
10
  skipFormat?: boolean;
@@ -21,11 +21,9 @@
21
21
  "x-priority": "important"
22
22
  },
23
23
  "linter": {
24
- "description": "The tool to use for running lint checks.",
24
+ "description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
25
25
  "type": "string",
26
- "enum": ["eslint", "none"],
27
- "default": "none",
28
- "x-prompt": "Which linter would you like to use?",
26
+ "enum": ["eslint", "oxlint", "none"],
29
27
  "x-priority": "important"
30
28
  },
31
29
  "unitTestRunner": {
@@ -18,6 +18,9 @@ async function normalizeOptions(tree, options) {
18
18
  const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(tree);
19
19
  return {
20
20
  ...options,
21
+ // Resolved after the spread: the framework's ESLint shaping is guarded on
22
+ // `=== 'eslint'`, and an unresolved `undefined` would skip all of it.
23
+ linter: await (0, internal_2.normalizeLinterOption)(tree, options.linter),
21
24
  unitTestRunner: options.unitTestRunner ?? 'vitest',
22
25
  projectName: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
23
26
  projectRoot,
@@ -22,6 +22,9 @@ async function remixLibraryGeneratorInternal(tree, schema) {
22
22
  const tasks = [];
23
23
  tasks.push((0, assert_and_pin_remix_typescript_1.assertAndPinRemixTypescript)(tree));
24
24
  const addTsPlugin = (0, internal_1.shouldConfigureTsSolutionSetup)(tree, schema.addPlugin);
25
+ // Detected before `updateDependencies`, which installs eslint unconditionally.
26
+ // Detecting afterwards would just observe what this generator itself added.
27
+ const linter = await (0, internal_1.normalizeLinterOption)(tree, schema.linter);
25
28
  const installTask = (0, update_dependencies_1.updateDependencies)(tree);
26
29
  tasks.push(installTask);
27
30
  const jsInitTask = await (0, js_1.initGenerator)(tree, {
@@ -30,7 +33,7 @@ async function remixLibraryGeneratorInternal(tree, schema) {
30
33
  skipFormat: true,
31
34
  });
32
35
  tasks.push(jsInitTask);
33
- const options = await (0, lib_1.normalizeOptions)(tree, schema);
36
+ const options = await (0, lib_1.normalizeOptions)(tree, { ...schema, linter });
34
37
  if (options.isUsingTsSolutionConfig) {
35
38
  await (0, internal_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
36
39
  }
@@ -1,3 +1,4 @@
1
+ import type { LinterType } from '@nx/js';
1
2
  import { SupportedStyles } from '@nx/react';
2
3
 
3
4
  export interface NxRemixGeneratorSchema {
@@ -9,7 +10,7 @@ export interface NxRemixGeneratorSchema {
9
10
  /** @deprecated Use bundler instead. */
10
11
  buildable?: boolean;
11
12
  bundler?: 'none' | 'vite' | 'rollup';
12
- linter?: 'none' | 'eslint';
13
+ linter?: LinterType;
13
14
  unitTestRunner?: 'jest' | 'vitest' | 'none';
14
15
  js?: boolean;
15
16
  skipFormat?: boolean;
@@ -46,11 +46,9 @@
46
46
  "x-priority": "important"
47
47
  },
48
48
  "linter": {
49
- "description": "The tool to use for running lint checks.",
49
+ "description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
50
50
  "type": "string",
51
- "enum": ["eslint", "none"],
52
- "default": "none",
53
- "x-prompt": "Which linter would you like to use?",
51
+ "enum": ["eslint", "oxlint", "none"],
54
52
  "x-priority": "important"
55
53
  },
56
54
  "unitTestRunner": {
@@ -1,4 +1,4 @@
1
- import { Linter, LinterType } from '@nx/eslint';
1
+ import { LinterType } from '@nx/js';
2
2
 
3
3
  export interface StorybookConfigurationSchema {
4
4
  project: string;
@@ -6,7 +6,7 @@ export interface StorybookConfigurationSchema {
6
6
  generateStories?: boolean;
7
7
  js?: boolean;
8
8
  tsConfiguration?: boolean;
9
- linter?: Linter | LinterType;
9
+ linter?: LinterType;
10
10
  ignorePaths?: string[];
11
11
  configureTestRunner?: boolean;
12
12
  configureStaticServe?: boolean;
@@ -53,8 +53,7 @@
53
53
  "linter": {
54
54
  "description": "The tool to use for running lint checks.",
55
55
  "type": "string",
56
- "enum": ["eslint"],
57
- "default": "eslint"
56
+ "enum": ["eslint", "oxlint"]
58
57
  },
59
58
  "ignorePaths": {
60
59
  "type": "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "23.2.0-beta.6",
3
+ "version": "23.2.0-beta.7",
4
4
  "description": "The Remix plugin for Nx contains executors and generators for managing Remix applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Jest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, routes, loaders, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -56,20 +56,20 @@
56
56
  "dependencies": {
57
57
  "tslib": "^2.3.0",
58
58
  "@phenomnomnominal/tsquery": "~6.2.0",
59
- "@nx/devkit": "23.2.0-beta.6",
60
- "@nx/js": "23.2.0-beta.6",
61
- "@nx/react": "23.2.0-beta.6",
62
- "@nx/web": "23.2.0-beta.6"
59
+ "@nx/js": "23.2.0-beta.7",
60
+ "@nx/react": "23.2.0-beta.7",
61
+ "@nx/web": "23.2.0-beta.7",
62
+ "@nx/devkit": "23.2.0-beta.7"
63
63
  },
64
64
  "devDependencies": {
65
- "@nx/eslint": "23.2.0-beta.6",
66
- "nx": "23.2.0-beta.6",
67
- "@nx/vitest": "23.2.0-beta.6"
65
+ "@nx/eslint": "23.2.0-beta.7",
66
+ "nx": "23.2.0-beta.7",
67
+ "@nx/vitest": "23.2.0-beta.7"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@remix-run/dev": "^2.0.0",
71
- "@nx/cypress": "23.2.0-beta.6",
72
- "@nx/playwright": "23.2.0-beta.6"
71
+ "@nx/cypress": "23.2.0-beta.7",
72
+ "@nx/playwright": "23.2.0-beta.7"
73
73
  },
74
74
  "peerDependenciesMeta": {
75
75
  "@nx/cypress": {