Comparing version 13.0.0 to 13.1.0
@@ -41,3 +41,3 @@ 'use strict'; | ||
function createCache(cwd, eslint_path_arg) { | ||
const absolute_eslint_path = eslint_path.resolve(cwd, eslint_path_arg); | ||
let absolute_eslint_path = eslint_path.resolve(cwd, eslint_path_arg); | ||
@@ -48,2 +48,7 @@ if (!absolute_eslint_path) { | ||
// Use new ESLintFlatConfig | ||
if (process.env.ESLINT_USE_FLAT_CONFIG) { | ||
absolute_eslint_path | ||
= absolute_eslint_path.replace('/lib/api.js', '/lib/unsupported-api.js'); | ||
} | ||
return lru_cache.set(cwd, { | ||
@@ -50,0 +55,0 @@ eslint: require(absolute_eslint_path), |
@@ -83,2 +83,19 @@ /* eslint-disable no-sync */ | ||
function translateOptionsFlatESLint(cliOptions, cwd) { | ||
return { | ||
allowInlineConfig: cliOptions.inlineConfig, | ||
cache: cliOptions.cache, | ||
cacheLocation: cliOptions.cacheLocation || cliOptions.cacheFile, | ||
cacheStrategy: cliOptions.cacheStrategy, | ||
errorOnUnmatchedPattern: cliOptions.errorOnUnmatchedPattern, | ||
fix: cliOptions.fix || cliOptions.fixDryRun || cliOptions.fixToStdout, | ||
ignore: cliOptions.ignore, | ||
plugins: cliOptions.plugin, | ||
overrideConfigFile: cliOptions.config, | ||
reportUnusedDisableDirectives: cliOptions.reportUnusedDisableDirectives | ||
? 'error' : undefined, | ||
cwd | ||
}; | ||
} | ||
function countErrors(results) { | ||
@@ -152,4 +169,11 @@ let errorCount = 0; | ||
async function executeWithESLint(ESLint, cwd, opts, text, callback) { | ||
const engine = new ESLint(translateOptionsESLint(opts, cwd)); | ||
async function executeWithESLint( | ||
ESLint, | ||
cwd, | ||
translateOptions, | ||
opts, | ||
text, | ||
callback | ||
) { | ||
const engine = new ESLint(translateOptions(opts, cwd)); | ||
const files = opts._; | ||
@@ -309,7 +333,12 @@ const stdin = opts.stdin; | ||
if (cache.eslint.ESLint) { | ||
if (cache.eslint.ESLint || cache.eslint.FlatESLint) { | ||
const absolute_cwd = path.resolve(cwd); | ||
try { | ||
await executeWithESLint(cache.eslint.ESLint, absolute_cwd, opts, text, | ||
callback); | ||
if (process.env.ESLINT_USE_FLAT_CONFIG) { | ||
await executeWithESLint(cache.eslint.FlatESLint, absolute_cwd, | ||
translateOptionsFlatESLint, opts, text, callback); | ||
} else { | ||
await executeWithESLint(cache.eslint.ESLint, absolute_cwd, | ||
translateOptionsESLint, opts, text, callback); | ||
} | ||
} catch (e) { | ||
@@ -316,0 +345,0 @@ e.exitCode = 2; |
{ | ||
"name": "eslint_d", | ||
"version": "13.0.0", | ||
"version": "13.1.0", | ||
"description": "Makes eslint the fastest linter on the planet", | ||
@@ -37,3 +37,4 @@ "bin": "bin/eslint_d.js", | ||
"Herr Kaste <herr.kaste@gmail.com>", | ||
"Christian Alfoni <christianalfoni@gmail.com>" | ||
"Christian Alfoni <christianalfoni@gmail.com>", | ||
"Amrit Kahlon <amritkahlon00@gmail.com>" | ||
], | ||
@@ -40,0 +41,0 @@ "homepage": "https://github.com/mantoni/eslint_d.js", |
@@ -70,2 +70,5 @@ # eslint\_d | ||
Experimental support for eslint flat config is available since `v13.1.0` if | ||
the `ESLINT_USE_FLAT_CONFIG` environment variable is defined. | ||
## Commands | ||
@@ -72,0 +75,0 @@ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
39642
1044
233
12