-
-
Notifications
You must be signed in to change notification settings - Fork 35
Description
When using @typescript-eslint/utils you can compare node and token types against the AST_NODE_TYPES and AST_TOKEN_TYPES enums.
Using these can help avoid typos and maybe improve discoverability, though I think the main reason to do so is just consistency since it'd be a breaking change for a type value to actually change.
Regardless, it would be great if there was a linting rule to enforce using these instead of native strings, which I think would be make sense to live in this plugin even though it only applies when you're using @typescript-eslint/utils because:
- a handful of plugins do (
eslint-plugin-jest,eslint-plugin-vitest,eslint-plugin-testing-library) - this is the plugin for eslint plugins
- the implementation should be pretty lightweight
I'm happy to handle implementing the rule itself if folks are happy to have it here - my plan would be to have it import the enums from @typescript-eslint/utils within its create function and report any string literals whose value matches one of the enum values