node_modules/eslint/lib/eslint/flat-eslint.js in immosquare-cleaner-0.1.31 vs node_modules/eslint/lib/eslint/flat-eslint.js in immosquare-cleaner-0.1.32
- old
+ new
@@ -89,11 +89,15 @@
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
-const FLAT_CONFIG_FILENAME = "eslint.config.js";
+const FLAT_CONFIG_FILENAMES = [
+ "eslint.config.js",
+ "eslint.config.mjs",
+ "eslint.config.cjs"
+];
const debug = require("debug")("eslint:flat-eslint");
const removedFormatters = new Set(["table", "codeframe"]);
const privateMembers = new WeakMap();
const importedConfigFileModificationTime = new Map();
@@ -246,11 +250,11 @@
* @param {string} cwd The current working directory to search from.
* @returns {Promise<string|undefined>} The filename if found or `undefined` if not.
*/
function findFlatConfigFile(cwd) {
return findUp(
- FLAT_CONFIG_FILENAME,
+ FLAT_CONFIG_FILENAMES,
{ cwd }
);
}
/**
@@ -1111,14 +1115,23 @@
return config === void 0;
}
}
/**
+ * The type of configuration used by this class.
+ * @type {string}
+ * @static
+ */
+FlatESLint.configType = "flat";
+
+/**
* Returns whether flat config should be used.
+ * @param {Object} [options] The options for this function.
+ * @param {string} [options.cwd] The current working directory.
* @returns {Promise<boolean>} Whether flat config should be used.
*/
-async function shouldUseFlatConfig() {
+async function shouldUseFlatConfig({ cwd = process.cwd() } = {}) {
switch (process.env.ESLINT_USE_FLAT_CONFIG) {
case "true":
return true;
case "false":
return false;
@@ -1126,10 +1139,10 @@
/*
* If neither explicitly enabled nor disabled, then use the presence
* of a flat config file to determine enablement.
*/
- return !!(await findFlatConfigFile(process.cwd()));
+ return !!(await findFlatConfigFile(cwd));
}
}
//------------------------------------------------------------------------------
// Public Interface