eslint-linter-browserify 8.44.0 → 8.45.0

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
@@ -17038,7 +17038,7 @@ function requireLodash_merge () {
17038
17038
  }
17039
17039
 
17040
17040
  var name$1 = "eslint";
17041
- var version$1 = "8.44.0";
17041
+ var version$1 = "8.45.0";
17042
17042
  var author = "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>";
17043
17043
  var description$3 = "An AST-based pattern checker for JavaScript.";
17044
17044
  var bin = {
@@ -17110,7 +17110,6 @@ var dependencies$3 = {
17110
17110
  globals: "^13.19.0",
17111
17111
  graphemer: "^1.4.0",
17112
17112
  ignore: "^5.2.0",
17113
- "import-fresh": "^3.0.0",
17114
17113
  imurmurhash: "^0.1.4",
17115
17114
  "is-glob": "^4.0.0",
17116
17115
  "is-path-inside": "^3.0.3",
@@ -17122,7 +17121,6 @@ var dependencies$3 = {
17122
17121
  "natural-compare": "^1.4.0",
17123
17122
  optionator: "^0.9.3",
17124
17123
  "strip-ansi": "^6.0.1",
17125
- "strip-json-comments": "^3.1.0",
17126
17124
  "text-table": "^0.2.0"
17127
17125
  };
17128
17126
  var devDependencies$1 = {
@@ -17181,7 +17179,6 @@ var devDependencies$1 = {
17181
17179
  semver: "^7.5.3",
17182
17180
  shelljs: "^0.8.2",
17183
17181
  sinon: "^11.0.0",
17184
- temp: "^0.9.0",
17185
17182
  webpack: "^5.23.0",
17186
17183
  "webpack-cli": "^4.5.0",
17187
17184
  yorkie: "^2.0.0"
@@ -39998,6 +39995,22 @@ function requireReportTranslator () {
39998
39995
  return descriptor.node.loc;
39999
39996
  }
40000
39997
 
39998
+ /**
39999
+ * Clones the given fix object.
40000
+ * @param {Fix|null} fix The fix to clone.
40001
+ * @returns {Fix|null} Deep cloned fix object or `null` if `null` or `undefined` was passed in.
40002
+ */
40003
+ function cloneFix(fix) {
40004
+ if (!fix) {
40005
+ return null;
40006
+ }
40007
+
40008
+ return {
40009
+ range: [fix.range[0], fix.range[1]],
40010
+ text: fix.text
40011
+ };
40012
+ }
40013
+
40001
40014
  /**
40002
40015
  * Check that a fix has a valid range.
40003
40016
  * @param {Fix|null} fix The fix to validate.
@@ -40035,7 +40048,7 @@ function requireReportTranslator () {
40035
40048
  return null;
40036
40049
  }
40037
40050
  if (fixes.length === 1) {
40038
- return fixes[0];
40051
+ return cloneFix(fixes[0]);
40039
40052
  }
40040
40053
 
40041
40054
  fixes.sort(compareFixesByRange);
@@ -40081,7 +40094,7 @@ function requireReportTranslator () {
40081
40094
  }
40082
40095
 
40083
40096
  assertValidFix(fix);
40084
- return fix;
40097
+ return cloneFix(fix);
40085
40098
  }
40086
40099
 
40087
40100
  /**
@@ -41907,6 +41920,15 @@ function requireAstUtils () {
41907
41920
 
41908
41921
  }
41909
41922
 
41923
+ /**
41924
+ * Check whether the given node is a part of a directive prologue or not.
41925
+ * @param {ASTNode} node The node to check.
41926
+ * @returns {boolean} `true` if the node is a part of directive prologue.
41927
+ */
41928
+ function isDirective(node) {
41929
+ return node.type === "ExpressionStatement" && typeof node.directive === "string";
41930
+ }
41931
+
41910
41932
  //------------------------------------------------------------------------------
41911
41933
  // Public Interface
41912
41934
  //------------------------------------------------------------------------------
@@ -43059,7 +43081,8 @@ function requireAstUtils () {
43059
43081
  getSwitchCaseColonToken,
43060
43082
  getModuleExportName,
43061
43083
  isConstant,
43062
- isTopLevelExpressionStatement
43084
+ isTopLevelExpressionStatement,
43085
+ isDirective
43063
43086
  };
43064
43087
  } (astUtils));
43065
43088
  return astUtils.exports;
@@ -67272,7 +67295,7 @@ function requireIndent () {
67272
67295
 
67273
67296
  IfStatement(node) {
67274
67297
  addBlocklessNodeIndent(node.consequent);
67275
- if (node.alternate && node.alternate.type !== "IfStatement") {
67298
+ if (node.alternate) {
67276
67299
  addBlocklessNodeIndent(node.alternate);
67277
67300
  }
67278
67301
  },
@@ -101023,6 +101046,7 @@ function requireNoUselessEscape () {
101023
101046
  messages: {
101024
101047
  unnecessaryEscape: "Unnecessary escape character: \\{{character}}.",
101025
101048
  removeEscape: "Remove the `\\`. This maintains the current functionality.",
101049
+ removeEscapeDoNotKeepSemantics: "Remove the `\\` if it was inserted by mistake.",
101026
101050
  escapeBackslash: "Replace the `\\` with `\\\\` to include the actual backslash character."
101027
101051
  },
101028
101052
 
@@ -101054,7 +101078,10 @@ function requireNoUselessEscape () {
101054
101078
  data: { character },
101055
101079
  suggest: [
101056
101080
  {
101057
- messageId: "removeEscape",
101081
+
101082
+ // Removing unnecessary `\` characters in a directive is not guaranteed to maintain functionality.
101083
+ messageId: astUtils.isDirective(node.parent)
101084
+ ? "removeEscapeDoNotKeepSemantics" : "removeEscape",
101058
101085
  fix(fixer) {
101059
101086
  return fixer.removeRange(range);
101060
101087
  }
@@ -105513,42 +105540,6 @@ function requirePaddingLineBetweenStatements () {
105513
105540
  );
105514
105541
  }
105515
105542
 
105516
- /**
105517
- * Check whether the given node is a directive or not.
105518
- * @param {ASTNode} node The node to check.
105519
- * @param {SourceCode} sourceCode The source code object to get tokens.
105520
- * @returns {boolean} `true` if the node is a directive.
105521
- */
105522
- function isDirective(node, sourceCode) {
105523
- return (
105524
- astUtils.isTopLevelExpressionStatement(node) &&
105525
- node.expression.type === "Literal" &&
105526
- typeof node.expression.value === "string" &&
105527
- !astUtils.isParenthesised(sourceCode, node.expression)
105528
- );
105529
- }
105530
-
105531
- /**
105532
- * Check whether the given node is a part of directive prologue or not.
105533
- * @param {ASTNode} node The node to check.
105534
- * @param {SourceCode} sourceCode The source code object to get tokens.
105535
- * @returns {boolean} `true` if the node is a part of directive prologue.
105536
- */
105537
- function isDirectivePrologue(node, sourceCode) {
105538
- if (isDirective(node, sourceCode)) {
105539
- for (const sibling of node.parent.body) {
105540
- if (sibling === node) {
105541
- break;
105542
- }
105543
- if (!isDirective(sibling, sourceCode)) {
105544
- return false;
105545
- }
105546
- }
105547
- return true;
105548
- }
105549
- return false;
105550
- }
105551
-
105552
105543
  /**
105553
105544
  * Gets the actual last token.
105554
105545
  *
@@ -105742,12 +105733,10 @@ function requirePaddingLineBetweenStatements () {
105742
105733
  CJS_IMPORT.test(sourceCode.getText(node.declarations[0].init))
105743
105734
  },
105744
105735
  directive: {
105745
- test: isDirectivePrologue
105736
+ test: astUtils.isDirective
105746
105737
  },
105747
105738
  expression: {
105748
- test: (node, sourceCode) =>
105749
- node.type === "ExpressionStatement" &&
105750
- !isDirectivePrologue(node, sourceCode)
105739
+ test: node => node.type === "ExpressionStatement" && !astUtils.isDirective(node)
105751
105740
  },
105752
105741
  iife: {
105753
105742
  test: isIIFEStatement
@@ -105758,10 +105747,10 @@ function requirePaddingLineBetweenStatements () {
105758
105747
  isBlockLikeStatement(sourceCode, node)
105759
105748
  },
105760
105749
  "multiline-expression": {
105761
- test: (node, sourceCode) =>
105750
+ test: node =>
105762
105751
  node.loc.start.line !== node.loc.end.line &&
105763
105752
  node.type === "ExpressionStatement" &&
105764
- !isDirectivePrologue(node, sourceCode)
105753
+ !astUtils.isDirective(node)
105765
105754
  },
105766
105755
 
105767
105756
  "multiline-const": newMultilineKeywordTester("const"),
package/linter.js CHANGED
@@ -17040,7 +17040,7 @@
17040
17040
  }
17041
17041
 
17042
17042
  var name$1 = "eslint";
17043
- var version$1 = "8.44.0";
17043
+ var version$1 = "8.45.0";
17044
17044
  var author = "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>";
17045
17045
  var description$3 = "An AST-based pattern checker for JavaScript.";
17046
17046
  var bin = {
@@ -17112,7 +17112,6 @@
17112
17112
  globals: "^13.19.0",
17113
17113
  graphemer: "^1.4.0",
17114
17114
  ignore: "^5.2.0",
17115
- "import-fresh": "^3.0.0",
17116
17115
  imurmurhash: "^0.1.4",
17117
17116
  "is-glob": "^4.0.0",
17118
17117
  "is-path-inside": "^3.0.3",
@@ -17124,7 +17123,6 @@
17124
17123
  "natural-compare": "^1.4.0",
17125
17124
  optionator: "^0.9.3",
17126
17125
  "strip-ansi": "^6.0.1",
17127
- "strip-json-comments": "^3.1.0",
17128
17126
  "text-table": "^0.2.0"
17129
17127
  };
17130
17128
  var devDependencies$1 = {
@@ -17183,7 +17181,6 @@
17183
17181
  semver: "^7.5.3",
17184
17182
  shelljs: "^0.8.2",
17185
17183
  sinon: "^11.0.0",
17186
- temp: "^0.9.0",
17187
17184
  webpack: "^5.23.0",
17188
17185
  "webpack-cli": "^4.5.0",
17189
17186
  yorkie: "^2.0.0"
@@ -40000,6 +39997,22 @@
40000
39997
  return descriptor.node.loc;
40001
39998
  }
40002
39999
 
40000
+ /**
40001
+ * Clones the given fix object.
40002
+ * @param {Fix|null} fix The fix to clone.
40003
+ * @returns {Fix|null} Deep cloned fix object or `null` if `null` or `undefined` was passed in.
40004
+ */
40005
+ function cloneFix(fix) {
40006
+ if (!fix) {
40007
+ return null;
40008
+ }
40009
+
40010
+ return {
40011
+ range: [fix.range[0], fix.range[1]],
40012
+ text: fix.text
40013
+ };
40014
+ }
40015
+
40003
40016
  /**
40004
40017
  * Check that a fix has a valid range.
40005
40018
  * @param {Fix|null} fix The fix to validate.
@@ -40037,7 +40050,7 @@
40037
40050
  return null;
40038
40051
  }
40039
40052
  if (fixes.length === 1) {
40040
- return fixes[0];
40053
+ return cloneFix(fixes[0]);
40041
40054
  }
40042
40055
 
40043
40056
  fixes.sort(compareFixesByRange);
@@ -40083,7 +40096,7 @@
40083
40096
  }
40084
40097
 
40085
40098
  assertValidFix(fix);
40086
- return fix;
40099
+ return cloneFix(fix);
40087
40100
  }
40088
40101
 
40089
40102
  /**
@@ -41909,6 +41922,15 @@
41909
41922
 
41910
41923
  }
41911
41924
 
41925
+ /**
41926
+ * Check whether the given node is a part of a directive prologue or not.
41927
+ * @param {ASTNode} node The node to check.
41928
+ * @returns {boolean} `true` if the node is a part of directive prologue.
41929
+ */
41930
+ function isDirective(node) {
41931
+ return node.type === "ExpressionStatement" && typeof node.directive === "string";
41932
+ }
41933
+
41912
41934
  //------------------------------------------------------------------------------
41913
41935
  // Public Interface
41914
41936
  //------------------------------------------------------------------------------
@@ -43061,7 +43083,8 @@
43061
43083
  getSwitchCaseColonToken,
43062
43084
  getModuleExportName,
43063
43085
  isConstant,
43064
- isTopLevelExpressionStatement
43086
+ isTopLevelExpressionStatement,
43087
+ isDirective
43065
43088
  };
43066
43089
  } (astUtils));
43067
43090
  return astUtils.exports;
@@ -67274,7 +67297,7 @@
67274
67297
 
67275
67298
  IfStatement(node) {
67276
67299
  addBlocklessNodeIndent(node.consequent);
67277
- if (node.alternate && node.alternate.type !== "IfStatement") {
67300
+ if (node.alternate) {
67278
67301
  addBlocklessNodeIndent(node.alternate);
67279
67302
  }
67280
67303
  },
@@ -101025,6 +101048,7 @@
101025
101048
  messages: {
101026
101049
  unnecessaryEscape: "Unnecessary escape character: \\{{character}}.",
101027
101050
  removeEscape: "Remove the `\\`. This maintains the current functionality.",
101051
+ removeEscapeDoNotKeepSemantics: "Remove the `\\` if it was inserted by mistake.",
101028
101052
  escapeBackslash: "Replace the `\\` with `\\\\` to include the actual backslash character."
101029
101053
  },
101030
101054
 
@@ -101056,7 +101080,10 @@
101056
101080
  data: { character },
101057
101081
  suggest: [
101058
101082
  {
101059
- messageId: "removeEscape",
101083
+
101084
+ // Removing unnecessary `\` characters in a directive is not guaranteed to maintain functionality.
101085
+ messageId: astUtils.isDirective(node.parent)
101086
+ ? "removeEscapeDoNotKeepSemantics" : "removeEscape",
101060
101087
  fix(fixer) {
101061
101088
  return fixer.removeRange(range);
101062
101089
  }
@@ -105515,42 +105542,6 @@
105515
105542
  );
105516
105543
  }
105517
105544
 
105518
- /**
105519
- * Check whether the given node is a directive or not.
105520
- * @param {ASTNode} node The node to check.
105521
- * @param {SourceCode} sourceCode The source code object to get tokens.
105522
- * @returns {boolean} `true` if the node is a directive.
105523
- */
105524
- function isDirective(node, sourceCode) {
105525
- return (
105526
- astUtils.isTopLevelExpressionStatement(node) &&
105527
- node.expression.type === "Literal" &&
105528
- typeof node.expression.value === "string" &&
105529
- !astUtils.isParenthesised(sourceCode, node.expression)
105530
- );
105531
- }
105532
-
105533
- /**
105534
- * Check whether the given node is a part of directive prologue or not.
105535
- * @param {ASTNode} node The node to check.
105536
- * @param {SourceCode} sourceCode The source code object to get tokens.
105537
- * @returns {boolean} `true` if the node is a part of directive prologue.
105538
- */
105539
- function isDirectivePrologue(node, sourceCode) {
105540
- if (isDirective(node, sourceCode)) {
105541
- for (const sibling of node.parent.body) {
105542
- if (sibling === node) {
105543
- break;
105544
- }
105545
- if (!isDirective(sibling, sourceCode)) {
105546
- return false;
105547
- }
105548
- }
105549
- return true;
105550
- }
105551
- return false;
105552
- }
105553
-
105554
105545
  /**
105555
105546
  * Gets the actual last token.
105556
105547
  *
@@ -105744,12 +105735,10 @@
105744
105735
  CJS_IMPORT.test(sourceCode.getText(node.declarations[0].init))
105745
105736
  },
105746
105737
  directive: {
105747
- test: isDirectivePrologue
105738
+ test: astUtils.isDirective
105748
105739
  },
105749
105740
  expression: {
105750
- test: (node, sourceCode) =>
105751
- node.type === "ExpressionStatement" &&
105752
- !isDirectivePrologue(node, sourceCode)
105741
+ test: node => node.type === "ExpressionStatement" && !astUtils.isDirective(node)
105753
105742
  },
105754
105743
  iife: {
105755
105744
  test: isIIFEStatement
@@ -105760,10 +105749,10 @@
105760
105749
  isBlockLikeStatement(sourceCode, node)
105761
105750
  },
105762
105751
  "multiline-expression": {
105763
- test: (node, sourceCode) =>
105752
+ test: node =>
105764
105753
  node.loc.start.line !== node.loc.end.line &&
105765
105754
  node.type === "ExpressionStatement" &&
105766
- !isDirectivePrologue(node, sourceCode)
105755
+ !astUtils.isDirective(node)
105767
105756
  },
105768
105757
 
105769
105758
  "multiline-const": newMultilineKeywordTester("const"),