node_modules/eslint/lib/api.js in immosquare-cleaner-0.1.32 vs node_modules/eslint/lib/api.js in immosquare-cleaner-0.1.38

- old
+ new

@@ -7,12 +7,12 @@ //----------------------------------------------------------------------------- // Requirements //----------------------------------------------------------------------------- -const { ESLint, FlatESLint } = require("./eslint"); -const { shouldUseFlatConfig } = require("./eslint/flat-eslint"); +const { ESLint, shouldUseFlatConfig } = require("./eslint/eslint"); +const { LegacyESLint } = require("./eslint/legacy-eslint"); const { Linter } = require("./linter"); const { RuleTester } = require("./rule-tester"); const { SourceCode } = require("./source-code"); //----------------------------------------------------------------------------- @@ -21,25 +21,21 @@ /** * Loads the correct ESLint constructor given the options. * @param {Object} [options] The options object * @param {boolean} [options.useFlatConfig] Whether or not to use a flat config - * @param {string} [options.cwd] The current working directory * @returns {Promise<ESLint|LegacyESLint>} The ESLint constructor */ -async function loadESLint({ useFlatConfig, cwd = process.cwd() } = {}) { +async function loadESLint({ useFlatConfig } = {}) { /* - * Note: The v9.x version of this function doesn't have a cwd option - * because it's not used. It's only used in the v8.x version of this - * function. + * Note: The v8.x version of this function also accepted a `cwd` option, but + * it is not used in this implementation so we silently ignore it. */ - const shouldESLintUseFlatConfig = typeof useFlatConfig === "boolean" - ? useFlatConfig - : await shouldUseFlatConfig({ cwd }); + const shouldESLintUseFlatConfig = useFlatConfig ?? (await shouldUseFlatConfig()); - return shouldESLintUseFlatConfig ? FlatESLint : ESLint; + return shouldESLintUseFlatConfig ? ESLint : LegacyESLint; } //----------------------------------------------------------------------------- // Exports //-----------------------------------------------------------------------------