@nx/playwright 23.2.0-beta.2 → 23.2.0-beta.3
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/dist/src/generators/configuration/configuration.js +1 -1
- package/dist/src/generators/configuration/schema.d.ts +4 -0
- package/dist/src/generators/configuration/schema.json +8 -2
- package/dist/src/utils/add-linter.d.ts +5 -1
- package/dist/src/utils/add-linter.js +15 -6
- package/package.json +5 -5
|
@@ -149,7 +149,7 @@ async function configurationGeneratorInternal(tree, rawOptions) {
|
|
|
149
149
|
skipPackageJson: options.skipPackageJson,
|
|
150
150
|
js: options.js,
|
|
151
151
|
directory: options.directory,
|
|
152
|
-
|
|
152
|
+
enableTypedLinting: (0, internal_3.isTypedLintingEnabled)(options),
|
|
153
153
|
rootProject: options.rootProject ?? projectConfig.root === '.',
|
|
154
154
|
addPlugin: options.addPlugin,
|
|
155
155
|
}));
|
|
@@ -11,6 +11,10 @@ export interface ConfigurationGeneratorSchema {
|
|
|
11
11
|
skipPackageJson?: boolean;
|
|
12
12
|
skipInstall?: boolean;
|
|
13
13
|
linter?: Linter | LinterType;
|
|
14
|
+
enableTypedLinting?: boolean; // default is false
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
17
|
+
*/
|
|
14
18
|
setParserOptionsProject?: boolean; // default is false
|
|
15
19
|
/**
|
|
16
20
|
* command to give playwright to run the web server
|
|
@@ -39,11 +39,17 @@
|
|
|
39
39
|
"type": "string",
|
|
40
40
|
"description": "The address of the web server."
|
|
41
41
|
},
|
|
42
|
-
"
|
|
42
|
+
"enableTypedLinting": {
|
|
43
43
|
"type": "boolean",
|
|
44
|
-
"description": "Whether
|
|
44
|
+
"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.",
|
|
45
45
|
"default": false
|
|
46
46
|
},
|
|
47
|
+
"setParserOptionsProject": {
|
|
48
|
+
"type": "boolean",
|
|
49
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
50
|
+
"default": false,
|
|
51
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
52
|
+
},
|
|
47
53
|
"skipFormat": {
|
|
48
54
|
"description": "Skip formatting files.",
|
|
49
55
|
"type": "boolean",
|
|
@@ -3,7 +3,11 @@ import { Linter, LinterType } from '@nx/eslint';
|
|
|
3
3
|
export interface PlaywrightLinterOptions {
|
|
4
4
|
project: string;
|
|
5
5
|
linter: Linter | LinterType;
|
|
6
|
-
|
|
6
|
+
enableTypedLinting?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
9
|
+
*/
|
|
10
|
+
setParserOptionsProject?: boolean;
|
|
7
11
|
skipPackageJson: boolean;
|
|
8
12
|
rootProject: boolean;
|
|
9
13
|
js?: boolean;
|
|
@@ -12,13 +12,14 @@ async function addLinterToPlaywrightProject(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,
|
|
@@ -43,6 +44,13 @@ async function addLinterToPlaywrightProject(tree, options) {
|
|
|
43
44
|
files: ['*.ts', '*.js'],
|
|
44
45
|
rules: {},
|
|
45
46
|
});
|
|
47
|
+
// `lintProjectGenerator` only runs when the project has no ESLint config
|
|
48
|
+
// (it already emits the projectService block in that case). For an
|
|
49
|
+
// existing flat config it didn't run, so emit the block here when typed
|
|
50
|
+
// linting is requested.
|
|
51
|
+
if (eslintFile && enableTypedLinting) {
|
|
52
|
+
(0, internal_1.addTypedLintingToFlatConfig)(tree, projectConfig.root);
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
else {
|
|
48
56
|
const addExtendsTask = (0, internal_1.addExtendsToLintConfig)(tree, projectConfig.root, 'plugin:playwright/recommended');
|
|
@@ -53,11 +61,12 @@ async function addLinterToPlaywrightProject(tree, options) {
|
|
|
53
61
|
}
|
|
54
62
|
(0, internal_1.addOverrideToLintConfig)(tree, projectConfig.root, {
|
|
55
63
|
files: [`${options.directory}/**/*.{ts,js,tsx,jsx}`],
|
|
56
|
-
parserOptions
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
64
|
+
// Only emit `parserOptions.project` here on the legacy `.eslintrc`
|
|
65
|
+
// stack. Flat configs use `parserOptions.projectService` emitted by
|
|
66
|
+
// `lintProjectGenerator`.
|
|
67
|
+
parserOptions: enableTypedLinting
|
|
68
|
+
? { project: `${projectConfig.root}/tsconfig.*?.json` }
|
|
69
|
+
: undefined,
|
|
61
70
|
rules: {},
|
|
62
71
|
});
|
|
63
72
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/playwright",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
"tslib": "^2.3.0",
|
|
79
79
|
"minimatch": "10.2.5",
|
|
80
80
|
"semver": "^7.6.3",
|
|
81
|
-
"@nx/devkit": "23.2.0-beta.
|
|
82
|
-
"@nx/eslint": "23.2.0-beta.
|
|
83
|
-
"@nx/js": "23.2.0-beta.
|
|
81
|
+
"@nx/devkit": "23.2.0-beta.3",
|
|
82
|
+
"@nx/eslint": "23.2.0-beta.3",
|
|
83
|
+
"@nx/js": "23.2.0-beta.3"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"nx": "23.2.0-beta.
|
|
86
|
+
"nx": "23.2.0-beta.3"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"@playwright/test": "^1.36.0"
|