-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add types #164
Add types #164
Conversation
Awesome, thanks! How does this work? import type {ESLint} from "eslint"; Does the user need to install something to get that working? How do I test this manually that it works? |
This is essentially what I was talking about here #163 (comment) This asserts that what you're exporting is "an ESLint Plugin", but does not reflect the actual shape/contents of this particular plugin — i..e. which of the optinoal properties/objects (rules, config, etc.) it actually contains. |
These types are coming from
All you should need to test the types is: import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
import type {Linter} from "eslint";
const config: Linter.FlatConfig = {
plugins: {
"simple-import-sort": simpleImportSortPlugin
}
}
@maranomynet Were you looking to use the types of any of those optional properties? |
@lydell Did you need anything else in this pr? If we want more specific types those can always be done later as those types would simply extend the ones we have here. |
No, I’ve tested this now and think we’re ready to go! I was waiting for this reply, but it doesn’t bring anything useful for this repo it seems. I’ll try to make a release later today. |
Released in 12.1.0. Thanks again for the help! |
@JoshuaKGoldberg this plugin now has types, if you wanna update the table in eslint/eslint#18093 :) |
Yay! Thanks 😄 |
I just happened to already have types for this project in my own soon-to-be-published config. Ordinarily, configs, processors, parsers, and other custom exports would also need to be included, but as this plugin is quite simple 😉, only the basic plugin type needs to be used. For almost every use case, specific types for rules can be safely ignored as they are handled by ESLint internally with end users only referencing them by name.
fixes #163