diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64f9dca1..764f129f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,5 +41,7 @@ jobs: node-version: ${{ matrix.node }} - name: Install dependencies run: npm install + - name: Build packages + run: npm run build - name: Run tests run: npm run test diff --git a/package.json b/package.json index 524d7c83..650c49a6 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "devDependencies": { "common-tags": "^1.8.2", - "eslint": "^9.4.0", + "eslint": "^9.11.1", "eslint-config-eslint": "^11.0.0", "eslint-plugin-chai-friendly": "^1.0.0", "globals": "^15.1.0", diff --git a/packages/eslint-scope/package.json b/packages/eslint-scope/package.json index 9b8a9aa8..9482b1fa 100644 --- a/packages/eslint-scope/package.json +++ b/packages/eslint-scope/package.json @@ -44,7 +44,7 @@ "estraverse": "^5.2.0" }, "devDependencies": { - "@typescript-eslint/parser": "^7.1.1", + "@typescript-eslint/parser": "^8.7.0", "c8": "^7.7.3", "chai": "^4.3.4", "eslint-release": "^3.2.0", diff --git a/packages/eslint-visitor-keys/package.json b/packages/eslint-visitor-keys/package.json index 316c29e4..f7c6e8ee 100644 --- a/packages/eslint-visitor-keys/package.json +++ b/packages/eslint-visitor-keys/package.json @@ -28,7 +28,7 @@ "devDependencies": { "@types/estree": "^0.0.51", "@types/estree-jsx": "^0.0.1", - "@typescript-eslint/parser": "^5.14.0", + "@typescript-eslint/parser": "^8.7.0", "c8": "^7.11.0", "chai": "^4.3.6", "eslint-release": "^3.2.0", @@ -36,18 +36,16 @@ "json-diff": "^0.7.3", "mocha": "^9.2.1", "opener": "^1.5.2", - "rollup": "^2.70.0", - "rollup-plugin-dts": "^4.2.3", - "tsd": "^0.19.1", - "typescript": "^4.9.5" + "rollup": "^4.22.4", + "rollup-plugin-dts": "^6.1.1", + "tsd": "^0.31.2", + "typescript": "^5.6.2" }, "scripts": { "build": "npm run build:cjs && npm run build:types", "build:cjs": "rollup -c", "build:debug": "npm run build:cjs -- -m && npm run build:types", - "build:keys": "node tools/build-keys-from-ts", - "build:types": "tsc", - "prepare": "npm run build", + "build:types": "tsc -v && tsc", "release:generate:latest": "eslint-generate-release", "release:generate:alpha": "eslint-generate-prerelease alpha", "release:generate:beta": "eslint-generate-prerelease beta", diff --git a/packages/eslint-visitor-keys/tests/lib/get-keys-from-ts.js b/packages/eslint-visitor-keys/tests/lib/get-keys-from-ts.js deleted file mode 100644 index 9b32795d..00000000 --- a/packages/eslint-visitor-keys/tests/lib/get-keys-from-ts.js +++ /dev/null @@ -1,201 +0,0 @@ -/** - * @fileoverview Tests for checking that our build tool can retrieve keys out of TypeScript AST. - * @author Brett Zamir - */ - -import { diffString } from "json-diff"; -import { expect } from "chai"; -import { alphabetizeKeyInterfaces, getKeysFromTsFile } from "../../tools/get-keys-from-ts.js"; -import { KEYS } from "../../lib/index.js"; -import backwardCompatibleKeys from "../../tools/backward-compatible-keys.js"; - -describe("getKeysFromTsFile", () => { - it("gets keys", async () => { - const { keys, tsInterfaceDeclarations } = await getKeysFromTsFile( - "../../node_modules/@types/estree/index.d.ts" - ); - const { keys: jsxKeys } = await getKeysFromTsFile( - "../../node_modules/@types/estree-jsx/index.d.ts", - { - supplementaryDeclarations: tsInterfaceDeclarations - } - ); - - const actual = alphabetizeKeyInterfaces({ ...keys, ...jsxKeys, ...backwardCompatibleKeys }); - - const expected = KEYS; - - // eslint-disable-next-line no-console -- Mocha's may drop diffs so show with json-diff - console.log("JSON Diffs:", diffString(actual, expected) || "(none)"); - - expect(actual).to.deep.equal(expected); - }); - - it("gets keys minus explicitly omitted ones", async () => { - const { keys: actual } = await getKeysFromTsFile( - "./tests/lib/fixtures/union-omit.d.ts" - ); - - const expected = { - AnotherStatement: [ - "anotherToIgnore" - ], - IgnoredStatement: [], - StaticBlock: [] - }; - - expect(actual).to.deep.equal(expected); - }); - - it("sorts keys alphabetically if new", async () => { - const { keys: actual } = await getKeysFromTsFile( - "./tests/lib/fixtures/new-keys.d.ts" - ); - - const expected = { - NewFangledExpression: [ - "down", - "left", - "right", - "up" - ] - }; - - expect(actual).to.deep.equal(expected); - }); - - it("sorts extra keys at end alphabetically", async () => { - const { keys: actual } = await getKeysFromTsFile( - "./tests/lib/fixtures/new-keys-on-old.d.ts" - ); - - const expected = { - AssignmentExpression: [ - "left", - "right", - "down", - "up" - ] - }; - - expect(actual).to.deep.equal(expected); - }); - - it("sorts extra keys at end alphabetically (other order)", async () => { - const { keys: actual } = await getKeysFromTsFile( - "./tests/lib/fixtures/new-keys-on-old-other-order.d.ts" - ); - - const expected = { - AssignmentExpression: [ - "left", - "right", - "down", - "up" - ] - }; - - expect(actual).to.deep.equal(expected); - }); - - it("sorts extra keys at end alphabetically (switched order)", async () => { - const { keys: actual } = await getKeysFromTsFile( - "./tests/lib/fixtures/new-keys-on-old-order-switched.d.ts" - ); - - const expected = { - AssignmentExpression: [ - "left", - "right", - "down", - "up" - ] - }; - - expect(actual).to.deep.equal(expected); - }); - - it("throws with unhandled TS type reference", async () => { - let error; - - try { - await getKeysFromTsFile( - "./tests/lib/fixtures/bad-type-reference.d.ts" - ); - } catch (err) { - error = err; - } - - expect(error.message).to.contain("Unhandled TypeScript type reference"); - }); - - it("throws with unhandled extends TS type reference", async () => { - let error; - - try { - await getKeysFromTsFile( - "./tests/lib/fixtures/bad-extends-type-reference.d.ts" - ); - } catch (err) { - error = err; - } - - expect(error.message).to.contain("Unhandled TypeScript type reference"); - }); - - it("throws with unhandled TS type", async () => { - let error; - - try { - await getKeysFromTsFile( - "./tests/lib/fixtures/bad-type.d.ts" - ); - } catch (err) { - error = err; - } - - expect(error.message).to.contain("Unhandled TypeScript type;"); - }); - - it("throws with unhandled TS typeParameters", async () => { - let error; - - try { - await getKeysFromTsFile( - "./tests/lib/fixtures/bad-type-parameters.d.ts" - ); - } catch (err) { - error = err; - } - - expect(error.message).to.contain("Unknown type parameter"); - }); - - it("throws with bad key", async () => { - let error; - - try { - await getKeysFromTsFile( - "./tests/lib/fixtures/new-keys-bad.d.ts" - ); - } catch (err) { - error = err; - } - - expect(error.message).to.equal("Type unknown as to traversability: BadExpression"); - }); - - it("throws with bad type value", async () => { - let error; - - try { - await getKeysFromTsFile( - "./tests/lib/fixtures/bad-type-value.d.ts" - ); - } catch (err) { - error = err; - } - - expect(error.message).to.equal("Unexpected `type` value property type TSUndefinedKeyword"); - }); -}); diff --git a/packages/eslint-visitor-keys/tools/backward-compatible-keys.js b/packages/eslint-visitor-keys/tools/backward-compatible-keys.js deleted file mode 100644 index ead9e70a..00000000 --- a/packages/eslint-visitor-keys/tools/backward-compatible-keys.js +++ /dev/null @@ -1,10 +0,0 @@ -const backwardCompatibleKeys = { - ExperimentalRestProperty: [ - "argument" - ], - ExperimentalSpreadProperty: [ - "argument" - ] -}; - -export default backwardCompatibleKeys; diff --git a/packages/eslint-visitor-keys/tools/build-keys-from-ts.js b/packages/eslint-visitor-keys/tools/build-keys-from-ts.js deleted file mode 100644 index 7d7e8a73..00000000 --- a/packages/eslint-visitor-keys/tools/build-keys-from-ts.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @fileoverview Script to build our visitor keys based on TypeScript AST. - * - * Uses `get-keys-from-ts.js` to read the files and build the keys and then - * merges them in alphabetical order of Node type before writing to file. - * - * @author Brett Zamir - */ - -import fs from "node:fs"; -import { alphabetizeKeyInterfaces, getKeysFromTsFile } from "./get-keys-from-ts.js"; -import backwardCompatibleKeys from "./backward-compatible-keys.js"; - -const { promises: { writeFile } } = fs; - -(async () => { - const { keys, tsInterfaceDeclarations } = await getKeysFromTsFile("./node_modules/@types/estree/index.d.ts"); - const { keys: jsxKeys } = await getKeysFromTsFile( - "./node_modules/@types/estree-jsx/index.d.ts", - { - supplementaryDeclarations: tsInterfaceDeclarations - } - ); - - const mergedKeys = alphabetizeKeyInterfaces({ ...keys, ...jsxKeys, ...backwardCompatibleKeys }); - - - console.log("keys", mergedKeys); - - writeFile( - "./lib/visitor-keys.js", - // eslint-disable-next-line indent -- Readability -`/** - * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys - */ - -/** - * @type {VisitorKeys} - */ -const KEYS = ${JSON.stringify(mergedKeys, null, 4).replace(/"(.*?)":/gu, "$1:")}; - -// Types. -const NODE_TYPES = Object.keys(KEYS); - -// Freeze the keys. -for (const type of NODE_TYPES) { - Object.freeze(KEYS[type]); -} -Object.freeze(KEYS); - -export default KEYS; -` - ); - -})(); diff --git a/packages/eslint-visitor-keys/tools/get-keys-from-ts.js b/packages/eslint-visitor-keys/tools/get-keys-from-ts.js deleted file mode 100644 index 1902fb39..00000000 --- a/packages/eslint-visitor-keys/tools/get-keys-from-ts.js +++ /dev/null @@ -1,546 +0,0 @@ -/** - * @fileoverview Script to build our visitor keys based on TypeScript AST. - * - * Uses `get-keys-from-ts.js` to read the files and build the keys and then - * merges them in alphabetical order of Node type before writing to file. - * - * @author Brett Zamir - */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -import { promises } from "node:fs"; -import { parseForESLint } from "@typescript-eslint/parser"; -import esquery from "esquery"; - -import { getKeys, KEYS } from "../lib/index.js"; - -const { readFile } = promises; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const knownTypes = new Set([ - "TSUndefinedKeyword", - "TSNullKeyword", - "TSUnknownKeyword", - "TSBooleanKeyword", - "TSNumberKeyword", - "TSStringKeyword", - "TSLiteralType", // E.g., `true` - - // Apparently used for primitives, so exempting - "TSTypeLiteral", // E.g., `{value: {cooked, raw}}` - - "TSUnionType", // I.e., `|` - "TSTypeReference" -]); - -const notTraversableTypes = new Set([ - "RegExp" -]); - -const notTraversableTSTypes = new Set([ - "TSUndefinedKeyword", - "TSNullKeyword", - "TSBooleanKeyword", - "TSNumberKeyword", - "TSStringKeyword", - "TSBigIntKeyword", - "TSLiteralType" -]); - -const commentTypes = new Set([ - "Line", - "Block" -]); - -/** - * Get the literal names out of AST - * @param {Node} excludedItem Excluded node - * @returns {string[]} The literal names - */ -function findOmitTypes(excludedItem) { - if (excludedItem.type === "TSUnionType") { - return excludedItem.types.map(typeNode => findOmitTypes(typeNode)); - } - return excludedItem.literal.value; -} - -/** - * Checks whether property should be excluded - * @param {string} property Property to check - * @param {string[]} excludedProperties Properties not to allow - * @returns {boolean} Whether or not to be excluded - */ -function isPropertyExcluded(property, excludedProperties) { - return excludedProperties && excludedProperties.includes(property); -} - -//------------------------------------------------------------------------------ -// Public APIs -//------------------------------------------------------------------------------ - -/** - * Returns alphabetized keys - * @param {KeysStrict} initialNodes Initial node list to sort - * @returns {KeysStrict} The keys - */ -function alphabetizeKeyInterfaces(initialNodes) { - - /** - * Alphabetize - * @param {string} typeA The first type to compare - * @param {string} typeB The second type to compare - * @returns {1|-1} The sorting index - */ - function alphabetize([typeA], [typeB]) { - return typeA < typeB ? -1 : 1; - } - const sortedNodeEntries = Object.entries(initialNodes).sort(alphabetize); - - /** - * Get the key sorter for a given type - * @param {string} type The type - * @returns {(string, string) => -1|1} The sorter - */ - function getKeySorter(type) { - const sequence = KEYS[type]; - - /** - * Alphabetize - * @param {string} typeA The first type to compare - * @param {string} typeB The second type to compare - * @returns {1|-1} The sorting index - */ - return function sortKeys(typeA, typeB) { - if (!sequence) { - return typeA < typeB ? -1 : 1; - } - - const idxA = sequence.indexOf(typeA); - const idxB = sequence.indexOf(typeB); - - if (idxA === -1 && idxB === -1) { - return typeA < typeB ? -1 : 1; - } - if (idxA === -1) { - return 1; - } - if (idxB === -1) { - return -1; - } - - return idxA < idxB ? -1 : 1; - }; - } - - for (const [type, keys] of sortedNodeEntries) { - keys.sort(getKeySorter(type)); - } - - return Object.fromEntries(sortedNodeEntries); -} - -/** - * Traverse interface `extends` - * @param {Node} declNode The TS declaration node - * @param {Function} handler The callback - * @returns {any[]} Return value of handler - * @throws {Error} If it finds an unknown type parameter. - */ -function traverseExtends(declNode, handler) { - const ret = []; - - for (const extension of declNode.extends || []) { - const { typeParameters, expression } = extension; - const innerInterfaceName = expression.name; - - let res; - - if (typeParameters) { - if (innerInterfaceName !== "Omit") { - throw new Error("Unknown type parameter"); - } - - const [param, ...excludedAST] = typeParameters.params; - const paramInterfaceName = param.typeName.name; - const excluded = excludedAST.flatMap(findOmitTypes); - - res = handler({ iName: paramInterfaceName, excluded }); - } else { - res = handler({ iName: innerInterfaceName }); - } - - ret.push(res); - } - - return ret; -} - -/** - * Traverse the properties of a declaration node. - * @param {Node} tsDeclarationNode The declaration node - * @param {(string) => void} handler Passed the property - * @returns {any[]} The return values of the callback - */ -function traverseProperties(tsDeclarationNode, handler) { - const tsPropertySignatures = tsDeclarationNode.body.body; - - const ret = []; - - for (const tsPropertySignature of tsPropertySignatures) { - const property = tsPropertySignature.key.name; - - const tsAnnotation = tsPropertySignature.typeAnnotation.typeAnnotation; - - const res = handler({ property, tsAnnotation }); - - ret.push(res); - } - - return ret; -} - -/** - * Builds visitor keys based on TypeScript declaration. - * @param {string} code TypeScript declaration file as code to parse. - * @param {{supplementaryDeclarations: Node[]}} [options] The options - * @returns {VisitorKeysExport} The built visitor keys - * @throws {Error} If it finds an unknown type. - */ -function getKeysFromTs(code, { - - // Todo: Ideally we'd just get these from the import - supplementaryDeclarations = { - allTsInterfaceDeclarations: [], - exportedTsInterfaceDeclarations: [], - tsTypeDeclarations: [] - } -} = {}) { - const unrecognizedTSTypeReferences = new Set(); - const unrecognizedTSTypes = new Set(); - - const parsedTSDeclaration = parseForESLint(code); - - const allTsInterfaceDeclarations = [...esquery.query( - parsedTSDeclaration.ast, - "TSInterfaceDeclaration", - { - - // TypeScript keys here to find our *.d.ts nodes (not for the ESTree - // ones we want) - visitorKeys: parsedTSDeclaration.visitorKeys - } - ), ...supplementaryDeclarations.allTsInterfaceDeclarations]; - - const exportedTsInterfaceDeclarations = [...esquery.query( - parsedTSDeclaration.ast, - "ExportNamedDeclaration > TSInterfaceDeclaration", - { - - // TypeScript keys here to find our *.d.ts nodes (not for the ESTree - // ones we want) - visitorKeys: parsedTSDeclaration.visitorKeys - } - ), ...supplementaryDeclarations.exportedTsInterfaceDeclarations]; - - const tsTypeDeclarations = [...esquery.query( - parsedTSDeclaration.ast, - "TSTypeAliasDeclaration", - { - - // TypeScript keys here to find our *.d.ts nodes (not for the ESTree - // ones we want) - visitorKeys: parsedTSDeclaration.visitorKeys - } - ), ...supplementaryDeclarations.tsTypeDeclarations]; - - const initialNodes = {}; - - /** - * Finds a TypeScript interface declaration. - * @param {string} interfaceName The type name. - * @returns {Node} The interface declaration node - */ - function findTsInterfaceDeclaration(interfaceName) { - return allTsInterfaceDeclarations.find( - innerTsDeclaration => innerTsDeclaration.id.name === interfaceName - ); - } - - /** - * Finds a TypeScript type declaration. - * @param {string} typeName A type name - * @returns {Node} The type declaration node - */ - function findTsTypeDeclaration(typeName) { - return tsTypeDeclarations.find(typeDecl => typeDecl.id.name === typeName); - } - - /** - * Whether has a valid (non-comment) type - * @param {Object} cfg Config object - * @param {string} cfg.property The property name - * @param {Node} cfg.tsAnnotation The annotation node - * @returns {boolean} Whether has a traverseable type - * @throws {Error} If it finds an unknown type. - */ - function hasValidType({ property, tsAnnotation }) { - const tsPropertyType = tsAnnotation.type; - - if (property !== "type") { - return false; - } - - switch (tsPropertyType) { - case "TSLiteralType": - return typeof tsAnnotation.literal.value === "string" && - !commentTypes.has(tsAnnotation.literal.value); - case "TSStringKeyword": - - // Ok, but not sufficient - return false; - case "TSUnionType": - return tsAnnotation.types.some(annType => hasValidType({ - property: "type", - tsAnnotation: annType - })); - default: - throw new Error(`Unexpected \`type\` value property type ${tsPropertyType}`); - } - } - - /** - * Whether the interface has a valid type ancestor - * @param {string} interfaceName The interface to check - * @returns {void} - * @throws {Error} If it finds an unknown type. - */ - function hasValidTypeAncestor(interfaceName) { - let decl = findTsInterfaceDeclaration(interfaceName); - - if (decl) { - if (traverseProperties(decl, hasValidType).some(hasValid => hasValid)) { - return true; - } - } - - if (!decl) { - decl = findTsTypeDeclaration(interfaceName); - if (decl) { - if (!decl.typeAnnotation.types) { - return notTraversableTSTypes.has(decl.typeAnnotation.type) - ? false - : hasValidTypeAncestor(decl.typeAnnotation.typeName.name); - } - - return decl.typeAnnotation.types.some(type => { - if (!type.typeName) { - - // Literal - return false; - } - - return hasValidTypeAncestor(type.typeName.name); - }); - } - } - - if (!decl) { - throw new Error(`Type unknown as to traversability: ${interfaceName}`); - } - - if (traverseExtends(decl, ({ iName, excluded }) => { - - // We don't want to look at this ancestor's `type` if being excluded - if (excluded && excluded.includes("type")) { - return false; - } - - return hasValidTypeAncestor(iName); - }).some(hasValid => hasValid)) { - return true; - } - - return false; - } - - /** - * Determine whether the Node is traversable - * @param {Node} annotationType The annotation type Node - * @param {string} property The property name - * @returns {boolean} Whether the node is traversable - */ - function checkTraversability(annotationType, property) { - if ( - notTraversableTSTypes.has(annotationType.type) - ) { - return false; - } - - if (annotationType.type === "TSTupleType") { - return annotationType.elementTypes.some(annType => checkTraversability(annType, property)); - } - - if (annotationType.type === "TSUnionType") { - return annotationType.types.some(annType => checkTraversability(annType, property)); - } - - if (annotationType.typeName.name === "Array") { - return annotationType.typeParameters.params.some(annType => checkTraversability(annType, property)); - } - - if ( - notTraversableTypes.has(annotationType.typeName.name) - ) { - return false; - } - - if (hasValidTypeAncestor(annotationType.typeName.name)) { - return true; - } - - return false; - } - - /** - * Adds a property to a node based on a type declaration node's contents. - * @param {Node} tsDeclarationNode TypeScript declaration node - * @param {Node} node The Node on which to build - * @param {string[]} excludedProperties Excluded properties - * @returns {void} - */ - function addPropertyToNodeForDeclaration(tsDeclarationNode, node, excludedProperties) { - - traverseProperties(tsDeclarationNode, ({ property, tsAnnotation }) => { - if (isPropertyExcluded(property, excludedProperties)) { - return; - } - - const tsPropertyType = tsAnnotation.type; - - if (property === "type" && tsPropertyType === "TSLiteralType") { - - // console.log('tsAnnotation', tsAnnotation); - // node[property] = tsAnnotation.literal.value; - // return; - } - - // For sanity-checking - if (!knownTypes.has(tsPropertyType)) { - unrecognizedTSTypes.add(tsPropertyType); - return; - } - - switch (tsPropertyType) { - case "TSUnionType": - if (tsAnnotation.types.some(annType => checkTraversability(annType, property))) { - break; - } - return; - case "TSTypeReference": { - if (checkTraversability(tsAnnotation, property)) { - break; - } - - return; - } default: - return; - } - - node[property] = null; - }); - - traverseExtends(tsDeclarationNode, ({ iName, excluded }) => { - const innerTsDeclarationNode = findTsInterfaceDeclaration(iName); - - if (!innerTsDeclarationNode) { - unrecognizedTSTypeReferences.add(iName); - return; - } - - addPropertyToNodeForDeclaration(innerTsDeclarationNode, node, excluded); - }); - } - - for (const tsDeclarationNode of exportedTsInterfaceDeclarations) { - const bodyType = tsDeclarationNode.body.body.find( - prop => prop.key.name === "type" - ); - - const typeName = bodyType && bodyType.typeAnnotation && - bodyType.typeAnnotation.typeAnnotation && - bodyType.typeAnnotation.typeAnnotation.literal && - bodyType.typeAnnotation.typeAnnotation.literal.value; - - if (!typeName) { - continue; - } - - const node = {}; - - addPropertyToNodeForDeclaration(tsDeclarationNode, node); - - initialNodes[typeName] = [...new Set(getKeys(node), ...(initialNodes[typeName] || []))]; - } - - const nodes = alphabetizeKeyInterfaces(initialNodes); - - if (unrecognizedTSTypes.size) { - throw new Error( - "Unhandled TypeScript type; please update the code to " + - "handle the type or if not relevant, add it to " + - "`unrecognizedTSTypes`; see\n\n " + - `${[...unrecognizedTSTypes].join(", ")}\n` - ); - } - if (unrecognizedTSTypeReferences.size) { - throw new Error( - "Unhandled TypeScript type reference; please update the code to " + - "handle the type reference or if not relevant, add it to " + - "`unrecognizedTSTypeReferences`; see\n\n " + - `${[...unrecognizedTSTypeReferences].join(", ")}\n` - ); - } - - return { - keys: nodes, - tsInterfaceDeclarations: { - allTsInterfaceDeclarations, - exportedTsInterfaceDeclarations, - tsTypeDeclarations - } - }; -} - -/** - * @typedef {{ - * keys: KeysStrict, - * tsInterfaceDeclarations: { - * allTsInterfaceDeclarations: Node[], - * exportedTsInterfaceDeclarations: Node[] - * } - * }} VisitorKeysExport - */ - -/** - * Builds visitor keys based on TypeScript declaration. - * @param {string} file TypeScript declaration file to parse. - * @param {{supplementaryDeclarations: Object}} options The options - * @returns {Promise} The built visitor keys - */ -async function getKeysFromTsFile(file, options) { - const code = await readFile(file); - - return getKeysFromTs(code, options); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -export { alphabetizeKeyInterfaces, getKeysFromTs, getKeysFromTsFile }; diff --git a/packages/eslint-visitor-keys/tsconfig.json b/packages/eslint-visitor-keys/tsconfig.json index 57d4de12..f9118a4f 100644 --- a/packages/eslint-visitor-keys/tsconfig.json +++ b/packages/eslint-visitor-keys/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "lib": ["es2022"], + "lib": ["esnext"], "moduleResolution": "node", "module": "esnext", "resolveJsonModule": true, diff --git a/packages/espree/package.json b/packages/espree/package.json index a1107444..025a8df9 100644 --- a/packages/espree/package.json +++ b/packages/espree/package.json @@ -37,15 +37,15 @@ "eslint-visitor-keys": "^4.0.0" }, "devDependencies": { - "@rollup/plugin-commonjs": "^17.1.0", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^11.2.0", + "@rollup/plugin-commonjs": "^28.0.0", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.3.0", "c8": "^7.11.0", "eslint-release": "^3.2.0", "esprima-fb": "^8001.2001.0-dev-harmony-fb", "mocha": "^9.2.2", "npm-run-all2": "^6.2.2", - "rollup": "^2.41.2", + "rollup": "^2.79.1", "shelljs": "^0.8.5" }, "keywords": [