eslint / generator-eslint

A Yeoman generator to help with ESLint development
Other
228 stars 51 forks source link

Add a Typescript variant #120

Open zaicevas opened 2 years ago

zaicevas commented 2 years ago

Some community ESLint plugins (e.g. https://github.com/testing-library/eslint-plugin-testing-library) use typescript. I think it'd be a great idea to have a typescript variant of the generated boilerplate. It'd be something similar to CRA: npx create-react-app my-app --template typescript.

I am not too familiar with yeoman, so I am not sure if it ought to be a different generator or some kind of a parameter could be passed. In any case, is that something that is of interest to others?

bmish commented 2 years ago

I do think it would be nice for us to support both ESM plugins and TypeScript plugins. The plugin generator could ask:

What type of plugin do you want to generate?
- CommonJS (default)
- ESM
- TypeScript

And then the rule generator would presumably detect what kind of plugin is present to generate the appropriate rule format.

But I think both of these new types depend on there existing a simple, single, standardized/recommended way of writing plugins in each of these manners. We need to find some good, minimal examples of plugins written with ESM and/or TypeScript to base these off of (let us know if you have some).

sam3k commented 1 year ago

Are we talking about this template in generator-eslint? If so, I wonder if it makes sense to just provide a TS template for plugins? What about rules?

bmish commented 1 year ago

Yes, I think we would need separate templates for each type of plugin we can generate:

sam3k commented 1 year ago

Imho, it would be really nice to provide TypeScript templates nowadays considering the popularity; but not sure if this goes against our policies.

bmish commented 1 year ago

@JoshuaKGoldberg @bradzacher is there a standard template for new TypeScript plugins/rules anywhere or could we put one together to use in this generator?

JoshuaKGoldberg commented 1 year ago

Not that I know of, but it'd be great to have one here! I'd be happy to help - lmk if you want a review or for me to just do it 😄

bradzacher commented 1 year ago

Nah a plugin template it's not something we've invested in just because it's not something people need too too much.

I don't think we've even really written docs about it? We have a little stuff that Josh has written here https://typescript-eslint.io/custom-rules