@nx/react-native 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.
@@ -1,6 +1,8 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { Schema } from '../schema';
3
+ import type { LinterType } from '@nx/js';
3
4
  export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
5
+ linter: LinterType;
4
6
  className: string;
5
7
  fileName: string;
6
8
  projectName: string;
@@ -29,6 +29,10 @@ async function normalizeOptions(host, options) {
29
29
  const entryFile = options.js ? 'src/main.js' : 'src/main.tsx';
30
30
  return {
31
31
  ...options,
32
+ // Resolved after the spread: `undefined` is falsy, so the ESLint arm in
33
+ // add-linting would still run while the `=== 'eslint'` tsconfig excludes
34
+ // downstream are skipped.
35
+ linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
32
36
  name: projectNames.projectSimpleName,
33
37
  className,
34
38
  fileName,
@@ -1,4 +1,4 @@
1
- import type { Linter, LinterType } from '@nx/eslint';
1
+ import type { LinterType } from '@nx/js';
2
2
 
3
3
  export interface Schema {
4
4
  directory: string;
@@ -10,7 +10,7 @@ export interface Schema {
10
10
  unitTestRunner: 'jest' | 'none'; // default is jest
11
11
  classComponent?: boolean;
12
12
  js?: boolean;
13
- linter: Linter | LinterType;
13
+ linter?: LinterType;
14
14
  enableTypedLinting?: boolean;
15
15
  /**
16
16
  * @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
@@ -41,10 +41,9 @@
41
41
  "x-priority": "internal"
42
42
  },
43
43
  "linter": {
44
- "description": "The tool to use for running lint checks.",
44
+ "description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
45
45
  "type": "string",
46
- "enum": ["eslint", "none"],
47
- "default": "none",
46
+ "enum": ["eslint", "oxlint", "none"],
48
47
  "x-priority": "important"
49
48
  },
50
49
  "unitTestRunner": {
@@ -1,6 +1,8 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { Schema } from '../schema';
3
+ import type { LinterType } from '@nx/js';
3
4
  export interface NormalizedSchema extends Schema {
5
+ linter: LinterType;
4
6
  name: string;
5
7
  fileName: string;
6
8
  projectRoot: string;
@@ -22,6 +22,10 @@ async function normalizeOptions(host, options) {
22
22
  const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
23
23
  const normalized = {
24
24
  ...options,
25
+ // Resolved in the literal so the type guarantees it: `undefined` is falsy,
26
+ // so the ESLint arm would still run while the `=== 'eslint'` tsconfig
27
+ // excludes below are skipped.
28
+ linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
25
29
  fileName: projectName,
26
30
  routePath: `/${projectNames.projectSimpleName}`,
27
31
  name: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
@@ -1,4 +1,4 @@
1
- import type { Linter, LinterType } from '@nx/eslint';
1
+ import type { LinterType } from '@nx/js';
2
2
 
3
3
  /**
4
4
  * Same as the @nx/react library schema, except it removes keys: style, component, routing, appProject
@@ -10,7 +10,7 @@ export interface Schema {
10
10
  skipFormat: boolean;
11
11
  tags?: string;
12
12
  unitTestRunner: 'jest' | 'none';
13
- linter: Linter | LinterType;
13
+ linter?: LinterType;
14
14
  publishable?: boolean;
15
15
  buildable?: boolean;
16
16
  importPath?: string;
@@ -29,11 +29,9 @@
29
29
  "x-priority": "important"
30
30
  },
31
31
  "linter": {
32
- "description": "The tool to use for running lint checks.",
32
+ "description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
33
33
  "type": "string",
34
- "enum": ["eslint", "none"],
35
- "default": "none",
36
- "x-prompt": "Which linter would you like to use?",
34
+ "enum": ["eslint", "oxlint", "none"],
37
35
  "x-priority": "important"
38
36
  },
39
37
  "unitTestRunner": {
@@ -1,7 +1,7 @@
1
- import { Linter, LinterType } from '@nx/eslint';
1
+ import { LinterType } from '@nx/js';
2
2
  import { GeneratorCallback, Tree } from '@nx/devkit';
3
3
  interface NormalizedSchema {
4
- linter?: Linter | LinterType;
4
+ linter?: LinterType;
5
5
  projectName: string;
6
6
  projectRoot: string;
7
7
  enableTypedLinting?: boolean;
@@ -10,6 +10,7 @@ interface NormalizedSchema {
10
10
  */
11
11
  setParserOptionsProject?: boolean;
12
12
  tsConfigPaths: string[];
13
+ unitTestRunner?: string;
13
14
  skipPackageJson?: boolean;
14
15
  addPlugin?: boolean;
15
16
  buildable?: boolean;
@@ -1,26 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addLinting = addLinting;
4
- const eslint_1 = require("@nx/eslint");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const react_1 = require("@nx/react");
7
6
  const internal_1 = require("@nx/eslint/internal");
7
+ const internal_2 = require("@nx/js/internal");
8
8
  async function addLinting(host, options) {
9
- if (options.linter === 'none') {
10
- return () => { };
11
- }
12
9
  const tasks = [];
13
- const lintTask = await (0, eslint_1.lintProjectGenerator)(host, {
10
+ tasks.push(await (0, internal_2.addLintingToProject)(host, {
11
+ oxlintPlugins: ['react', 'react-perf'],
14
12
  linter: options.linter,
15
13
  project: options.projectName,
16
14
  tsConfigPaths: options.tsConfigPaths,
17
- skipFormat: true,
15
+ unitTestRunner: options.unitTestRunner,
18
16
  skipPackageJson: options.skipPackageJson,
19
17
  enableTypedLinting: (0, internal_1.isTypedLintingEnabled)(options),
20
18
  addPlugin: options.addPlugin,
21
19
  addPackageJsonDependencyChecks: options.buildable,
22
- });
23
- tasks.push(lintTask);
20
+ }));
21
+ // Everything below configures ESLint — predefined configs, `extends`, ignore
22
+ // entries — which have no equivalent in other linters.
23
+ if (options.linter && options.linter !== 'eslint') {
24
+ return (0, devkit_1.runTasksInSerial)(...tasks);
25
+ }
24
26
  // Add ignored dependencies and files to dependency-checks rule
25
27
  if ((0, internal_1.isEslintConfigSupported)(host)) {
26
28
  (0, internal_1.updateOverrideInLintConfig)(host, options.projectRoot, (override) => Boolean(override.rules?.['@nx/dependency-checks']), (override) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react-native",
3
- "version": "23.2.0-beta.6",
3
+ "version": "23.2.0-beta.7",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: \n\n-Integration with libraries such as Jest, Detox, and Storybook.\n-Scaffolding for creating buildable libraries that can be published to npm.\n-Utilities for automatic workspace refactoring.",
6
6
  "keywords": [
@@ -62,10 +62,10 @@
62
62
  "tinyglobby": "^0.2.12",
63
63
  "tsconfig-paths": "^4.1.2",
64
64
  "tslib": "^2.3.0",
65
- "@nx/devkit": "23.2.0-beta.6",
66
- "@nx/js": "23.2.0-beta.6",
67
- "@nx/eslint": "23.2.0-beta.6",
68
- "@nx/react": "23.2.0-beta.6"
65
+ "@nx/devkit": "23.2.0-beta.7",
66
+ "@nx/js": "23.2.0-beta.7",
67
+ "@nx/eslint": "23.2.0-beta.7",
68
+ "@nx/react": "23.2.0-beta.7"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "react-native": ">=0.83.0 <0.85.0",
@@ -78,12 +78,12 @@
78
78
  }
79
79
  },
80
80
  "devDependencies": {
81
- "@nx/webpack": "23.2.0-beta.6",
82
- "nx": "23.2.0-beta.6"
81
+ "@nx/webpack": "23.2.0-beta.7",
82
+ "nx": "23.2.0-beta.7"
83
83
  },
84
84
  "optionalDependencies": {
85
- "@nx/detox": "23.2.0-beta.6",
86
- "@nx/rollup": "23.2.0-beta.6"
85
+ "@nx/rollup": "23.2.0-beta.7",
86
+ "@nx/detox": "23.2.0-beta.7"
87
87
  },
88
88
  "executors": "./executors.json",
89
89
  "ng-update": {