Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #990 — Bring linting up to date #991

Merged
merged 8 commits into from
Jan 24, 2019
Merged

Fixes #990 — Bring linting up to date #991

merged 8 commits into from
Jan 24, 2019

Conversation

wincent
Copy link
Contributor

@wincent wincent commented Jan 24, 2019

No description provided.

This takes us from 3.1.1 to 5.12.1.
To keep our practices in sync across the projects. Note that I am
keeping it as a JS file because I want Prettier to keep it well
formatted. (Prettier can also format JSON, but I don't think it knows
that ".eslintrc" is JSON unless you provide additional configuration.)
Because it is required by the config that we synched over from Clay.
Once I've actually fixed all the lints I will add the "lint" task to our
"prepublishOnly" task as well.
    [ESLINT_LEGACY_OBJECT_REST_SPREAD] DeprecationWarning: The
    'parserOptions.ecmaFeatures.experimentalObjectRestSpread' option
    is deprecated. Use 'parserOptions.ecmaVersion' instead. (found in
    ".eslintrc.js")

The Object Rest/Spread proposal:

    https://github.com/tc39/proposal-object-rest-spread

hit Stage 4 (ie. finished) in ES 2018:

    http://2ality.com/2017/02/ecmascript-2018.html

so swap out "ecmaFeatures.experimentalObjectRestSpread: true" for
"ecmaVersion: 2018" instead.
This turns off any ESLint rules that might conflict with Prettier
(things like indents, quotes etc).

With this plugin configured, you can (in theory*) run things one after
another without clobbering things:

```
npm run fix # fixes fixable lints, but not formatting issues
npm run format # fixes formatting issues
npm run fix # won't make any changes
```

(* Only in theory, because it looks like there are still a couple of
extra rules that I'll need to manually tweak.)
Note that despite the use of the eslint-config-prettier, the actual
sequence here is:

    npm run fix
    npm run format

Because while the config stops ESLint from complaining about things that
Prettier will take care of, ESLint isn't always capable of producing the
right indent from Prettier's point of view.

Before:

  ✖ 1480 problems (1480 errors, 0 warnings)

After:

  ✖ 704 problems (704 errors, 0 warnings)

I'll continue to look at the ones that can't be autofixed.
@wincent
Copy link
Contributor Author

wincent commented Jan 24, 2019

Also created #994 which is basically identical to this one but with two more commits applied on top (addressing the fact that we weren't linting/formatting JSX files — whoops!). I created a separate PR because I don't want to touch this one now that it is green.

@julien julien merged commit 4ab30b6 into liferay:2.x-develop Jan 24, 2019
@wincent wincent deleted the linting branch January 24, 2019 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants