eslint-plugin-playwright 1.5.1 → 1.5.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/README.md CHANGED
@@ -37,7 +37,7 @@ This plugin bundles two configurations to work with both `@playwright/test` or
37
37
  (**eslint.config.js**)
38
38
 
39
39
  ```javascript
40
- import playwright from 'eslint-plugin-playwright';
40
+ import playwright from 'eslint-plugin-playwright'
41
41
 
42
42
  export default [
43
43
  playwright.configs['flat/recommended'],
@@ -47,7 +47,7 @@ export default [
47
47
  // ...
48
48
  },
49
49
  },
50
- ];
50
+ ]
51
51
  ```
52
52
 
53
53
  [Legacy config](https://eslint.org/docs/latest/use/configure/configuration-files)
@@ -65,8 +65,8 @@ export default [
65
65
  (**eslint.config.js**)
66
66
 
67
67
  ```javascript
68
- import playwright from 'eslint-plugin-playwright';
69
- import jest from 'eslint-plugin-jest';
68
+ import playwright from 'eslint-plugin-playwright'
69
+ import jest from 'eslint-plugin-jest'
70
70
 
71
71
  export default [
72
72
  playwright.configs['flat/jest-playwright'],
@@ -79,7 +79,7 @@ export default [
79
79
  // ...
80
80
  },
81
81
  },
82
- ];
82
+ ]
83
83
  ```
84
84
 
85
85
  [Legacy config](https://eslint.org/docs/latest/use/configure/configuration-files)
package/dist/index.d.mts CHANGED
@@ -60,11 +60,11 @@ declare const _default: {
60
60
  };
61
61
  };
62
62
  rules: {
63
- 'jest/no-standalone-expect': (string | {
64
- additionalTestBlockFunctions: string[];
65
- })[];
66
- 'playwright/missing-playwright-await': string;
67
- 'playwright/no-page-pause': string;
63
+ readonly 'jest/no-standalone-expect': readonly ["error", {
64
+ readonly additionalTestBlockFunctions: readonly ["test.jestPlaywrightDebug", "it.jestPlaywrightDebug", "test.jestPlaywrightSkip", "it.jestPlaywrightSkip", "test.jestPlaywrightConfig", "it.jestPlaywrightConfig"];
65
+ }];
66
+ readonly 'playwright/missing-playwright-await': "error";
67
+ readonly 'playwright/no-page-pause': "warn";
68
68
  };
69
69
  };
70
70
  'flat/recommended': {
@@ -125,31 +125,31 @@ declare const _default: {
125
125
  };
126
126
  };
127
127
  rules: {
128
- 'no-empty-pattern': string;
129
- 'playwright/expect-expect': string;
130
- 'playwright/max-nested-describe': string;
131
- 'playwright/missing-playwright-await': string;
132
- 'playwright/no-conditional-expect': string;
133
- 'playwright/no-conditional-in-test': string;
134
- 'playwright/no-element-handle': string;
135
- 'playwright/no-eval': string;
136
- 'playwright/no-focused-test': string;
137
- 'playwright/no-force-option': string;
138
- 'playwright/no-nested-step': string;
139
- 'playwright/no-networkidle': string;
140
- 'playwright/no-page-pause': string;
141
- 'playwright/no-skipped-test': string;
142
- 'playwright/no-standalone-expect': string;
143
- 'playwright/no-unsafe-references': string;
144
- 'playwright/no-useless-await': string;
145
- 'playwright/no-useless-not': string;
146
- 'playwright/no-wait-for-selector': string;
147
- 'playwright/no-wait-for-timeout': string;
148
- 'playwright/prefer-web-first-assertions': string;
149
- 'playwright/valid-describe-callback': string;
150
- 'playwright/valid-expect': string;
151
- 'playwright/valid-expect-in-promise': string;
152
- 'playwright/valid-title': string;
128
+ readonly 'no-empty-pattern': "off";
129
+ readonly 'playwright/expect-expect': "warn";
130
+ readonly 'playwright/max-nested-describe': "warn";
131
+ readonly 'playwright/missing-playwright-await': "error";
132
+ readonly 'playwright/no-conditional-expect': "warn";
133
+ readonly 'playwright/no-conditional-in-test': "warn";
134
+ readonly 'playwright/no-element-handle': "warn";
135
+ readonly 'playwright/no-eval': "warn";
136
+ readonly 'playwright/no-focused-test': "error";
137
+ readonly 'playwright/no-force-option': "warn";
138
+ readonly 'playwright/no-nested-step': "warn";
139
+ readonly 'playwright/no-networkidle': "error";
140
+ readonly 'playwright/no-page-pause': "warn";
141
+ readonly 'playwright/no-skipped-test': "warn";
142
+ readonly 'playwright/no-standalone-expect': "error";
143
+ readonly 'playwright/no-unsafe-references': "error";
144
+ readonly 'playwright/no-useless-await': "warn";
145
+ readonly 'playwright/no-useless-not': "warn";
146
+ readonly 'playwright/no-wait-for-selector': "warn";
147
+ readonly 'playwright/no-wait-for-timeout': "warn";
148
+ readonly 'playwright/prefer-web-first-assertions': "error";
149
+ readonly 'playwright/valid-describe-callback': "error";
150
+ readonly 'playwright/valid-expect': "error";
151
+ readonly 'playwright/valid-expect-in-promise': "error";
152
+ readonly 'playwright/valid-title': "error";
153
153
  };
154
154
  };
155
155
  'jest-playwright': {
@@ -167,11 +167,11 @@ declare const _default: {
167
167
  };
168
168
  plugins: string[];
169
169
  rules: {
170
- 'jest/no-standalone-expect': (string | {
171
- additionalTestBlockFunctions: string[];
172
- })[];
173
- 'playwright/missing-playwright-await': string;
174
- 'playwright/no-page-pause': string;
170
+ readonly 'jest/no-standalone-expect': readonly ["error", {
171
+ readonly additionalTestBlockFunctions: readonly ["test.jestPlaywrightDebug", "it.jestPlaywrightDebug", "test.jestPlaywrightSkip", "it.jestPlaywrightSkip", "test.jestPlaywrightConfig", "it.jestPlaywrightConfig"];
172
+ }];
173
+ readonly 'playwright/missing-playwright-await': "error";
174
+ readonly 'playwright/no-page-pause': "warn";
175
175
  };
176
176
  };
177
177
  'playwright-test': {
@@ -180,31 +180,31 @@ declare const _default: {
180
180
  };
181
181
  plugins: string[];
182
182
  rules: {
183
- 'no-empty-pattern': string;
184
- 'playwright/expect-expect': string;
185
- 'playwright/max-nested-describe': string;
186
- 'playwright/missing-playwright-await': string;
187
- 'playwright/no-conditional-expect': string;
188
- 'playwright/no-conditional-in-test': string;
189
- 'playwright/no-element-handle': string;
190
- 'playwright/no-eval': string;
191
- 'playwright/no-focused-test': string;
192
- 'playwright/no-force-option': string;
193
- 'playwright/no-nested-step': string;
194
- 'playwright/no-networkidle': string;
195
- 'playwright/no-page-pause': string;
196
- 'playwright/no-skipped-test': string;
197
- 'playwright/no-standalone-expect': string;
198
- 'playwright/no-unsafe-references': string;
199
- 'playwright/no-useless-await': string;
200
- 'playwright/no-useless-not': string;
201
- 'playwright/no-wait-for-selector': string;
202
- 'playwright/no-wait-for-timeout': string;
203
- 'playwright/prefer-web-first-assertions': string;
204
- 'playwright/valid-describe-callback': string;
205
- 'playwright/valid-expect': string;
206
- 'playwright/valid-expect-in-promise': string;
207
- 'playwright/valid-title': string;
183
+ readonly 'no-empty-pattern': "off";
184
+ readonly 'playwright/expect-expect': "warn";
185
+ readonly 'playwright/max-nested-describe': "warn";
186
+ readonly 'playwright/missing-playwright-await': "error";
187
+ readonly 'playwright/no-conditional-expect': "warn";
188
+ readonly 'playwright/no-conditional-in-test': "warn";
189
+ readonly 'playwright/no-element-handle': "warn";
190
+ readonly 'playwright/no-eval': "warn";
191
+ readonly 'playwright/no-focused-test': "error";
192
+ readonly 'playwright/no-force-option': "warn";
193
+ readonly 'playwright/no-nested-step': "warn";
194
+ readonly 'playwright/no-networkidle': "error";
195
+ readonly 'playwright/no-page-pause': "warn";
196
+ readonly 'playwright/no-skipped-test': "warn";
197
+ readonly 'playwright/no-standalone-expect': "error";
198
+ readonly 'playwright/no-unsafe-references': "error";
199
+ readonly 'playwright/no-useless-await': "warn";
200
+ readonly 'playwright/no-useless-not': "warn";
201
+ readonly 'playwright/no-wait-for-selector': "warn";
202
+ readonly 'playwright/no-wait-for-timeout': "warn";
203
+ readonly 'playwright/prefer-web-first-assertions': "error";
204
+ readonly 'playwright/valid-describe-callback': "error";
205
+ readonly 'playwright/valid-expect': "error";
206
+ readonly 'playwright/valid-expect-in-promise': "error";
207
+ readonly 'playwright/valid-title': "error";
208
208
  };
209
209
  };
210
210
  recommended: {
@@ -213,31 +213,31 @@ declare const _default: {
213
213
  };
214
214
  plugins: string[];
215
215
  rules: {
216
- 'no-empty-pattern': string;
217
- 'playwright/expect-expect': string;
218
- 'playwright/max-nested-describe': string;
219
- 'playwright/missing-playwright-await': string;
220
- 'playwright/no-conditional-expect': string;
221
- 'playwright/no-conditional-in-test': string;
222
- 'playwright/no-element-handle': string;
223
- 'playwright/no-eval': string;
224
- 'playwright/no-focused-test': string;
225
- 'playwright/no-force-option': string;
226
- 'playwright/no-nested-step': string;
227
- 'playwright/no-networkidle': string;
228
- 'playwright/no-page-pause': string;
229
- 'playwright/no-skipped-test': string;
230
- 'playwright/no-standalone-expect': string;
231
- 'playwright/no-unsafe-references': string;
232
- 'playwright/no-useless-await': string;
233
- 'playwright/no-useless-not': string;
234
- 'playwright/no-wait-for-selector': string;
235
- 'playwright/no-wait-for-timeout': string;
236
- 'playwright/prefer-web-first-assertions': string;
237
- 'playwright/valid-describe-callback': string;
238
- 'playwright/valid-expect': string;
239
- 'playwright/valid-expect-in-promise': string;
240
- 'playwright/valid-title': string;
216
+ readonly 'no-empty-pattern': "off";
217
+ readonly 'playwright/expect-expect': "warn";
218
+ readonly 'playwright/max-nested-describe': "warn";
219
+ readonly 'playwright/missing-playwright-await': "error";
220
+ readonly 'playwright/no-conditional-expect': "warn";
221
+ readonly 'playwright/no-conditional-in-test': "warn";
222
+ readonly 'playwright/no-element-handle': "warn";
223
+ readonly 'playwright/no-eval': "warn";
224
+ readonly 'playwright/no-focused-test': "error";
225
+ readonly 'playwright/no-force-option': "warn";
226
+ readonly 'playwright/no-nested-step': "warn";
227
+ readonly 'playwright/no-networkidle': "error";
228
+ readonly 'playwright/no-page-pause': "warn";
229
+ readonly 'playwright/no-skipped-test': "warn";
230
+ readonly 'playwright/no-standalone-expect': "error";
231
+ readonly 'playwright/no-unsafe-references': "error";
232
+ readonly 'playwright/no-useless-await': "warn";
233
+ readonly 'playwright/no-useless-not': "warn";
234
+ readonly 'playwright/no-wait-for-selector': "warn";
235
+ readonly 'playwright/no-wait-for-timeout': "warn";
236
+ readonly 'playwright/prefer-web-first-assertions': "error";
237
+ readonly 'playwright/valid-describe-callback': "error";
238
+ readonly 'playwright/valid-expect': "error";
239
+ readonly 'playwright/valid-expect-in-promise': "error";
240
+ readonly 'playwright/valid-title': "error";
241
241
  };
242
242
  };
243
243
  };
package/dist/index.d.ts CHANGED
@@ -60,11 +60,11 @@ declare const _default: {
60
60
  };
61
61
  };
62
62
  rules: {
63
- 'jest/no-standalone-expect': (string | {
64
- additionalTestBlockFunctions: string[];
65
- })[];
66
- 'playwright/missing-playwright-await': string;
67
- 'playwright/no-page-pause': string;
63
+ readonly 'jest/no-standalone-expect': readonly ["error", {
64
+ readonly additionalTestBlockFunctions: readonly ["test.jestPlaywrightDebug", "it.jestPlaywrightDebug", "test.jestPlaywrightSkip", "it.jestPlaywrightSkip", "test.jestPlaywrightConfig", "it.jestPlaywrightConfig"];
65
+ }];
66
+ readonly 'playwright/missing-playwright-await': "error";
67
+ readonly 'playwright/no-page-pause': "warn";
68
68
  };
69
69
  };
70
70
  'flat/recommended': {
@@ -125,31 +125,31 @@ declare const _default: {
125
125
  };
126
126
  };
127
127
  rules: {
128
- 'no-empty-pattern': string;
129
- 'playwright/expect-expect': string;
130
- 'playwright/max-nested-describe': string;
131
- 'playwright/missing-playwright-await': string;
132
- 'playwright/no-conditional-expect': string;
133
- 'playwright/no-conditional-in-test': string;
134
- 'playwright/no-element-handle': string;
135
- 'playwright/no-eval': string;
136
- 'playwright/no-focused-test': string;
137
- 'playwright/no-force-option': string;
138
- 'playwright/no-nested-step': string;
139
- 'playwright/no-networkidle': string;
140
- 'playwright/no-page-pause': string;
141
- 'playwright/no-skipped-test': string;
142
- 'playwright/no-standalone-expect': string;
143
- 'playwright/no-unsafe-references': string;
144
- 'playwright/no-useless-await': string;
145
- 'playwright/no-useless-not': string;
146
- 'playwright/no-wait-for-selector': string;
147
- 'playwright/no-wait-for-timeout': string;
148
- 'playwright/prefer-web-first-assertions': string;
149
- 'playwright/valid-describe-callback': string;
150
- 'playwright/valid-expect': string;
151
- 'playwright/valid-expect-in-promise': string;
152
- 'playwright/valid-title': string;
128
+ readonly 'no-empty-pattern': "off";
129
+ readonly 'playwright/expect-expect': "warn";
130
+ readonly 'playwright/max-nested-describe': "warn";
131
+ readonly 'playwright/missing-playwright-await': "error";
132
+ readonly 'playwright/no-conditional-expect': "warn";
133
+ readonly 'playwright/no-conditional-in-test': "warn";
134
+ readonly 'playwright/no-element-handle': "warn";
135
+ readonly 'playwright/no-eval': "warn";
136
+ readonly 'playwright/no-focused-test': "error";
137
+ readonly 'playwright/no-force-option': "warn";
138
+ readonly 'playwright/no-nested-step': "warn";
139
+ readonly 'playwright/no-networkidle': "error";
140
+ readonly 'playwright/no-page-pause': "warn";
141
+ readonly 'playwright/no-skipped-test': "warn";
142
+ readonly 'playwright/no-standalone-expect': "error";
143
+ readonly 'playwright/no-unsafe-references': "error";
144
+ readonly 'playwright/no-useless-await': "warn";
145
+ readonly 'playwright/no-useless-not': "warn";
146
+ readonly 'playwright/no-wait-for-selector': "warn";
147
+ readonly 'playwright/no-wait-for-timeout': "warn";
148
+ readonly 'playwright/prefer-web-first-assertions': "error";
149
+ readonly 'playwright/valid-describe-callback': "error";
150
+ readonly 'playwright/valid-expect': "error";
151
+ readonly 'playwright/valid-expect-in-promise': "error";
152
+ readonly 'playwright/valid-title': "error";
153
153
  };
154
154
  };
155
155
  'jest-playwright': {
@@ -167,11 +167,11 @@ declare const _default: {
167
167
  };
168
168
  plugins: string[];
169
169
  rules: {
170
- 'jest/no-standalone-expect': (string | {
171
- additionalTestBlockFunctions: string[];
172
- })[];
173
- 'playwright/missing-playwright-await': string;
174
- 'playwright/no-page-pause': string;
170
+ readonly 'jest/no-standalone-expect': readonly ["error", {
171
+ readonly additionalTestBlockFunctions: readonly ["test.jestPlaywrightDebug", "it.jestPlaywrightDebug", "test.jestPlaywrightSkip", "it.jestPlaywrightSkip", "test.jestPlaywrightConfig", "it.jestPlaywrightConfig"];
172
+ }];
173
+ readonly 'playwright/missing-playwright-await': "error";
174
+ readonly 'playwright/no-page-pause': "warn";
175
175
  };
176
176
  };
177
177
  'playwright-test': {
@@ -180,31 +180,31 @@ declare const _default: {
180
180
  };
181
181
  plugins: string[];
182
182
  rules: {
183
- 'no-empty-pattern': string;
184
- 'playwright/expect-expect': string;
185
- 'playwright/max-nested-describe': string;
186
- 'playwright/missing-playwright-await': string;
187
- 'playwright/no-conditional-expect': string;
188
- 'playwright/no-conditional-in-test': string;
189
- 'playwright/no-element-handle': string;
190
- 'playwright/no-eval': string;
191
- 'playwright/no-focused-test': string;
192
- 'playwright/no-force-option': string;
193
- 'playwright/no-nested-step': string;
194
- 'playwright/no-networkidle': string;
195
- 'playwright/no-page-pause': string;
196
- 'playwright/no-skipped-test': string;
197
- 'playwright/no-standalone-expect': string;
198
- 'playwright/no-unsafe-references': string;
199
- 'playwright/no-useless-await': string;
200
- 'playwright/no-useless-not': string;
201
- 'playwright/no-wait-for-selector': string;
202
- 'playwright/no-wait-for-timeout': string;
203
- 'playwright/prefer-web-first-assertions': string;
204
- 'playwright/valid-describe-callback': string;
205
- 'playwright/valid-expect': string;
206
- 'playwright/valid-expect-in-promise': string;
207
- 'playwright/valid-title': string;
183
+ readonly 'no-empty-pattern': "off";
184
+ readonly 'playwright/expect-expect': "warn";
185
+ readonly 'playwright/max-nested-describe': "warn";
186
+ readonly 'playwright/missing-playwright-await': "error";
187
+ readonly 'playwright/no-conditional-expect': "warn";
188
+ readonly 'playwright/no-conditional-in-test': "warn";
189
+ readonly 'playwright/no-element-handle': "warn";
190
+ readonly 'playwright/no-eval': "warn";
191
+ readonly 'playwright/no-focused-test': "error";
192
+ readonly 'playwright/no-force-option': "warn";
193
+ readonly 'playwright/no-nested-step': "warn";
194
+ readonly 'playwright/no-networkidle': "error";
195
+ readonly 'playwright/no-page-pause': "warn";
196
+ readonly 'playwright/no-skipped-test': "warn";
197
+ readonly 'playwright/no-standalone-expect': "error";
198
+ readonly 'playwright/no-unsafe-references': "error";
199
+ readonly 'playwright/no-useless-await': "warn";
200
+ readonly 'playwright/no-useless-not': "warn";
201
+ readonly 'playwright/no-wait-for-selector': "warn";
202
+ readonly 'playwright/no-wait-for-timeout': "warn";
203
+ readonly 'playwright/prefer-web-first-assertions': "error";
204
+ readonly 'playwright/valid-describe-callback': "error";
205
+ readonly 'playwright/valid-expect': "error";
206
+ readonly 'playwright/valid-expect-in-promise': "error";
207
+ readonly 'playwright/valid-title': "error";
208
208
  };
209
209
  };
210
210
  recommended: {
@@ -213,31 +213,31 @@ declare const _default: {
213
213
  };
214
214
  plugins: string[];
215
215
  rules: {
216
- 'no-empty-pattern': string;
217
- 'playwright/expect-expect': string;
218
- 'playwright/max-nested-describe': string;
219
- 'playwright/missing-playwright-await': string;
220
- 'playwright/no-conditional-expect': string;
221
- 'playwright/no-conditional-in-test': string;
222
- 'playwright/no-element-handle': string;
223
- 'playwright/no-eval': string;
224
- 'playwright/no-focused-test': string;
225
- 'playwright/no-force-option': string;
226
- 'playwright/no-nested-step': string;
227
- 'playwright/no-networkidle': string;
228
- 'playwright/no-page-pause': string;
229
- 'playwright/no-skipped-test': string;
230
- 'playwright/no-standalone-expect': string;
231
- 'playwright/no-unsafe-references': string;
232
- 'playwright/no-useless-await': string;
233
- 'playwright/no-useless-not': string;
234
- 'playwright/no-wait-for-selector': string;
235
- 'playwright/no-wait-for-timeout': string;
236
- 'playwright/prefer-web-first-assertions': string;
237
- 'playwright/valid-describe-callback': string;
238
- 'playwright/valid-expect': string;
239
- 'playwright/valid-expect-in-promise': string;
240
- 'playwright/valid-title': string;
216
+ readonly 'no-empty-pattern': "off";
217
+ readonly 'playwright/expect-expect': "warn";
218
+ readonly 'playwright/max-nested-describe': "warn";
219
+ readonly 'playwright/missing-playwright-await': "error";
220
+ readonly 'playwright/no-conditional-expect': "warn";
221
+ readonly 'playwright/no-conditional-in-test': "warn";
222
+ readonly 'playwright/no-element-handle': "warn";
223
+ readonly 'playwright/no-eval': "warn";
224
+ readonly 'playwright/no-focused-test': "error";
225
+ readonly 'playwright/no-force-option': "warn";
226
+ readonly 'playwright/no-nested-step': "warn";
227
+ readonly 'playwright/no-networkidle': "error";
228
+ readonly 'playwright/no-page-pause': "warn";
229
+ readonly 'playwright/no-skipped-test': "warn";
230
+ readonly 'playwright/no-standalone-expect': "error";
231
+ readonly 'playwright/no-unsafe-references': "error";
232
+ readonly 'playwright/no-useless-await': "warn";
233
+ readonly 'playwright/no-useless-not': "warn";
234
+ readonly 'playwright/no-wait-for-selector': "warn";
235
+ readonly 'playwright/no-wait-for-timeout': "warn";
236
+ readonly 'playwright/prefer-web-first-assertions': "error";
237
+ readonly 'playwright/valid-describe-callback': "error";
238
+ readonly 'playwright/valid-expect': "error";
239
+ readonly 'playwright/valid-expect-in-promise': "error";
240
+ readonly 'playwright/valid-title': "error";
241
241
  };
242
242
  };
243
243
  };
package/dist/index.js CHANGED
@@ -2630,7 +2630,7 @@ var supportedMatchers = /* @__PURE__ */ new Set([
2630
2630
  "toBeFalsy"
2631
2631
  ]);
2632
2632
  function dereference(context, node) {
2633
- if (node.type !== "Identifier") {
2633
+ if (node?.type !== "Identifier") {
2634
2634
  return node;
2635
2635
  }
2636
2636
  const scope = context.sourceCode.getScope(node);
@@ -2969,12 +2969,6 @@ var paramsLocation = (params) => {
2969
2969
  start: first.loc.start
2970
2970
  };
2971
2971
  };
2972
- function parseArgs(node) {
2973
- const [name, b, c] = node.arguments;
2974
- const options = node.arguments.length === 2 ? b : void 0;
2975
- const callback = node.arguments.length === 3 ? c : b;
2976
- return [name, options, callback];
2977
- }
2978
2972
  var valid_describe_callback_default = {
2979
2973
  create(context) {
2980
2974
  return {
@@ -2985,26 +2979,24 @@ var valid_describe_callback_default = {
2985
2979
  if (call.members.some((s) => getStringValue(s) === "configure")) {
2986
2980
  return;
2987
2981
  }
2988
- const [name, _, callback] = parseArgs(node);
2989
- if (node.arguments.length < 1) {
2982
+ const callback = node.arguments.at(-1);
2983
+ if (!callback) {
2990
2984
  return context.report({
2991
2985
  loc: node.loc,
2992
- messageId: "nameAndCallback"
2986
+ messageId: "missingCallback"
2993
2987
  });
2994
2988
  }
2995
- if (!name || !callback) {
2996
- context.report({
2989
+ if (node.arguments.length === 1 && isStringLiteral(callback)) {
2990
+ return context.report({
2997
2991
  loc: paramsLocation(node.arguments),
2998
- messageId: "nameAndCallback"
2992
+ messageId: "missingCallback"
2999
2993
  });
3000
- return;
3001
2994
  }
3002
2995
  if (!isFunction(callback)) {
3003
- context.report({
2996
+ return context.report({
3004
2997
  loc: paramsLocation(node.arguments),
3005
2998
  messageId: "invalidCallback"
3006
2999
  });
3007
- return;
3008
3000
  }
3009
3001
  if (callback.async) {
3010
3002
  context.report({
@@ -3046,7 +3038,7 @@ var valid_describe_callback_default = {
3046
3038
  },
3047
3039
  messages: {
3048
3040
  invalidCallback: "Callback argument must be a function",
3049
- nameAndCallback: "Describe requires name and callback arguments",
3041
+ missingCallback: "Describe requires a callback",
3050
3042
  noAsyncDescribeCallback: "No async describe callback",
3051
3043
  unexpectedDescribeArgument: "Unexpected argument(s) in describe callback",
3052
3044
  unexpectedReturnInDescribe: "Unexpected return statement in describe callback"
package/dist/index.mjs CHANGED
@@ -2880,7 +2880,7 @@ var init_prefer_to_have_length = __esm({
2880
2880
 
2881
2881
  // src/rules/prefer-web-first-assertions.ts
2882
2882
  function dereference(context, node) {
2883
- if (node.type !== "Identifier") {
2883
+ if (node?.type !== "Identifier") {
2884
2884
  return node;
2885
2885
  }
2886
2886
  const scope = context.sourceCode.getScope(node);
@@ -3292,12 +3292,6 @@ var init_require_top_level_describe = __esm({
3292
3292
  });
3293
3293
 
3294
3294
  // src/rules/valid-describe-callback.ts
3295
- function parseArgs(node) {
3296
- const [name, b, c] = node.arguments;
3297
- const options = node.arguments.length === 2 ? b : void 0;
3298
- const callback = node.arguments.length === 3 ? c : b;
3299
- return [name, options, callback];
3300
- }
3301
3295
  var paramsLocation, valid_describe_callback_default;
3302
3296
  var init_valid_describe_callback = __esm({
3303
3297
  "src/rules/valid-describe-callback.ts"() {
@@ -3322,26 +3316,24 @@ var init_valid_describe_callback = __esm({
3322
3316
  if (call.members.some((s) => getStringValue(s) === "configure")) {
3323
3317
  return;
3324
3318
  }
3325
- const [name, _, callback] = parseArgs(node);
3326
- if (node.arguments.length < 1) {
3319
+ const callback = node.arguments.at(-1);
3320
+ if (!callback) {
3327
3321
  return context.report({
3328
3322
  loc: node.loc,
3329
- messageId: "nameAndCallback"
3323
+ messageId: "missingCallback"
3330
3324
  });
3331
3325
  }
3332
- if (!name || !callback) {
3333
- context.report({
3326
+ if (node.arguments.length === 1 && isStringLiteral(callback)) {
3327
+ return context.report({
3334
3328
  loc: paramsLocation(node.arguments),
3335
- messageId: "nameAndCallback"
3329
+ messageId: "missingCallback"
3336
3330
  });
3337
- return;
3338
3331
  }
3339
3332
  if (!isFunction(callback)) {
3340
- context.report({
3333
+ return context.report({
3341
3334
  loc: paramsLocation(node.arguments),
3342
3335
  messageId: "invalidCallback"
3343
3336
  });
3344
- return;
3345
3337
  }
3346
3338
  if (callback.async) {
3347
3339
  context.report({
@@ -3383,7 +3375,7 @@ var init_valid_describe_callback = __esm({
3383
3375
  },
3384
3376
  messages: {
3385
3377
  invalidCallback: "Callback argument must be a function",
3386
- nameAndCallback: "Describe requires name and callback arguments",
3378
+ missingCallback: "Describe requires a callback",
3387
3379
  noAsyncDescribeCallback: "No async describe callback",
3388
3380
  unexpectedDescribeArgument: "Unexpected argument(s) in describe callback",
3389
3381
  unexpectedReturnInDescribe: "Unexpected return statement in describe callback"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-playwright",
3
3
  "description": "ESLint plugin for Playwright testing.",
4
- "version": "1.5.1",
4
+ "version": "1.5.3",
5
5
  "repository": "https://github.com/playwright-community/eslint-plugin-playwright",
6
6
  "author": "Mark Skelton <mark@mskelton.dev>",
7
7
  "packageManager": "pnpm@8.12.0",
@@ -32,8 +32,8 @@
32
32
  "scripts": {
33
33
  "build": "tsup src/index.ts --format cjs,esm --dts --out-dir dist",
34
34
  "lint": "eslint .",
35
- "format": "prettier --write .",
36
- "format:check": "prettier --check .",
35
+ "fmt": "prettier --write .",
36
+ "fmt:check": "prettier --check .",
37
37
  "test": "vitest",
38
38
  "test:watch": "vitest --reporter=dot",
39
39
  "ts": "tsc --noEmit"