eslint 6.0.0 → 6.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ v6.0.1 - June 24, 2019
2
+
3
+ * [`b5bde06`](https://github.com/eslint/eslint/commit/b5bde0669bd6a7a6b8e38cdf204d8d4b932cea63) Fix: --rulesdir option didn't work (fixes #11888) (#11890) (Toru Nagashima)
4
+ * [`13f0418`](https://github.com/eslint/eslint/commit/13f041897ee31982808a57b4d06450b57c9b27dc) Fix: improve error message on --print-config (fixes #11874) (#11885) (Toru Nagashima)
5
+ * [`056c2aa`](https://github.com/eslint/eslint/commit/056c2aaf39a5f8d06de24f06946dda95032a0361) Fix: improve diagnostics for shareable-config-missing errors (#11880) (Teddy Katz)
6
+ * [`566b7aa`](https://github.com/eslint/eslint/commit/566b7aa5d61fb31cd47fe4da7820b07cf9bde1ec) Docs: Update no-confusing-arrow with the new default option (#11886) (Yuping Zuo)
7
+ * [`d07f3fa`](https://github.com/eslint/eslint/commit/d07f3fae19b901c30cf4998f10722cb3182bd237) Fix: CLIEngine#getRules() contains plugin rules (fixes #11871) (#11872) (Toru Nagashima)
8
+ * [`21f4a80`](https://github.com/eslint/eslint/commit/21f4a8057ccc941f72bb617ae3b5c135a774f6c0) Docs: Fix inconsistent linking in migration guide (#11881) (Teddy Katz)
9
+ * [`f3a0774`](https://github.com/eslint/eslint/commit/f3a0774a8879b08777a4aedc76677f13d5156242) Docs: Fix typo in 6.0.0 migration guide (#11870) (Kevin Partington)
10
+
1
11
  v6.0.0 - June 21, 2019
2
12
 
3
13
  * [`81aa06b`](https://github.com/eslint/eslint/commit/81aa06b4cc49e9c15234a2c4d27659a03fea53d8) Upgrade: espree@6.0.0 (#11869) (Teddy Katz)
package/bin/eslint.js CHANGED
@@ -45,7 +45,7 @@ process.once("uncaughtException", err => {
45
45
  const pkg = require("../package.json");
46
46
 
47
47
  console.error("\nOops! Something went wrong! :(");
48
- console.error(`\nESLint: ${pkg.version}.\n${template(err.messageData || {})}`);
48
+ console.error(`\nESLint: ${pkg.version}.\n\n${template(err.messageData || {})}`);
49
49
  } else {
50
50
 
51
51
  console.error(err.stack);
@@ -27,7 +27,7 @@ const os = require("os");
27
27
  const path = require("path");
28
28
  const { validateConfigArray } = require("../shared/config-validator");
29
29
  const { ConfigArrayFactory } = require("./config-array-factory");
30
- const { ConfigDependency } = require("./config-array");
30
+ const { ConfigArray, ConfigDependency } = require("./config-array");
31
31
  const loadRules = require("./load-rules");
32
32
  const debug = require("debug")("eslint:cascading-config-array-factory");
33
33
 
@@ -225,11 +225,22 @@ class CascadingConfigArrayFactory {
225
225
 
226
226
  /**
227
227
  * Get the config array of a given file.
228
- * @param {string} filePath The file path to a file.
228
+ * If `filePath` was not given, it returns the config which contains only
229
+ * `baseConfigData` and `cliConfigData`.
230
+ * @param {string} [filePath] The file path to a file.
229
231
  * @returns {ConfigArray} The config array of the file.
230
232
  */
231
233
  getConfigArrayForFile(filePath) {
232
- const { cwd } = internalSlotsMap.get(this);
234
+ const {
235
+ baseConfigArray,
236
+ cliConfigArray,
237
+ cwd
238
+ } = internalSlotsMap.get(this);
239
+
240
+ if (!filePath) {
241
+ return new ConfigArray(...baseConfigArray, ...cliConfigArray);
242
+ }
243
+
233
244
  const directoryPath = path.dirname(path.resolve(cwd, filePath));
234
245
 
235
246
  debug(`Load config files for ${directoryPath}.`);
@@ -302,6 +313,7 @@ class CascadingConfigArrayFactory {
302
313
 
303
314
  if (configArray.length > 0 && configArray.isRoot()) {
304
315
  debug("Stop traversing because of 'root:true'.");
316
+ configArray.unshift(...baseConfigArray);
305
317
  return this._cacheConfig(directoryPath, configArray);
306
318
  }
307
319
 
@@ -573,7 +573,7 @@ class CLIEngine {
573
573
  const linter = new Linter();
574
574
 
575
575
  /** @type {ConfigArray[]} */
576
- const lastConfigArrays = [];
576
+ const lastConfigArrays = [configArrayFactory.getConfigArrayForFile()];
577
577
 
578
578
  // Store private data.
579
579
  internalSlotsMap.set(this, {
@@ -904,6 +904,13 @@ class CLIEngine {
904
904
  const { configArrayFactory, options } = internalSlotsMap.get(this);
905
905
  const absolutePath = path.resolve(options.cwd, filePath);
906
906
 
907
+ if (directoryExists(absolutePath)) {
908
+ throw Object.assign(
909
+ new Error("'filePath' should not be a directory path."),
910
+ { messageTemplate: "print-config-with-directory-path" }
911
+ );
912
+ }
913
+
907
914
  return configArrayFactory
908
915
  .getConfigArrayForFile(absolutePath)
909
916
  .extractConfig(absolutePath)
@@ -224,15 +224,16 @@ function loadPackageJSONConfigFile(filePath) {
224
224
  /**
225
225
  * Creates an error to notify about a missing config to extend from.
226
226
  * @param {string} configName The name of the missing config.
227
+ * @param {string} importerName The name of the config that imported the missing config
227
228
  * @returns {Error} The error object to throw
228
229
  * @private
229
230
  */
230
- function configMissingError(configName) {
231
+ function configMissingError(configName, importerName) {
231
232
  return Object.assign(
232
233
  new Error(`Failed to load config "${configName}" to extend from.`),
233
234
  {
234
235
  messageTemplate: "extend-config-missing",
235
- messageData: { configName }
236
+ messageData: { configName, importerName }
236
237
  }
237
238
  );
238
239
  }
@@ -637,7 +638,7 @@ class ConfigArrayFactory {
637
638
  return this._loadConfigData(eslintAllPath, name);
638
639
  }
639
640
 
640
- throw configMissingError(extendName);
641
+ throw configMissingError(extendName, importerName);
641
642
  }
642
643
 
643
644
  /**
@@ -670,7 +671,7 @@ class ConfigArrayFactory {
670
671
  );
671
672
  }
672
673
 
673
- throw plugin.error || configMissingError(extendName);
674
+ throw plugin.error || configMissingError(extendName, importerPath);
674
675
  }
675
676
 
676
677
  /**
@@ -704,7 +705,7 @@ class ConfigArrayFactory {
704
705
  } catch (error) {
705
706
  /* istanbul ignore else */
706
707
  if (error && error.code === "MODULE_NOT_FOUND") {
707
- throw configMissingError(extendName);
708
+ throw configMissingError(extendName, importerPath);
708
709
  }
709
710
  throw error;
710
711
  }
@@ -1,3 +1,5 @@
1
1
  ESLint couldn't find the config "<%- configName %>" to extend from. Please check that the name of the config is correct.
2
2
 
3
+ The config "<%- configName %>" was referenced from the config file in "<%- importerName %>".
4
+
3
5
  If you still have problems, please stop by https://gitter.im/eslint/eslint to chat with the team.
@@ -0,0 +1,2 @@
1
+ The '--print-config' CLI option requires a path to a source code file rather than a directory.
2
+ See also: https://eslint.org/docs/user-guide/command-line-interface#--print-config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
5
5
  "description": "An AST-based pattern checker for JavaScript.",
6
6
  "bin": {