eslint / eslint-transforms

Codemods for the ESLint ecosystem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

SaladFork opened this issue · comments

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.

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?

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.

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 :)

Closing due to age.