-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Converting rules to be in TypeScript #47
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
Comments
Things I encountered when trying to write custom ESLint rules in TypeScript for desktop/desktop:
|
I think I am negative one on this one as much as I wish the eslint project was in TypeScript it is not and I think it is better to keep this project in line with the style of eslint as a whole for consistency :( |
There's definite advantages either way. There's something nice about using the same language as the rest of ESLint, and there's something nice about writing rules in the same language that they are running on. It definitely very common for tooling to be written in the language the tooling is for. Obviously this is not my project, hence why I was asking the question and wondering what others think. Th |
I've done typescript + eslint config before (https://github.com/assignar/eslint-config-assignar), but I haven't done a plugin with it yet. There's obvious benefits about switching to typescript which could help catch some bugs that were missed. Would be worth investigating |
I think now that typescript in ESLint is becoming a lot bigger of a thing, this is worth re-visiting. @bradzacher would you support PR(s) to start converting rules to typescript? |
Yes and no. On this repo specifically, no. We're getting ready to migrate this repo to the monorepo. I definitely want to migrate this project into typescript if only because we've had a few bugs caused by types. So once we have migrated, we can tackle this. |
Sounds good, going to create an issue on the monorepo regarding documenting writing rules for ts in ts, and then once this repo migrates over there we can follow it up. |
Hello 👋 Just as an FYI, we currently write our rules in typescript over at 43081j/eslint-plugin-lit so I had a poke around this repo too to see how difficult it is to do the same. It is all fairly straight forward using Also turning on all strict options and inheriting the base Couple of tips to whoever tackles this (happy to give it a go if that's nobody):
|
I started working on this today! branch: Don't hugely want to manually write them all out; there's a quite few cases to make sure we've covered correctly, plus we'd have to keep them in sync. @armano2 has been working on ways to auto generate it. We just need to decide which is the best way forward for that. |
Ah great I'll take a look through the branch. We should probably generate the types at build time like Babel does. They simply iterate through an array of node types and output a typescript file. I'd also recommend the strict settings in typescript so we maintain nice strong types (especially no implicit any). Also looking at your branch it would be a nicer structure I think if you remove |
A pr would be nice btw, as I have a few other suggestions (I know it's early stages 🙊) |
I was wondering people's thoughts of switching this repository over to using TypeScript. Personally I find it much easier to code using TypeScript, especially on an unfamiliar codebase. One of the nice things about developing rules on TSLint is that you can write rules in either TypeScript or JavaScript.
I was thus curious had we considered allowing people to write rules with TypeScript?
The text was updated successfully, but these errors were encountered: