eslint-linter-browserify 10.2.0 → 10.2.1

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/linter.cjs CHANGED
@@ -4216,7 +4216,7 @@ function requireEslintVisitorKeys$2 () {
4216
4216
  return eslintVisitorKeys$2;
4217
4217
  }
4218
4218
 
4219
- var version = "10.2.0";
4219
+ var version = "10.2.1";
4220
4220
  var require$$3$1 = {
4221
4221
  version: version};
4222
4222
 
@@ -11523,11 +11523,10 @@ function requireCodePathState () {
11523
11523
  this.position = "try";
11524
11524
 
11525
11525
  /**
11526
- * If the `try` statement has a `finally` block, this affects how a
11527
- * `return` statement behaves in the `try` block. Without `finally`,
11528
- * `return` behaves as usual and doesn't require a fork; with `finally`,
11529
- * `return` forks into the `finally` block, so we need a fork context
11530
- * to track it.
11526
+ * If the `try` statement has a `finally` block, this affects how return-like
11527
+ * leaving paths behave in the `try` block. Without `finally`, they behave as
11528
+ * usual and don't require a fork; with `finally`, they fork into the
11529
+ * `finally` block, so we need a fork context to track them.
11531
11530
  * @type {ForkContext|null}
11532
11531
  */
11533
11532
  this.returnedForkContext = hasFinalizer
@@ -12709,6 +12708,23 @@ function requireCodePathState () {
12709
12708
  this.forkContext.add(segments);
12710
12709
  }
12711
12710
 
12711
+ /**
12712
+ * Records abrupt resumption paths from a suspended `yield` expression,
12713
+ * then splits normal post-`yield` continuation into a fresh segment.
12714
+ * @returns {void}
12715
+ */
12716
+ makeYield() {
12717
+ const forkContext = this.forkContext;
12718
+ const leavingSegments = forkContext.head;
12719
+
12720
+ if (forkContext.reachable) {
12721
+ getReturnContext(this).returnedForkContext.add(leavingSegments);
12722
+ getThrowContext(this).thrownForkContext.add(leavingSegments);
12723
+
12724
+ forkContext.replaceHead(forkContext.makeNext(-1, -1));
12725
+ }
12726
+ }
12727
+
12712
12728
  /**
12713
12729
  * Makes a code path segment from the first throwable node to the `catch`
12714
12730
  * block or the `finally` block.
@@ -13484,9 +13500,10 @@ function requireCodePath () {
13484
13500
  * Final code path segments that represent normal completion of the code path.
13485
13501
  * For functions, this means both explicit `return` statements and implicit returns,
13486
13502
  * such as the last reachable segment in a function that does not have an
13487
- * explicit `return` as this implicitly returns `undefined`. For scripts,
13488
- * modules, class field initializers, and class static blocks, this means
13489
- * all lines of code have been executed.
13503
+ * explicit `return` as this implicitly returns `undefined`, as well as
13504
+ * return-like exits from suspended `yield` expressions. For scripts, modules,
13505
+ * class field initializers, and class static blocks, this means all lines of
13506
+ * code have been executed.
13490
13507
  * These segments are also present in `finalSegments`.
13491
13508
  * This is a passthrough to the underlying `CodePathState`.
13492
13509
  * @type {CodePathSegment[]}
@@ -13496,7 +13513,8 @@ function requireCodePath () {
13496
13513
  }
13497
13514
 
13498
13515
  /**
13499
- * Final code path segments that represent `throw` statements.
13516
+ * Final code path segments that represent `throw` statements and throw-like
13517
+ * exits from suspended `yield` expressions.
13500
13518
  * This is a passthrough to the underlying `CodePathState`.
13501
13519
  * These segments are also present in `finalSegments`.
13502
13520
  * @type {CodePathSegment[]}
@@ -13755,7 +13773,7 @@ function requireCodePathAnalyzer () {
13755
13773
 
13756
13774
  /**
13757
13775
  * Checks if a given node appears as the value of a PropertyDefinition node.
13758
- * @param {ASTNode} node THe node to check.
13776
+ * @param {ASTNode} node The node to check.
13759
13777
  * @returns {boolean} `true` if the node is a PropertyDefinition value,
13760
13778
  * false if not.
13761
13779
  */
@@ -14225,7 +14243,7 @@ function requireCodePathAnalyzer () {
14225
14243
 
14226
14244
  case "SwitchCase":
14227
14245
  /*
14228
- * Fork if this node is after the 2st node in `cases`.
14246
+ * Fork if this node is after the 1st node in `cases`.
14229
14247
  * It's similar to `else` blocks.
14230
14248
  * The next `test` node is processed in this path.
14231
14249
  */
@@ -14344,10 +14362,13 @@ function requireCodePathAnalyzer () {
14344
14362
  case "ImportExpression":
14345
14363
  case "MemberExpression":
14346
14364
  case "NewExpression":
14347
- case "YieldExpression":
14348
14365
  state.makeFirstThrowablePathInTryBlock();
14349
14366
  break;
14350
14367
 
14368
+ case "YieldExpression":
14369
+ state.makeYield();
14370
+ break;
14371
+
14351
14372
  case "WhileStatement":
14352
14373
  case "DoWhileStatement":
14353
14374
  case "ForStatement":
@@ -19283,15 +19304,16 @@ function requireFlatConfigSchema () {
19283
19304
  }
19284
19305
 
19285
19306
  /**
19286
- * Validates that a given string is the form pluginName/objectName.
19307
+ * Validates that a given string matches the "pluginName/memberPlaceholder" pattern.
19287
19308
  * @param {string} value The string to check.
19309
+ * @param {string} memberPlaceholder The placeholder for the member portion of the expected format in the error message.
19288
19310
  * @returns {void}
19289
- * @throws {TypeError} If the string isn't in the correct format.
19311
+ * @throws {TypeError} If the string doesn't match the expected pattern.
19290
19312
  */
19291
- function assertIsPluginMemberName(value) {
19313
+ function assertIsPluginMemberName(value, memberPlaceholder) {
19292
19314
  if (!/[\w\-@$]+(?:\/[\w\-$]+)+$/iu.test(value)) {
19293
19315
  throw new TypeError(
19294
- `Expected string in the form "pluginName/objectName" but found "${value}".`,
19316
+ `Expected string in the form "pluginName/${memberPlaceholder}" but found "${value}".`,
19295
19317
  );
19296
19318
  }
19297
19319
  }
@@ -19434,7 +19456,9 @@ function requireFlatConfigSchema () {
19434
19456
  /** @type {ObjectPropertySchema} */
19435
19457
  const languageSchema = {
19436
19458
  merge: "replace",
19437
- validate: assertIsPluginMemberName,
19459
+ validate(value) {
19460
+ assertIsPluginMemberName(value, "languageName");
19461
+ },
19438
19462
  };
19439
19463
 
19440
19464
  /** @type {ObjectPropertySchema} */
@@ -19489,7 +19513,7 @@ function requireFlatConfigSchema () {
19489
19513
  merge: "replace",
19490
19514
  validate(value) {
19491
19515
  if (typeof value === "string") {
19492
- assertIsPluginMemberName(value);
19516
+ assertIsPluginMemberName(value, "processorName");
19493
19517
  } else if (value && typeof value === "object") {
19494
19518
  if (
19495
19519
  typeof value.preprocess !== "function" ||
@@ -73973,12 +73997,18 @@ function requireNoAsyncPromiseExecutor () {
73973
73997
  },
73974
73998
 
73975
73999
  create(context) {
74000
+ const sourceCode = context.sourceCode;
74001
+
73976
74002
  return {
73977
74003
  "NewExpression[callee.name='Promise'][arguments.0.async=true]"(
73978
74004
  node,
73979
74005
  ) {
74006
+ if (!sourceCode.isGlobalReference(node.callee)) {
74007
+ return;
74008
+ }
74009
+
73980
74010
  context.report({
73981
- node: context.sourceCode.getFirstToken(
74011
+ node: sourceCode.getFirstToken(
73982
74012
  node.arguments[0],
73983
74013
  token => token.value === "async",
73984
74014
  ),
@@ -98974,7 +99004,7 @@ function requireNoShadow () {
98974
99004
 
98975
99005
  /**
98976
99006
  * Checks the current context for shadowed variables.
98977
- * @param {Scope} scope Fixme
99007
+ * @param {Scope} scope The scope to check for shadowed variables.
98978
99008
  * @returns {void}
98979
99009
  */
98980
99010
  function checkForShadows(scope) {
package/linter.js CHANGED
@@ -4218,7 +4218,7 @@
4218
4218
  return eslintVisitorKeys$2;
4219
4219
  }
4220
4220
 
4221
- var version = "10.2.0";
4221
+ var version = "10.2.1";
4222
4222
  var require$$3$1 = {
4223
4223
  version: version};
4224
4224
 
@@ -11525,11 +11525,10 @@
11525
11525
  this.position = "try";
11526
11526
 
11527
11527
  /**
11528
- * If the `try` statement has a `finally` block, this affects how a
11529
- * `return` statement behaves in the `try` block. Without `finally`,
11530
- * `return` behaves as usual and doesn't require a fork; with `finally`,
11531
- * `return` forks into the `finally` block, so we need a fork context
11532
- * to track it.
11528
+ * If the `try` statement has a `finally` block, this affects how return-like
11529
+ * leaving paths behave in the `try` block. Without `finally`, they behave as
11530
+ * usual and don't require a fork; with `finally`, they fork into the
11531
+ * `finally` block, so we need a fork context to track them.
11533
11532
  * @type {ForkContext|null}
11534
11533
  */
11535
11534
  this.returnedForkContext = hasFinalizer
@@ -12711,6 +12710,23 @@
12711
12710
  this.forkContext.add(segments);
12712
12711
  }
12713
12712
 
12713
+ /**
12714
+ * Records abrupt resumption paths from a suspended `yield` expression,
12715
+ * then splits normal post-`yield` continuation into a fresh segment.
12716
+ * @returns {void}
12717
+ */
12718
+ makeYield() {
12719
+ const forkContext = this.forkContext;
12720
+ const leavingSegments = forkContext.head;
12721
+
12722
+ if (forkContext.reachable) {
12723
+ getReturnContext(this).returnedForkContext.add(leavingSegments);
12724
+ getThrowContext(this).thrownForkContext.add(leavingSegments);
12725
+
12726
+ forkContext.replaceHead(forkContext.makeNext(-1, -1));
12727
+ }
12728
+ }
12729
+
12714
12730
  /**
12715
12731
  * Makes a code path segment from the first throwable node to the `catch`
12716
12732
  * block or the `finally` block.
@@ -13486,9 +13502,10 @@
13486
13502
  * Final code path segments that represent normal completion of the code path.
13487
13503
  * For functions, this means both explicit `return` statements and implicit returns,
13488
13504
  * such as the last reachable segment in a function that does not have an
13489
- * explicit `return` as this implicitly returns `undefined`. For scripts,
13490
- * modules, class field initializers, and class static blocks, this means
13491
- * all lines of code have been executed.
13505
+ * explicit `return` as this implicitly returns `undefined`, as well as
13506
+ * return-like exits from suspended `yield` expressions. For scripts, modules,
13507
+ * class field initializers, and class static blocks, this means all lines of
13508
+ * code have been executed.
13492
13509
  * These segments are also present in `finalSegments`.
13493
13510
  * This is a passthrough to the underlying `CodePathState`.
13494
13511
  * @type {CodePathSegment[]}
@@ -13498,7 +13515,8 @@
13498
13515
  }
13499
13516
 
13500
13517
  /**
13501
- * Final code path segments that represent `throw` statements.
13518
+ * Final code path segments that represent `throw` statements and throw-like
13519
+ * exits from suspended `yield` expressions.
13502
13520
  * This is a passthrough to the underlying `CodePathState`.
13503
13521
  * These segments are also present in `finalSegments`.
13504
13522
  * @type {CodePathSegment[]}
@@ -13757,7 +13775,7 @@
13757
13775
 
13758
13776
  /**
13759
13777
  * Checks if a given node appears as the value of a PropertyDefinition node.
13760
- * @param {ASTNode} node THe node to check.
13778
+ * @param {ASTNode} node The node to check.
13761
13779
  * @returns {boolean} `true` if the node is a PropertyDefinition value,
13762
13780
  * false if not.
13763
13781
  */
@@ -14227,7 +14245,7 @@
14227
14245
 
14228
14246
  case "SwitchCase":
14229
14247
  /*
14230
- * Fork if this node is after the 2st node in `cases`.
14248
+ * Fork if this node is after the 1st node in `cases`.
14231
14249
  * It's similar to `else` blocks.
14232
14250
  * The next `test` node is processed in this path.
14233
14251
  */
@@ -14346,10 +14364,13 @@
14346
14364
  case "ImportExpression":
14347
14365
  case "MemberExpression":
14348
14366
  case "NewExpression":
14349
- case "YieldExpression":
14350
14367
  state.makeFirstThrowablePathInTryBlock();
14351
14368
  break;
14352
14369
 
14370
+ case "YieldExpression":
14371
+ state.makeYield();
14372
+ break;
14373
+
14353
14374
  case "WhileStatement":
14354
14375
  case "DoWhileStatement":
14355
14376
  case "ForStatement":
@@ -19285,15 +19306,16 @@
19285
19306
  }
19286
19307
 
19287
19308
  /**
19288
- * Validates that a given string is the form pluginName/objectName.
19309
+ * Validates that a given string matches the "pluginName/memberPlaceholder" pattern.
19289
19310
  * @param {string} value The string to check.
19311
+ * @param {string} memberPlaceholder The placeholder for the member portion of the expected format in the error message.
19290
19312
  * @returns {void}
19291
- * @throws {TypeError} If the string isn't in the correct format.
19313
+ * @throws {TypeError} If the string doesn't match the expected pattern.
19292
19314
  */
19293
- function assertIsPluginMemberName(value) {
19315
+ function assertIsPluginMemberName(value, memberPlaceholder) {
19294
19316
  if (!/[\w\-@$]+(?:\/[\w\-$]+)+$/iu.test(value)) {
19295
19317
  throw new TypeError(
19296
- `Expected string in the form "pluginName/objectName" but found "${value}".`,
19318
+ `Expected string in the form "pluginName/${memberPlaceholder}" but found "${value}".`,
19297
19319
  );
19298
19320
  }
19299
19321
  }
@@ -19436,7 +19458,9 @@
19436
19458
  /** @type {ObjectPropertySchema} */
19437
19459
  const languageSchema = {
19438
19460
  merge: "replace",
19439
- validate: assertIsPluginMemberName,
19461
+ validate(value) {
19462
+ assertIsPluginMemberName(value, "languageName");
19463
+ },
19440
19464
  };
19441
19465
 
19442
19466
  /** @type {ObjectPropertySchema} */
@@ -19491,7 +19515,7 @@
19491
19515
  merge: "replace",
19492
19516
  validate(value) {
19493
19517
  if (typeof value === "string") {
19494
- assertIsPluginMemberName(value);
19518
+ assertIsPluginMemberName(value, "processorName");
19495
19519
  } else if (value && typeof value === "object") {
19496
19520
  if (
19497
19521
  typeof value.preprocess !== "function" ||
@@ -73975,12 +73999,18 @@
73975
73999
  },
73976
74000
 
73977
74001
  create(context) {
74002
+ const sourceCode = context.sourceCode;
74003
+
73978
74004
  return {
73979
74005
  "NewExpression[callee.name='Promise'][arguments.0.async=true]"(
73980
74006
  node,
73981
74007
  ) {
74008
+ if (!sourceCode.isGlobalReference(node.callee)) {
74009
+ return;
74010
+ }
74011
+
73982
74012
  context.report({
73983
- node: context.sourceCode.getFirstToken(
74013
+ node: sourceCode.getFirstToken(
73984
74014
  node.arguments[0],
73985
74015
  token => token.value === "async",
73986
74016
  ),
@@ -98976,7 +99006,7 @@
98976
99006
 
98977
99007
  /**
98978
99008
  * Checks the current context for shadowed variables.
98979
- * @param {Scope} scope Fixme
99009
+ * @param {Scope} scope The scope to check for shadowed variables.
98980
99010
  * @returns {void}
98981
99011
  */
98982
99012
  function checkForShadows(scope) {