eslint-module-utils
Advanced tools
Comparing version 2.4.1 to 2.5.0
@@ -8,2 +8,10 @@ # Change Log | ||
## v2.5.0 - 2019-12-07 | ||
### Added | ||
- support `parseForESLint` from custom parser ([#1435], thanks [@JounQin]) | ||
### Changed | ||
- Avoid superfluous calls and code ([#1551], thanks [@brettz9]) | ||
## v2.4.1 - 2019-07-19 | ||
@@ -13,3 +21,3 @@ | ||
- Improve parse perf when using `@typescript-eslint/parser` ([#1409], thanks [@bradzacher]) | ||
- Improve support for Typescript declare structures ([#1356], thanks [@christophercurrie]) | ||
- Improve support for TypeScript declare structures ([#1356], thanks [@christophercurrie]) | ||
@@ -57,2 +65,4 @@ ## v2.4.0 - 2019-04-13 | ||
[#1551]: https://github.com/benmosher/eslint-plugin-import/pull/1551 | ||
[#1435]: https://github.com/benmosher/eslint-plugin-import/pull/1435 | ||
[#1409]: https://github.com/benmosher/eslint-plugin-import/pull/1409 | ||
@@ -71,1 +81,3 @@ [#1356]: https://github.com/benmosher/eslint-plugin-import/pull/1356 | ||
[@christophercurrie]: https://github.com/christophercurrie | ||
[@brettz9]: https://github.com/brettz9 | ||
[@JounQin]: https://github.com/JounQin |
@@ -1,2 +0,2 @@ | ||
"use strict" | ||
'use strict' | ||
exports.__esModule = true | ||
@@ -3,0 +3,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
"use strict" | ||
'use strict' | ||
exports.__esModule = true | ||
@@ -46,3 +46,3 @@ | ||
hash.update("{") | ||
hash.update('{') | ||
Object.keys(object).sort().forEach(key => { | ||
@@ -52,3 +52,3 @@ hash.update(stringify(key)) | ||
hashify(object[key], hash) | ||
hash.update(",") | ||
hash.update(',') | ||
}) | ||
@@ -55,0 +55,0 @@ hash.update('}') |
@@ -1,2 +0,2 @@ | ||
"use strict" | ||
'use strict' | ||
exports.__esModule = true | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict" | ||
'use strict' | ||
exports.__esModule = true | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "eslint-module-utils", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"description": "Core utilities to support eslint-plugin-import and other module-related plugins.", | ||
@@ -28,5 +28,5 @@ "engines": { | ||
"dependencies": { | ||
"debug": "^2.6.8", | ||
"debug": "^2.6.9", | ||
"pkg-dir": "^2.0.0" | ||
} | ||
} |
24
parse.js
@@ -1,2 +0,2 @@ | ||
"use strict" | ||
'use strict' | ||
exports.__esModule = true | ||
@@ -39,4 +39,4 @@ | ||
// https://github.com/benmosher/eslint-plugin-import/issues/1408#issuecomment-509298962 | ||
delete parserOptions.project; | ||
delete parserOptions.projects; | ||
delete parserOptions.project | ||
delete parserOptions.projects | ||
@@ -46,2 +46,20 @@ // require the parser relative to the main module (i.e., ESLint) | ||
if (typeof parser.parseForESLint === 'function') { | ||
let ast | ||
try { | ||
ast = parser.parseForESLint(content, parserOptions).ast | ||
} catch (e) { | ||
// | ||
} | ||
if (!ast || typeof ast !== 'object') { | ||
console.warn( | ||
'`parseForESLint` from parser `' + | ||
parserPath + | ||
'` is invalid and will just be ignored' | ||
) | ||
} else { | ||
return ast | ||
} | ||
} | ||
return parser.parse(content, parserOptions) | ||
@@ -48,0 +66,0 @@ } |
@@ -1,2 +0,2 @@ | ||
"use strict" | ||
'use strict' | ||
exports.__esModule = true | ||
@@ -18,13 +18,13 @@ | ||
function tryRequire(target) { | ||
let resolved; | ||
let resolved | ||
try { | ||
// Check if the target exists | ||
resolved = require.resolve(target); | ||
resolved = require.resolve(target) | ||
} catch(e) { | ||
// If the target does not exist then just return undefined | ||
return undefined; | ||
return undefined | ||
} | ||
// If the target exists then return the loaded module | ||
return require(resolved); | ||
return require(resolved) | ||
} | ||
@@ -68,3 +68,3 @@ | ||
const coreSet = new Set(settings['import/core-modules']) | ||
if (coreSet != null && coreSet.has(modulePath)) return { found: true, path: null } | ||
if (coreSet.has(modulePath)) return { found: true, path: null } | ||
@@ -71,0 +71,0 @@ const sourceDir = path.dirname(sourceFile) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21410
12
546
Updateddebug@^2.6.9