Open zaicevas opened 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).
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?
Yes, I think we would need separate templates for each type of plugin we can generate:
plugin
(existing, CJS)plugin-esm
plugin-ts
rule
(existing, CJS)rule-esm
rule-ts
Imho, it would be really nice to provide TypeScript templates nowadays considering the popularity; but not sure if this goes against our policies.
@JoshuaKGoldberg @bradzacher is there a standard template for new TypeScript plugins/rules anywhere or could we put one together to use in this generator?
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 😄
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
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?