You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current state of types for AST nodes in eslint-plugin-package-json is that we've completely swapped out the built-in ESLint ones. Nodes are instead typed using import type { AST as JsonAST } from "jsonc-eslint-parser"; -> node: JsonAST.JSONProperty and the like.
Unfortunately, ESLint's APIs still expect ESTree nodes. So we end up with assertions any time we need to pass the nodes to ESLint's APIs:
This isn't ideal. One workaround done by eslint-plugin-jsonc is to instead pass loc: node.loc. But I'd ideally like to be able to just pass the node directly.
Is this something we can solve at the parser level in jsonc-eslint-parser? Slash, maybe we should modify @types/eslint in some way to make the context generic (per JoshuaKGoldberg/eslint-plugin-package-json#125 additional info)?
The text was updated successfully, but these errors were encountered:
Hmm... In my opinion, the best option is to change @types/eslint to accept ESTree.Node | {type: string, loc: SourceLocation} as a node.
What do you think?
Description
Following #184 -> #186: I'm still finding that I need to do some massaging of TypeScript types. Also filed in JoshuaKGoldberg/eslint-plugin-package-json#125.
The current state of types for AST nodes in
eslint-plugin-package-json
is that we've completely swapped out the built-in ESLint ones. Nodes are instead typed usingimport type { AST as JsonAST } from "jsonc-eslint-parser";
->node: JsonAST.JSONProperty
and the like.Unfortunately, ESLint's APIs still expect ESTree nodes. So we end up with assertions any time we need to pass the nodes to ESLint's APIs:
This isn't ideal. One workaround done by
eslint-plugin-jsonc
is to instead passloc: node.loc
. But I'd ideally like to be able to just pass thenode
directly.Is this something we can solve at the parser level in
jsonc-eslint-parser
? Slash, maybe we should modify@types/eslint
in some way to make the context generic (per JoshuaKGoldberg/eslint-plugin-package-json#125 additional info)?The text was updated successfully, but these errors were encountered: