Files
node/tools/node_modules/@babel/eslint-parser/lib/worker/ast-info.cjs
T
Rich Trott 50f91ab059 tools: udpate @babel/eslint-parser
Remove unused plugins and update @babel/eslint-parser

PR-URL: https://github.com/nodejs/node/pull/40394
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-10-13 10:24:43 +02:00

33 lines
1.2 KiB
JavaScript

const ESLINT_VISITOR_KEYS = require("eslint-visitor-keys").KEYS;
const babel = require("./babel-core.cjs");
let visitorKeys;
exports.getVisitorKeys = function getVisitorKeys() {
if (!visitorKeys) {
const newTypes = {
ChainExpression: ESLINT_VISITOR_KEYS.ChainExpression,
ImportExpression: ESLINT_VISITOR_KEYS.ImportExpression,
Literal: ESLINT_VISITOR_KEYS.Literal,
MethodDefinition: ["decorators"].concat(ESLINT_VISITOR_KEYS.MethodDefinition),
Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property),
PropertyDefinition: ["decorators", "typeAnnotation"].concat(ESLINT_VISITOR_KEYS.PropertyDefinition)
};
const conflictTypes = {
ClassPrivateMethod: ["decorators"].concat(ESLINT_VISITOR_KEYS.MethodDefinition),
ExportAllDeclaration: ESLINT_VISITOR_KEYS.ExportAllDeclaration
};
visitorKeys = Object.assign({}, newTypes, babel.types.VISITOR_KEYS, conflictTypes);
}
return visitorKeys;
};
let tokLabels;
exports.getTokLabels = function getTokLabels() {
return tokLabels || (tokLabels = (p => p.reduce((o, [k, v]) => Object.assign({}, o, {
[k]: v
}), {}))(Object.entries(babel.tokTypes).map(([key, tok]) => [key, tok.label])));
};