-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Emit declarations for eslint-plugin #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The `createRule` helper is extremely useful for writing rules in TypeScript. I would like to use that for my own ESLint rules. Exporting the types will help a lot!
Looks like |
It's being exported by the module
I was getting the same error when I copy-pasted this code into my own repo. I didn't fully resolve that issue. Not sure what's going on... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The big problem with doing this is that turning on declarations turns on a number of different checks within typescript.
The worst of which is so-called "private" types.
In essence the problem is:
type Foo = { /* ... */ };
export function Bar() : Foo {} // Bar is using private type Foo
As soon as a function is exported from a file, then all types related to the function must be exported from the file too.
This causes a whole range of headaches when writing code, which we don't want as it can make it harder to write normal code.
Additionally, this will publish the types with the plugin which will bloat the package.
This change would be a good candidate to move the relevant parts to a brand new package (say @typescript-eslint/plugin-helpers
), that way we can enable declarations on there and expose the tooling we're building to make it easier to write rules in TS; without making the experience writing rules in the plugin difficult.
Thoughts @typescript-eslint/core-team
Closing until we decide how we want to approach this issue: #330 |
The
createRule
helper is extremely useful for writing rules in TypeScript. I would like to use that for my own ESLint rules. Exporting the types will help a lot.