eslint 7.21.0 → 7.22.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,20 @@
1
+ v7.22.0 - March 12, 2021
2
+
3
+ * [`3a432d8`](https://github.com/eslint/eslint/commit/3a432d82b3a5710aff7da20302fe0b94fedc46c2) Docs: Improve documentation for indent rule (#14168) (Serkan Özel)
4
+ * [`f62ec8d`](https://github.com/eslint/eslint/commit/f62ec8d30d925e70e4d0d40640857c587ac2e116) Update: throw error when fix range is invalid (#14142) (Jacob Bandes-Storch)
5
+ * [`0eecad2`](https://github.com/eslint/eslint/commit/0eecad271358f753730741fcfcb2f7cc915c1fa7) Upgrade: Update lodash in package.json to V 4.17.21 (#14159) (Basem Al-Nabulsi)
6
+ * [`5ad91aa`](https://github.com/eslint/eslint/commit/5ad91aa7df3d6bc185786e6eccd9e055fd951055) Update: report es2021 globals in no-extend-native (refs #13602) (#14177) (Milos Djermanovic)
7
+ * [`c295581`](https://github.com/eslint/eslint/commit/c295581aca4e08ec4ae8e5ee5726a6f454a3ee26) Chore: remove leftover JSDoc from lint-result-cache (#14176) (Milos Djermanovic)
8
+ * [`0d541f9`](https://github.com/eslint/eslint/commit/0d541f9d9d58966372e2055a8f69fb9483d56a4b) Chore: Reduce lodash usage (#14178) (Stephen Wade)
9
+ * [`27a67d7`](https://github.com/eslint/eslint/commit/27a67d71ffa9bbd7af02ae448844e127bcf956dc) Sponsors: Sync README with website (ESLint Jenkins)
10
+ * [`459d821`](https://github.com/eslint/eslint/commit/459d821f4a599501ceb002f9d7a5034fc45ffbb0) Chore: upgrade dependencies of browser test (#14127) (Pig Fang)
11
+ * [`ebfb63a`](https://github.com/eslint/eslint/commit/ebfb63a682004a008f2707dbad616e5ae1630b2c) Sponsors: Sync README with website (ESLint Jenkins)
12
+ * [`3ba029f`](https://github.com/eslint/eslint/commit/3ba029fbffd44068be93254890fc2aec3e92c212) Docs: Remove Extraneous Dash (#14164) (Danny Hurlburt)
13
+ * [`6f4540e`](https://github.com/eslint/eslint/commit/6f4540ea7ea39775906526506fd7abd7ea97610c) Sponsors: Sync README with website (ESLint Jenkins)
14
+ * [`ddf361c`](https://github.com/eslint/eslint/commit/ddf361ca2a2a01a9974f421e5f62270df282d0e8) Docs: Fix Formatting (#14154) (Danny Hurlburt)
15
+ * [`c0d2ac1`](https://github.com/eslint/eslint/commit/c0d2ac16f8f9c75c62c78e9fe6a24a25ba0d7828) Sponsors: Sync README with website (ESLint Jenkins)
16
+ * [`a8df03e`](https://github.com/eslint/eslint/commit/a8df03efe3bc47665d2112c2cdd5bead337d475d) Docs: Clarify triage process (#14117) (Nicholas C. Zakas)
17
+
1
18
  v7.21.0 - February 27, 2021
2
19
 
3
20
  * [`3cd5440`](https://github.com/eslint/eslint/commit/3cd5440b94d5fa4f11a09f50b685f6150f0c2d41) Upgrade: @eslint/eslintrc to 0.4.0 (#14147) (Brandon Mills)
package/README.md CHANGED
@@ -282,8 +282,8 @@ The following companies, organizations, and individuals support ESLint's ongoing
282
282
  <h3>Platinum Sponsors</h3>
283
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
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://substack.com/"><img src="https://avatars.githubusercontent.com/u/53023767?v=4" alt="Substack" 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
- <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://papersowl.com/pay-for-research-paper"><img src="https://images.opencollective.com/papersowl2/9ef85ac/logo.png" alt="Papersowl" 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/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>
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></p><h3>Bronze Sponsors</h3>
286
+ <p><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
@@ -72,7 +72,7 @@ function renderMessages(messages, parentIndex, rulesMeta) {
72
72
  * @param {Object} message Message.
73
73
  * @returns {string} HTML (table row) describing a message.
74
74
  */
75
- return lodash.map(messages, message => {
75
+ return messages.map(message => {
76
76
  const lineNumber = message.line || 0;
77
77
  const columnNumber = message.column || 0;
78
78
  let ruleUrl;
@@ -103,7 +103,7 @@ function renderMessages(messages, parentIndex, rulesMeta) {
103
103
  * @returns {string} HTML string describing the results.
104
104
  */
105
105
  function renderResults(results, rulesMeta) {
106
- return lodash.map(results, (result, index) => resultTemplate({
106
+ return results.map((result, index) => resultTemplate({
107
107
  index,
108
108
  color: renderColor(result.errorCount, result.warningCount),
109
109
  filePath: result.filePath,
@@ -67,7 +67,6 @@ class LintResultCache {
67
67
  /**
68
68
  * Creates a new LintResultCache instance.
69
69
  * @param {string} cacheFileLocation The cache file location.
70
- * configuration lookup by file path).
71
70
  * @param {"metadata" | "content"} cacheStrategy The cache strategy to use.
72
71
  */
73
72
  constructor(cacheFileLocation, cacheStrategy) {
@@ -115,6 +115,17 @@ function normalizeReportLoc(descriptor) {
115
115
  return descriptor.node.loc;
116
116
  }
117
117
 
118
+ /**
119
+ * Check that a fix has a valid range.
120
+ * @param {Fix|null} fix The fix to validate.
121
+ * @returns {void}
122
+ */
123
+ function assertValidFix(fix) {
124
+ if (fix) {
125
+ assert(fix.range && typeof fix.range[0] === "number" && typeof fix.range[1] === "number", `Fix has invalid range: ${JSON.stringify(fix, null, 2)}`);
126
+ }
127
+ }
128
+
118
129
  /**
119
130
  * Compares items in a fixes array by range.
120
131
  * @param {Fix} a The first message.
@@ -133,6 +144,10 @@ function compareFixesByRange(a, b) {
133
144
  * @returns {{text: string, range: number[]}} The merged fixes
134
145
  */
135
146
  function mergeFixes(fixes, sourceCode) {
147
+ for (const fix of fixes) {
148
+ assertValidFix(fix);
149
+ }
150
+
136
151
  if (fixes.length === 0) {
137
152
  return null;
138
153
  }
@@ -181,6 +196,8 @@ function normalizeFixes(descriptor, sourceCode) {
181
196
  if (fix && Symbol.iterator in fix) {
182
197
  return mergeFixes(Array.from(fix), sourceCode);
183
198
  }
199
+
200
+ assertValidFix(fix);
184
201
  return fix;
185
202
  }
186
203
 
@@ -427,12 +427,12 @@ class RuleTester {
427
427
  scenarioErrors = [],
428
428
  linter = this.linter;
429
429
 
430
- if (lodash.isNil(test) || typeof test !== "object") {
430
+ if (!test || typeof test !== "object") {
431
431
  throw new TypeError(`Test Scenarios for rule ${ruleName} : Could not find test scenario object`);
432
432
  }
433
433
 
434
434
  requiredScenarios.forEach(scenarioType => {
435
- if (lodash.isNil(test[scenarioType])) {
435
+ if (!test[scenarioType]) {
436
436
  scenarioErrors.push(`Could not find any ${scenarioType} test scenarios`);
437
437
  }
438
438
  });
@@ -54,7 +54,7 @@ module.exports = {
54
54
  },
55
55
  LF = "\n",
56
56
  CRLF = `\r${LF}`,
57
- endsWithNewline = lodash.endsWith(src, LF);
57
+ endsWithNewline = src.endsWith(LF);
58
58
 
59
59
  /*
60
60
  * Empty source is always valid: No content in file so we don't
@@ -8,8 +8,7 @@
8
8
  // Requirements
9
9
  //------------------------------------------------------------------------------
10
10
 
11
- const lodash = require("lodash"),
12
- astUtils = require("./utils/ast-utils");
11
+ const astUtils = require("./utils/ast-utils");
13
12
 
14
13
  //------------------------------------------------------------------------------
15
14
  // Helpers
@@ -347,7 +346,7 @@ module.exports = {
347
346
  const nextTokenOrComment = sourceCode.getTokenAfter(token, { includeComments: true });
348
347
 
349
348
  // check for newline before
350
- if (!exceptionStartAllowed && before && !lodash.includes(commentAndEmptyLines, prevLineNum) &&
349
+ if (!exceptionStartAllowed && before && !commentAndEmptyLines.includes(prevLineNum) &&
351
350
  !(astUtils.isCommentToken(previousTokenOrComment) && astUtils.isTokenOnSameLine(previousTokenOrComment, token))) {
352
351
  const lineStart = token.range[0] - token.loc.start.column;
353
352
  const range = [lineStart, lineStart];
@@ -362,7 +361,7 @@ module.exports = {
362
361
  }
363
362
 
364
363
  // check for newline after
365
- if (!exceptionEndAllowed && after && !lodash.includes(commentAndEmptyLines, nextLineNum) &&
364
+ if (!exceptionEndAllowed && after && !commentAndEmptyLines.includes(nextLineNum) &&
366
365
  !(astUtils.isCommentToken(nextTokenOrComment) && astUtils.isTokenOnSameLine(token, nextTokenOrComment))) {
367
366
  context.report({
368
367
  node: token,
@@ -151,7 +151,7 @@ module.exports = {
151
151
  );
152
152
 
153
153
  lines = lines.filter(
154
- l => !lodash.includes(commentLines, l.lineNumber)
154
+ l => !commentLines.includes(l.lineNumber)
155
155
  );
156
156
  }
157
157
 
@@ -82,7 +82,7 @@ function normalizeOptionValue(value) {
82
82
  function normalizeOptions(options) {
83
83
  const isNodeSpecificOption = lodash.overSome([lodash.isPlainObject, lodash.isString]);
84
84
 
85
- if (lodash.isPlainObject(options) && lodash.some(options, isNodeSpecificOption)) {
85
+ if (lodash.isPlainObject(options) && Object.values(options).some(isNodeSpecificOption)) {
86
86
  return {
87
87
  ObjectExpression: normalizeOptionValue(options.ObjectExpression),
88
88
  ObjectPattern: normalizeOptionValue(options.ObjectPattern),
@@ -11,7 +11,6 @@
11
11
 
12
12
  const path = require("path");
13
13
  const spawn = require("cross-spawn");
14
- const { isEmpty } = require("lodash");
15
14
  const log = require("../shared/logging");
16
15
  const packageJson = require("../../package.json");
17
16
 
@@ -107,7 +106,7 @@ function environment() {
107
106
  * Checking globally returns an empty JSON object, while local checks
108
107
  * include the name and version of the local project.
109
108
  */
110
- if (isEmpty(parsedStdout) || !(parsedStdout.dependencies && parsedStdout.dependencies.eslint)) {
109
+ if (Object.keys(parsedStdout).length === 0 || !(parsedStdout.dependencies && parsedStdout.dependencies.eslint)) {
111
110
  return "Not found";
112
111
  }
113
112
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "7.21.0",
3
+ "version": "7.22.0",
4
4
  "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
5
5
  "description": "An AST-based pattern checker for JavaScript.",
6
6
  "bin": {
@@ -63,7 +63,7 @@
63
63
  "file-entry-cache": "^6.0.1",
64
64
  "functional-red-black-tree": "^1.0.1",
65
65
  "glob-parent": "^5.0.0",
66
- "globals": "^12.1.0",
66
+ "globals": "^13.6.0",
67
67
  "ignore": "^4.0.6",
68
68
  "import-fresh": "^3.0.0",
69
69
  "imurmurhash": "^0.1.4",
@@ -71,7 +71,7 @@
71
71
  "js-yaml": "^3.13.1",
72
72
  "json-stable-stringify-without-jsonify": "^1.0.1",
73
73
  "levn": "^0.4.1",
74
- "lodash": "^4.17.20",
74
+ "lodash": "^4.17.21",
75
75
  "minimatch": "^3.0.4",
76
76
  "natural-compare": "^1.4.0",
77
77
  "optionator": "^0.9.1",
@@ -108,11 +108,11 @@
108
108
  "fs-teardown": "^0.1.0",
109
109
  "glob": "^7.1.6",
110
110
  "jsdoc": "^3.5.5",
111
- "karma": "^4.0.1",
111
+ "karma": "^6.1.1",
112
112
  "karma-chrome-launcher": "^3.1.0",
113
- "karma-mocha": "^1.3.0",
114
- "karma-mocha-reporter": "^2.2.3",
115
- "karma-webpack": "^4.0.0-rc.6",
113
+ "karma-mocha": "^2.0.1",
114
+ "karma-mocha-reporter": "^2.2.5",
115
+ "karma-webpack": "^5.0.0",
116
116
  "lint-staged": "^10.1.2",
117
117
  "load-perf": "^0.2.0",
118
118
  "markdownlint": "^0.19.0",
@@ -120,6 +120,7 @@
120
120
  "memfs": "^3.0.1",
121
121
  "mocha": "^7.1.1",
122
122
  "mocha-junit-reporter": "^1.23.0",
123
+ "node-polyfill-webpack-plugin": "^1.0.3",
123
124
  "npm-license": "^0.3.3",
124
125
  "nyc": "^15.0.1",
125
126
  "proxyquire": "^2.0.1",
@@ -129,8 +130,8 @@
129
130
  "shelljs": "^0.8.2",
130
131
  "sinon": "^9.0.1",
131
132
  "temp": "^0.9.0",
132
- "webpack": "^4.35.0",
133
- "webpack-cli": "^3.3.5",
133
+ "webpack": "^5.23.0",
134
+ "webpack-cli": "^4.5.0",
134
135
  "yorkie": "^2.0.0"
135
136
  },
136
137
  "keywords": [