Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
Before You File a Documentation Request Please Confirm You Have Done The Following...
- I have looked for existingopen or closed documentation requests that match my proposal.
- I haveread the FAQ and my problem is not listed.
Suggested Changes
Forking fromjsx-eslint/eslint-plugin-jsx-a11y#812 (comment): ESLint plugins want to be able to use type checking in their rules. For example,eslint-plugin-jsx-a11y'sjsx-a11y/alt-text wants to be able to determine whether a spread provides a prop such asalt to an image that would make it obviously inaccessible.
// Is this statically known to be inaccessible?// We need type information to know!<imgsrc="something.jpg"{...myProps}/>
Copyingjsx-eslint/eslint-plugin-jsx-a11y#812 (comment):
A couple of implementation detail points that make being type-aware tricky:
- If the rule uses the typescript-eslint tooling to be type-aware, it'll be locked into TypeScript (i.e. Flow and any future competitors won't work for its type checking)
- In my (and other typescript-eslint maintainers') experience, it's generally confusing for users when rules provide different -even better!- results when the config changes to allow type checking
Those concerns might be small and not more important than getting better info. Either way, this scenario is something we probably need to make explicit docs for on typescript-eslint.io.
Out of curiosity@ljharb, have you seen other plugins add type-aware linting the way this issue is suggesting before?
Copyingjsx-eslint/eslint-plugin-jsx-a11y#812 (comment):
eslint-plugin-react and eslint-plugin-import have lots of examples to look at.
The one trick tho will be that we'll probably need to add the infrastructure for testing with the TS parser.
We'll want to document, at the very least:
- Guidance for how to turn on typed linting for rules (explicit opt-in? implicit-if-parser-services-are-available?)
- How to set up tests, if not already covered inhttps://typescript-eslint.io/docs/development/custom-rules
- ...anything else useful?
I would mention other maintainers on those repos to ask for input too, but...@ljharb are you the only one? Are there other people we should loop in? 😂
Affected URL(s)
https://typescript-eslint.io/docs/development/custom-rules should probably link to this new page
Maybehttps://typescript-eslint.io/docs/development/custom-plugins or some similar URL?