@nx/cypress 23.2.0-beta.2 → 23.2.0-beta.4
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,6 +6,10 @@ export interface CypressE2EConfigSchema {
|
|
|
6
6
|
directory?: string;
|
|
7
7
|
js?: boolean;
|
|
8
8
|
skipFormat?: boolean;
|
|
9
|
+
enableTypedLinting?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
12
|
+
*/
|
|
9
13
|
setParserOptionsProject?: boolean;
|
|
10
14
|
skipPackageJson?: boolean;
|
|
11
15
|
bundler?: 'webpack' | 'vite' | 'none';
|
|
@@ -60,11 +60,17 @@
|
|
|
60
60
|
"default": false,
|
|
61
61
|
"x-priority": "internal"
|
|
62
62
|
},
|
|
63
|
-
"
|
|
63
|
+
"enableTypedLinting": {
|
|
64
64
|
"type": "boolean",
|
|
65
|
-
"description": "Whether
|
|
65
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
66
66
|
"default": false
|
|
67
67
|
},
|
|
68
|
+
"setParserOptionsProject": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
71
|
+
"default": false,
|
|
72
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
73
|
+
},
|
|
68
74
|
"skipPackageJson": {
|
|
69
75
|
"type": "boolean",
|
|
70
76
|
"default": false,
|
|
@@ -3,6 +3,10 @@ import { Linter, LinterType } from '@nx/eslint';
|
|
|
3
3
|
export interface CyLinterOptions {
|
|
4
4
|
project: string;
|
|
5
5
|
linter: Linter | LinterType;
|
|
6
|
+
enableTypedLinting?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
9
|
+
*/
|
|
6
10
|
setParserOptionsProject?: boolean;
|
|
7
11
|
skipPackageJson?: boolean;
|
|
8
12
|
rootProject?: boolean;
|
|
@@ -12,13 +12,14 @@ async function addLinterToCyProject(tree, options) {
|
|
|
12
12
|
const tasks = [];
|
|
13
13
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
14
14
|
const eslintFile = (0, internal_1.findEslintFile)(tree, projectConfig.root);
|
|
15
|
+
const enableTypedLinting = (0, internal_1.isTypedLintingEnabled)(options);
|
|
15
16
|
if (!eslintFile) {
|
|
16
17
|
tasks.push(await (0, eslint_1.lintProjectGenerator)(tree, {
|
|
17
18
|
project: options.project,
|
|
18
19
|
linter: options.linter,
|
|
19
20
|
skipFormat: true,
|
|
20
21
|
tsConfigPaths: [(0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json')],
|
|
21
|
-
|
|
22
|
+
enableTypedLinting,
|
|
22
23
|
skipPackageJson: options.skipPackageJson,
|
|
23
24
|
rootProject: options.rootProject,
|
|
24
25
|
addPlugin: options.addPlugin,
|
|
@@ -35,7 +36,8 @@ async function addLinterToCyProject(tree, options) {
|
|
|
35
36
|
if ((0, internal_1.isEslintConfigSupported)(tree, projectConfig.root) ||
|
|
36
37
|
(0, internal_1.isEslintConfigSupported)(tree)) {
|
|
37
38
|
const overrides = [];
|
|
38
|
-
|
|
39
|
+
const isFlatConfig = (0, internal_1.useFlatConfig)(tree);
|
|
40
|
+
if (isFlatConfig) {
|
|
39
41
|
(0, internal_1.addPredefinedConfigToFlatLintConfig)(tree, projectConfig.root, 'recommended', {
|
|
40
42
|
moduleName: 'cypress',
|
|
41
43
|
moduleImportPath: 'eslint-plugin-cypress/flat',
|
|
@@ -67,39 +69,44 @@ async function addLinterToCyProject(tree, options) {
|
|
|
67
69
|
'no-undef': 'off',
|
|
68
70
|
},
|
|
69
71
|
};
|
|
72
|
+
// For flat configs typed linting is handled by `lintProjectGenerator` via
|
|
73
|
+
// `parserOptions.projectService`, so we don't emit `parserOptions.project`
|
|
74
|
+
// here. Legacy `.eslintrc` configs are JSON, which can't express the
|
|
75
|
+
// `__dirname` that `tsconfigRootDir` needs, so they keep `project`.
|
|
76
|
+
const legacyParserOptions = !isFlatConfig && enableTypedLinting
|
|
77
|
+
? { project: `${projectConfig.root}/tsconfig.*?.json` }
|
|
78
|
+
: undefined;
|
|
70
79
|
if (options.overwriteExisting) {
|
|
71
80
|
overrides.unshift({
|
|
72
|
-
files:
|
|
81
|
+
files: isFlatConfig
|
|
73
82
|
? // For flat configs we don't need to specify the files
|
|
74
83
|
undefined
|
|
75
84
|
: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
|
76
|
-
parserOptions:
|
|
77
|
-
? undefined
|
|
78
|
-
: {
|
|
79
|
-
project: `${projectConfig.root}/tsconfig.*?.json`,
|
|
80
|
-
},
|
|
85
|
+
parserOptions: legacyParserOptions,
|
|
81
86
|
rules: {},
|
|
82
87
|
});
|
|
83
88
|
(0, internal_1.replaceOverridesInLintConfig)(tree, projectConfig.root, overrides);
|
|
84
89
|
}
|
|
85
90
|
else {
|
|
86
91
|
overrides.unshift({
|
|
87
|
-
files:
|
|
92
|
+
files: isFlatConfig
|
|
88
93
|
? // For flat configs we don't need to specify the files
|
|
89
94
|
undefined
|
|
90
95
|
: [
|
|
91
96
|
'*.cy.{ts,js,tsx,jsx}',
|
|
92
97
|
`${options.cypressDir}/**/*.{ts,js,tsx,jsx}`,
|
|
93
98
|
],
|
|
94
|
-
parserOptions:
|
|
95
|
-
? undefined
|
|
96
|
-
: {
|
|
97
|
-
project: `${projectConfig.root}/tsconfig.*?.json`,
|
|
98
|
-
},
|
|
99
|
+
parserOptions: legacyParserOptions,
|
|
99
100
|
rules: {},
|
|
100
101
|
});
|
|
101
102
|
overrides.forEach((override) => (0, internal_1.addOverrideToLintConfig)(tree, projectConfig.root, override));
|
|
102
103
|
}
|
|
104
|
+
// `lintProjectGenerator` only sets up the projectService block when it
|
|
105
|
+
// creates the config, and `replaceOverridesInLintConfig` strips it. For a
|
|
106
|
+
// flat config, re-add it here when typed linting is enabled.
|
|
107
|
+
if (isFlatConfig && enableTypedLinting) {
|
|
108
|
+
(0, internal_1.addTypedLintingToFlatConfig)(tree, projectConfig.root);
|
|
109
|
+
}
|
|
103
110
|
}
|
|
104
111
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
105
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -89,12 +89,12 @@
|
|
|
89
89
|
"semver": "^7.6.3",
|
|
90
90
|
"tree-kill": "^1.2.2",
|
|
91
91
|
"tslib": "^2.3.0",
|
|
92
|
-
"@nx/devkit": "23.2.0-beta.
|
|
93
|
-
"@nx/eslint": "23.2.0-beta.
|
|
94
|
-
"@nx/js": "23.2.0-beta.
|
|
92
|
+
"@nx/devkit": "23.2.0-beta.4",
|
|
93
|
+
"@nx/eslint": "23.2.0-beta.4",
|
|
94
|
+
"@nx/js": "23.2.0-beta.4"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"nx": "23.2.0-beta.
|
|
97
|
+
"nx": "23.2.0-beta.4"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"cypress": ">= 13 < 16"
|