Comparing version 11.0.0 to 11.1.0
@@ -5,9 +5,12 @@ 'use strict'; | ||
exports.resolve = function (cwd) { | ||
exports.resolve = function (cwd, eslint_path) { | ||
if (!eslint_path) { | ||
eslint_path = 'eslint'; | ||
} | ||
try { | ||
return resolver.resolve('eslint', { paths: [cwd] }); | ||
return resolver.resolve(eslint_path, { paths: [cwd] }); | ||
} catch (e) { | ||
// module not found | ||
return resolver.resolve('eslint'); | ||
return resolver.resolve(eslint_path); | ||
} | ||
}; |
@@ -87,9 +87,9 @@ /* eslint-disable no-sync */ | ||
function createCache(cwd) { | ||
const eslintPath = eslint_path.resolve(cwd); | ||
function createCache(cwd, eslint_path_arg) { | ||
const absolute_eslint_path = eslint_path.resolve(cwd, eslint_path_arg); | ||
return eslintCache.set(cwd, { | ||
eslint: require(eslintPath), | ||
eslint: require(absolute_eslint_path), | ||
// use chalk from eslint | ||
chalk: require(resolver.resolve('chalk', { | ||
paths: [path.dirname(eslintPath)] | ||
paths: [path.dirname(absolute_eslint_path)] | ||
})) | ||
@@ -282,8 +282,17 @@ }); | ||
let eslint_path_arg; | ||
const eslint_path_arg_index = args.indexOf('--eslint-path'); | ||
if (eslint_path_arg_index !== -1) { | ||
eslint_path_arg = args[eslint_path_arg_index].split('=')[1]; | ||
if (!eslint_path_arg) { | ||
eslint_path_arg = args[eslint_path_arg_index + 1]; | ||
} | ||
} | ||
let cache = eslintCache.get(cwd); | ||
if (!cache) { | ||
cache = createCache(cwd); | ||
cache = createCache(cwd, eslint_path_arg); | ||
} else if (mtime > cache.last_run) { | ||
clearRequireCache(cwd); | ||
cache = createCache(cwd); | ||
cache = createCache(cwd, eslint_path_arg); | ||
} | ||
@@ -290,0 +299,0 @@ cache.last_run = Date.now(); |
@@ -61,2 +61,7 @@ 'use strict'; | ||
}, | ||
{ | ||
option: 'eslint-path', | ||
type: 'path::String', | ||
description: 'Specify the path to the eslint module to use', | ||
}, | ||
@@ -63,0 +68,0 @@ { |
@@ -62,2 +62,7 @@ 'use strict'; | ||
}, | ||
{ | ||
option: 'eslint-path', | ||
type: 'path::String', | ||
description: 'Specify the path to the eslint module to use', | ||
}, | ||
@@ -64,0 +69,0 @@ { |
{ | ||
"name": "eslint_d", | ||
"version": "11.0.0", | ||
"version": "11.1.0", | ||
"description": "Makes eslint the fastest linter on the planet", | ||
@@ -30,3 +30,4 @@ "bin": "bin/eslint_d.js", | ||
"Jose Alvarez <j.alvarez11@icloud.com>", | ||
"Damien Cassou <damien@cassou.me>" | ||
"Damien Cassou <damien@cassou.me>", | ||
"James Pulec <jpulec@gmail.com>" | ||
], | ||
@@ -33,0 +34,0 @@ "homepage": "https://github.com/mantoni/eslint_d.js", |
@@ -197,3 +197,3 @@ # eslint\_d | ||
- `11.0.0`: eslint 4 - 8.beta, node 12 - 16 | ||
- `11.0.0`: eslint 4 - 8, node 12 - 16 | ||
- `10.0.0`: eslint 4 - 7, node 10 - 14 (using new `ESLint` API if available) | ||
@@ -200,0 +200,0 @@ - `9.0.0`: eslint 4 - 7, node 10 - 14 (using `CLIEngine` API) |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
35492
925