eslint-module-utils
Advanced tools
Comparing version 2.7.2 to 2.7.3
@@ -8,2 +8,7 @@ # Change Log | ||
## v2.7.3 - 2022-01-26 | ||
### Fixed | ||
- [Fix] `parse`: restore compatibility by making the return value `ast` again ([#2350], thanks [@ljharb]) | ||
## v2.7.2 - 2022-01-01 | ||
@@ -114,2 +119,3 @@ | ||
[#2350]: https://github.com/import-js/eslint-plugin-import/issues/2350 | ||
[#2343]: https://github.com/import-js/eslint-plugin-import/pull/2343 | ||
@@ -116,0 +122,0 @@ [#2261]: https://github.com/import-js/eslint-plugin-import/pull/2261 |
{ | ||
"name": "eslint-module-utils", | ||
"version": "2.7.2", | ||
"version": "2.7.3", | ||
"description": "Core utilities to support eslint-plugin-import and other module-related plugins.", | ||
@@ -5,0 +5,0 @@ "engines": { |
27
parse.js
@@ -35,2 +35,12 @@ 'use strict'; | ||
// this exists to smooth over the unintentional breaking change in v2.7. | ||
// TODO, semver-major: avoid mutating `ast` and return a plain object instead. | ||
function makeParseReturn(ast, visitorKeys) { | ||
if (ast) { | ||
ast.visitorKeys = visitorKeys; | ||
ast.ast = ast; | ||
} | ||
return ast; | ||
} | ||
exports.default = function parse(path, content, context) { | ||
@@ -77,6 +87,3 @@ | ||
ast = parserRaw.ast; | ||
return { | ||
ast, | ||
visitorKeys: keysFromParser(parserPath, parser, parserRaw), | ||
}; | ||
return makeParseReturn(ast, keysFromParser(parserPath, parser, parserRaw)); | ||
} catch (e) { | ||
@@ -94,14 +101,8 @@ console.warn(); | ||
} else { | ||
return { | ||
ast, | ||
visitorKeys: keysFromParser(parserPath, parser, undefined), | ||
}; | ||
return makeParseReturn(ast, keysFromParser(parserPath, parser, undefined)); | ||
} | ||
} | ||
const keys = keysFromParser(parserPath, parser, undefined); | ||
return { | ||
ast: parser.parse(content, parserOptions), | ||
visitorKeys: keys, | ||
}; | ||
const ast = parser.parse(content, parserOptions); | ||
return makeParseReturn(ast, keysFromParser(parserPath, parser, undefined)); | ||
}; | ||
@@ -108,0 +109,0 @@ |
Sorry, the diff of this file is not supported yet
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
32144
2