eslint 7.19.0 → 7.20.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ v7.20.0 - February 12, 2021
2
+
3
+ * [`f4ac3b0`](https://github.com/eslint/eslint/commit/f4ac3b0e7072fbd3c14e9c64ff0c2c255a4eb730) Docs: fix sibling selector descriptions (#14099) (Milos Djermanovic)
4
+ * [`9d6063a`](https://github.com/eslint/eslint/commit/9d6063add931f0803cae1676d5df307baf114360) Fix: Crash with esquery when using JSX (fixes #13639) (#14072) (Yosuke Ota)
5
+ * [`a0871f1`](https://github.com/eslint/eslint/commit/a0871f1840060bd23cfe0952a096b107142db2f0) Docs: Triage process (#14014) (Nicholas C. Zakas)
6
+ * [`ad90761`](https://github.com/eslint/eslint/commit/ad9076183bc2c2029525edfc4596e403999348d1) Update: add enforceForJSX option to no-unused-expressions rule (#14012) (Duncan Beevers)
7
+ * [`d6c84af`](https://github.com/eslint/eslint/commit/d6c84af67318537177ffac0120a81af08e3e9df4) Fix: `--init` autoconfig shouldn't add deprecated rules (fixes #14017) (#14060) (Milos Djermanovic)
8
+ * [`9b277a1`](https://github.com/eslint/eslint/commit/9b277a16a7261e51b7ba36d6de7f996e9203a6a4) Fix: Support ENOTDIR error code in the folder existence checking utility (#13973) (Constantine Genchevsky)
9
+ * [`7aeb127`](https://github.com/eslint/eslint/commit/7aeb12798f2b9da706f3593f26a02e717929c9af) Upgrade: pin @babel/code-frame@7.12.11 (#14067) (Milos Djermanovic)
10
+ * [`b4e2af5`](https://github.com/eslint/eslint/commit/b4e2af5db1c29343ffec2cd104b04bf39b77ee56) Docs: Add more fields to bug report template (#14039) (Nicholas C. Zakas)
11
+ * [`96f1d49`](https://github.com/eslint/eslint/commit/96f1d49a4647e59f2fb918be096654e290513adc) Sponsors: Sync README with website (ESLint Jenkins)
12
+ * [`cb27b0a`](https://github.com/eslint/eslint/commit/cb27b0abeda6dfee55dd43b9cbe12afad321f55d) Build: package.json update for eslint-config-eslint release (ESLint Jenkins)
13
+ * [`4cab165`](https://github.com/eslint/eslint/commit/4cab165bf4e6e5e9f42a59a37a8ff2548c0af87d) Sponsors: Sync README with website (ESLint Jenkins)
14
+
1
15
  v7.19.0 - January 30, 2021
2
16
 
3
17
  * [`ce7f061`](https://github.com/eslint/eslint/commit/ce7f06121d9eb9cc2b3da24b4456b4d382e1413b) Update: add shadowed variable loc to message in no-shadow (fixes #13646) (#13841) (t-mangoe)
package/README.md CHANGED
@@ -280,10 +280,10 @@ The following companies, organizations, and individuals support ESLint's ongoing
280
280
  <!-- NOTE: This section is autogenerated. Do not manually edit.-->
281
281
  <!--sponsorsstart-->
282
282
  <h3>Platinum Sponsors</h3>
283
- <p><a href="https://automattic.com"><img src="https://images.opencollective.com/photomatt/ff91f0b/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
284
- <p><a href="https://google.com/chrome"><img src="https://images.opencollective.com/chrome/dc55bd4/logo.png" alt="Chrome's Web Framework & Tools Performance Fund" height="96"></a> <a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/e780cd4/logo.png" alt="Shopify" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://aka.ms/microsoftfossfund"><img src="https://avatars.githubusercontent.com/u/67931232?u=7fddc652a464d7151b97e8f108392af7d54fa3e8&v=4" alt="Microsoft FOSS Fund Sponsorships" height="96"></a></p><h3>Silver Sponsors</h3>
283
+ <p><a href="https://automattic.com"><img src="https://images.opencollective.com/photomatt/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
284
+ <p><a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="96"></a> <a href="https://google.com/chrome"><img src="https://images.opencollective.com/chrome/dc55bd4/logo.png" alt="Chrome's Web Framework & Tools Performance Fund" height="96"></a> <a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/e780cd4/logo.png" alt="Shopify" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://aka.ms/microsoftfossfund"><img src="https://avatars.githubusercontent.com/u/67931232?u=7fddc652a464d7151b97e8f108392af7d54fa3e8&v=4" alt="Microsoft FOSS Fund Sponsorships" height="96"></a></p><h3>Silver Sponsors</h3>
285
285
  <p><a href="https://retool.com/"><img src="https://images.opencollective.com/retool/98ea68e/logo.png" alt="Retool" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://www.ampproject.org/"><img src="https://images.opencollective.com/amp/c8a3b25/logo.png" alt="AMP Project" height="64"></a></p><h3>Bronze Sponsors</h3>
286
- <p><a href="https://streamat.se"><img src="https://images.opencollective.com/streamat/46890db/logo.png" alt="Streamat" height="32"></a> <a href="https://thestandarddaily.com/"><img src="https://images.opencollective.com/eric-watson/db4e598/avatar.png" alt="The Standard Daily" height="32"></a> <a href="https://writersperhour.com"><img src="https://images.opencollective.com/writersperhour/5787d4b/logo.png" alt="Writers Per Hour" height="32"></a> <a href="https://www.betacalendars.com/february-calendar.html"><img src="https://images.opencollective.com/betacalendars/9334b33/logo.png" alt="February 2021 calendar" height="32"></a> <a href="https://buy.fineproxy.org/eng/"><img src="https://images.opencollective.com/buy-fineproxy-org/b282e39/logo.png" alt="Buy.Fineproxy.Org" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a></p>
286
+ <p><a href="https://writersperhour.com"><img src="https://images.opencollective.com/writersperhour/5787d4b/logo.png" alt="Writers Per Hour" height="32"></a> <a href="https://www.betacalendars.com/march-calendar.html"><img src="https://images.opencollective.com/betacalendars/9334b33/logo.png" alt="March 2021 calendar" height="32"></a> <a href="https://buy.fineproxy.org/eng/"><img src="https://images.opencollective.com/buy-fineproxy-org/b282e39/logo.png" alt="Buy.Fineproxy.Org" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a></p>
287
287
  <!--sponsorsend-->
288
288
 
289
289
  ## <a name="technology-sponsors"></a>Technology Sponsors
@@ -531,7 +531,7 @@ function directoryExists(resolvedPath) {
531
531
  try {
532
532
  return fs.statSync(resolvedPath).isDirectory();
533
533
  } catch (error) {
534
- if (error && error.code === "ENOENT") {
534
+ if (error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
535
535
  return false;
536
536
  }
537
537
  throw error;
@@ -85,7 +85,7 @@ class Registry {
85
85
  * @returns {void}
86
86
  */
87
87
  populateFromCoreRules() {
88
- const rulesConfig = configRule.createCoreRuleConfigs();
88
+ const rulesConfig = configRule.createCoreRuleConfigs(/* noDeprecated = */ true);
89
89
 
90
90
  this.rules = makeRegistryItems(rulesConfig);
91
91
  }
@@ -942,7 +942,9 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser
942
942
  });
943
943
 
944
944
  // only run code path analyzer if the top level node is "Program", skip otherwise
945
- const eventGenerator = nodeQueue[0].node.type === "Program" ? new CodePathAnalyzer(new NodeEventGenerator(emitter)) : new NodeEventGenerator(emitter);
945
+ const eventGenerator = nodeQueue[0].node.type === "Program"
946
+ ? new CodePathAnalyzer(new NodeEventGenerator(emitter, { visitorKeys: sourceCode.visitorKeys, fallback: Traverser.getKeys }))
947
+ : new NodeEventGenerator(emitter, { visitorKeys: sourceCode.visitorKeys, fallback: Traverser.getKeys });
946
948
 
947
949
  nodeQueue.forEach(traversalInfo => {
948
950
  currentNode = traversalInfo.node;
@@ -208,10 +208,12 @@ class NodeEventGenerator {
208
208
  * An SafeEmitter which is the destination of events. This emitter must already
209
209
  * have registered listeners for all of the events that it needs to listen for.
210
210
  * (See lib/linter/safe-emitter.js for more details on `SafeEmitter`.)
211
+ * @param {ESQueryOptions} esqueryOptions `esquery` options for traversing custom nodes.
211
212
  * @returns {NodeEventGenerator} new instance
212
213
  */
213
- constructor(emitter) {
214
+ constructor(emitter, esqueryOptions) {
214
215
  this.emitter = emitter;
216
+ this.esqueryOptions = esqueryOptions;
215
217
  this.currentAncestry = [];
216
218
  this.enterSelectorsByNodeType = new Map();
217
219
  this.exitSelectorsByNodeType = new Map();
@@ -250,7 +252,7 @@ class NodeEventGenerator {
250
252
  * @returns {void}
251
253
  */
252
254
  applySelector(node, selector) {
253
- if (esquery.matches(node, selector.parsedSelector, this.currentAncestry)) {
255
+ if (esquery.matches(node, selector.parsedSelector, this.currentAncestry, this.esqueryOptions)) {
254
256
  this.emitter.emit(selector.rawSelector, node);
255
257
  }
256
258
  }
@@ -50,6 +50,10 @@ module.exports = {
50
50
  allowTaggedTemplates: {
51
51
  type: "boolean",
52
52
  default: false
53
+ },
54
+ enforceForJSX: {
55
+ type: "boolean",
56
+ default: false
53
57
  }
54
58
  },
55
59
  additionalProperties: false
@@ -65,7 +69,8 @@ module.exports = {
65
69
  const config = context.options[0] || {},
66
70
  allowShortCircuit = config.allowShortCircuit || false,
67
71
  allowTernary = config.allowTernary || false,
68
- allowTaggedTemplates = config.allowTaggedTemplates || false;
72
+ allowTaggedTemplates = config.allowTaggedTemplates || false,
73
+ enforceForJSX = config.enforceForJSX || false;
69
74
 
70
75
  // eslint-disable-next-line jsdoc/require-description
71
76
  /**
@@ -140,6 +145,12 @@ module.exports = {
140
145
  },
141
146
  FunctionExpression: alwaysTrue,
142
147
  Identifier: alwaysTrue,
148
+ JSXElement() {
149
+ return enforceForJSX;
150
+ },
151
+ JSXFragment() {
152
+ return enforceForJSX;
153
+ },
143
154
  Literal: alwaysTrue,
144
155
  LogicalExpression(node) {
145
156
  if (allowShortCircuit) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "7.19.0",
3
+ "version": "7.20.0",
4
4
  "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
5
5
  "description": "An AST-based pattern checker for JavaScript.",
6
6
  "bin": {
@@ -46,7 +46,7 @@
46
46
  "homepage": "https://eslint.org",
47
47
  "bugs": "https://github.com/eslint/eslint/issues/",
48
48
  "dependencies": {
49
- "@babel/code-frame": "^7.0.0",
49
+ "@babel/code-frame": "7.12.11",
50
50
  "@eslint/eslintrc": "^0.3.0",
51
51
  "ajv": "^6.10.0",
52
52
  "chalk": "^4.0.0",
@@ -58,7 +58,7 @@
58
58
  "eslint-utils": "^2.1.0",
59
59
  "eslint-visitor-keys": "^2.0.0",
60
60
  "espree": "^7.3.1",
61
- "esquery": "^1.2.0",
61
+ "esquery": "^1.4.0",
62
62
  "esutils": "^2.0.2",
63
63
  "file-entry-cache": "^6.0.0",
64
64
  "functional-red-black-tree": "^1.0.1",