Skip to content

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

Closed
wants to merge 3 commits into from

Conversation

mohsen1
Copy link
Contributor

@mohsen1 mohsen1 commented Mar 1, 2019

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.

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!
@j-f1
Copy link
Contributor

j-f1 commented Mar 2, 2019

Looks like RuleModule needs to be exported.

@mohsen1
Copy link
Contributor Author

mohsen1 commented Mar 2, 2019

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...

Copy link
Member

@bradzacher bradzacher left a 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

@mohsen1
Copy link
Contributor Author

mohsen1 commented Mar 9, 2019

Closing until we decide how we want to approach this issue: #330

@mohsen1 mohsen1 closed this Mar 9, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants