brenolf / polyjuice

A utility to convert JSHint and JSCS files into ESLint files and vice-versa
MIT License
275 stars 15 forks source link

switching from jshint+jscs to eslint #83

Closed markelog closed 8 years ago

markelog commented 8 years ago

Hi there.

Wanted to share my experience of switching jshint+jscs to eslint in jQuery -https://github.com/jquery/jquery/pull/3148, since there was couple weird things with it.

Here is a incomplete list of what i have notice -

Missing:

"semi-spacing": ["error", {"before": false, "after": true}]
"object-curly-spacing": [
    "error",
    "always"
]
"computed-property-spacing": [
    "error",
    "always"
]
"array-bracket-spacing": [
    "error",
    "always"
]
"no-loop-func": "error"

Incorrect

eqeqeq

should be:

"eqeqeq": [
    "error",
    "smart"
]

was:

"eqeqeq": "error"

max-len

should be:

"max-len": [
    "error",
    {
        "code": 100,
        "ignoreComments": true
    }
]

was:

"max-len": [
    "error",
    100
]

quotes

should be:

"quotes": [
    "error",
    "double"
]

was:

"quotes": [
    "error",
    "double",
    "avoid-escape"
]

Thank you

brenolf commented 8 years ago

I'll be fixing max-len soon. Nevertheless, I don't think the others you mentioned are errors.

As you can see here, JSHint always warns you to use === and !==, so there's no equivalent to smart in JSHint. Even though I see that it would be interesting, Polyjuice is aimed to be a 1-1 mapper.

About quotes, I suppose you had a JSCS rule like this:

"validateQuoteMarks": { "mark": "\"", "escape": true }

As their page mentions "escape: allow the "other" quote mark to be used, but only to avoid having to escape", which is the same as ESLint's avoid-escape. However, the way it's been transpiled is indeed incorrect, it should have been [2, "double", {"avoidEscape": true}].

brenolf commented 8 years ago

@markelog Also, regarding your missing rules: aren't they all ESLint rules? Are you trying to migrate from ESLint or from JSCS+JSHint?

brenolf commented 8 years ago

Closing due to inactivity