Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2025-02-03 17:20:53 +00:00
parent 3e913ef09d
commit 9660df3fcc
990 changed files with 74805 additions and 60149 deletions

View file

@ -29,12 +29,18 @@ function keysFromParser(parserPath, parserInstance, parsedResult) {
if (parsedResult && parsedResult.visitorKeys) {
return parsedResult.visitorKeys;
}
if (typeof parserPath === 'string' && (/.*espree.*/).test(parserPath)) {
return parserInstance.VisitorKeys;
}
// The old babel parser doesn't have a `parseForESLint` eslint function, so we don't end
// up with a `parsedResult` here. It also doesn't expose the visitor keys on the parser itself,
// so we have to try and infer the visitor-keys module from the parserPath.
// This is NOT supported in flat config!
if (typeof parserPath === 'string' && (/.*babel-eslint.*/).test(parserPath)) {
return getBabelEslintVisitorKeys(parserPath);
}
// The espree parser doesn't have the `parseForESLint` function, so we don't end up with a
// `parsedResult` here, but it does expose the visitor keys on the parser instance that we can use.
if (parserInstance && parserInstance.VisitorKeys) {
return parserInstance.VisitorKeys;
}
return null;
}
@ -107,7 +113,8 @@ exports.default = function parse(path, content, context) {
if (context == null) { throw new Error('need context to parse properly'); }
// ESLint in "flat" mode only sets context.languageOptions.parserOptions
let parserOptions = context.languageOptions && context.languageOptions.parserOptions || context.parserOptions;
const languageOptions = context.languageOptions;
let parserOptions = languageOptions && languageOptions.parserOptions || context.parserOptions;
const parserOrPath = getParser(path, context);
if (!parserOrPath) { throw new Error('parserPath or languageOptions.parser is required!'); }
@ -138,6 +145,17 @@ exports.default = function parse(path, content, context) {
delete parserOptions.project;
delete parserOptions.projects;
// If this is a flat config, we need to add ecmaVersion and sourceType (if present) from languageOptions
if (languageOptions && languageOptions.ecmaVersion) {
parserOptions.ecmaVersion = languageOptions.ecmaVersion;
}
if (languageOptions && languageOptions.sourceType) {
// @ts-expect-error languageOptions is from the flatConfig Linter type in 8.57 while parserOptions is not.
// Non-flat config parserOptions.sourceType doesn't have "commonjs" in the type. Once upgraded to v9 types,
// they'll be the same and this expect-error should be removed.
parserOptions.sourceType = languageOptions.sourceType;
}
// require the parser relative to the main module (i.e., ESLint)
const parser = typeof parserOrPath === 'string' ? moduleRequire(parserOrPath) : parserOrPath;
@ -161,7 +179,7 @@ exports.default = function parse(path, content, context) {
if (!ast || typeof ast !== 'object') {
console.warn(
// Can only be invalid for custom parser per imports/parser
'`parseForESLint` from parser `' + (typeof parserOrPath === 'string' ? parserOrPath : '`context.languageOptions.parser`') + '` is invalid and will just be ignored'
'`parseForESLint` from parser `' + (typeof parserOrPath === 'string' ? parserOrPath : 'context.languageOptions.parser') + '` is invalid and will just be ignored'
);
} else {
// @ts-expect-error TODO: FIXME