Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
Relevant Package
visitor-keys
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
A comment in visitor-keys
package states that keys "should be sorted in the order that they appear in the source code".
typescript-eslint/packages/visitor-keys/src/visitor-keys.ts
Lines 111 to 132 in 0f5c59c
#11276 related to 5 types where this was not the case (fixed in #11279).
The field orders for standard ESTree types are inherited from eslint-visitor-keys
, which are outside of TS-ESLint's control.
After #11279 and eslint/js#656, visitor keys for all types are in source code order, as intended, but there are no tests for this. It would be ideal to have tests, to ensure this rule doesn't get broken again unintentionally in future.
Additional Info
I'm not sure how such tests would be implemented. Ideally you'd probably want to codegen them so they automatically cover any new AST nodes added in future, but then you'd need to run those tests on a large corpus of test fixtures to make sure they cover all syntax. But a vast corpus might make those tests extremely slow to run, so maybe it'd be something of a sledgehammer to crack a nut situation.