eslint / eslint-transforms

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

Running `new-rule-format` results in `object-shorthand` lint error #8

Closed SaladFork closed 3 years ago

SaladFork commented 7 years ago

Though it is not (at the time of posting) a recommended rule, running the new-rule-format transform results in the output failing the object-shorthand rule.

That is,

  create: function (context) {

should be:

  create(context) {

One concern would be Node support for object shorthand, but it seems that all supported versions of Node should support it.

platinumazure commented 7 years ago

I believe object-shorthand is fixable, so it would be possible to run eslint --fix on the output file to get the desired result.

That said, I wonder if we should consider running eslint --fix, or advising the user to do so via console logging, after doing a transform?

@vitorbal Any thoughts on this?

SaladFork commented 7 years ago

I believe object-shorthand is fixable, so it would be possible to run eslint --fix on the output file to get the desired result.

Yup! I did this and it worked as expected.

That said, I wonder if we should consider running eslint --fix, or advising the user to do so via console logging, after doing a transform?

Seems like a good idea and would abate this issue.

vitorbal commented 7 years ago

I think running eslint --fix automatically would be a bit out of scope for this project. But I don't see any harm in adding a console log at the end advising the user to run eslint --fix themselves. 👍

edit: Thanks for the report, by the way, @SaladFork :)

nzakas commented 3 years ago

Closing due to age.