eslint / eslint-transforms

Codemods for the ESLint ecosystem
Other
23 stars 8 forks source link

Chore: refactor so adding transforms is easier (fixes #9) #10

Closed pmcelhaney closed 2 years ago

pmcelhaney commented 6 years ago

To add a new transform:

  1. Create a directory under tests/fixtures/transforms
  2. Add the test fixtures (.input.js, .output.js, and *.md)
  3. Implement the transform in lib/transforms

There's no need to create new (Mocha) test file. At this point, documenting the transform is still manual, but it could be easily automated.

not-an-aardvark commented 6 years ago

Thanks for the PR!

I'm fine with refactoring this to make it easier to add new transforms. That said, I don't think we should add the transform from https://github.com/eslint/eslint/pull/9788 (I'm guessing that you're making this change based on the discussion in https://github.com/eslint/eslint/pull/9788, but please correct me if I'm wrong.) I don't think we should encourage plugins to generate a bunch of duplicate code when a simpler solution exists (dynamically adding a URL to the rules export).

pmcelhaney commented 6 years ago

Right, I'm not holding out hope that particular transform will be added.