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

Upgrade eslint #9357

Merged
merged 12 commits into from
Dec 12, 2016
Merged

Upgrade eslint #9357

merged 12 commits into from
Dec 12, 2016

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Dec 2, 2016

A prereq for #8315

Upgrades eslint and @elastic/eslint-config-kibana to their latest versions.

Some of the new rules from @elastic/eslint-config-kibana had to be disabled and should be reenabled one-by-one as a part of #9355

As a part of this change gruntify-eslint was replaced with a custom grunt task. This was necessary because gruntify-eslint:

  • embeds its own version of eslint, rather than relying on a peerDependency
  • relies on grunt's file resolution algorithm rather than eslint's, which means it does not utilitze the .eslintignore file
  • does not support "fix" mode

Fixes #7622

@spalger spalger added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc review v5.2.0 v6.0.0 labels Dec 2, 2016
@spalger spalger force-pushed the upgrade/eslint-try2 branch from 733cc1b to 3c02df9 Compare December 2, 2016 23:42
@spalger spalger requested review from epixa and cjcenizal December 10, 2016 00:45
@cjcenizal
Copy link
Contributor

FYI this will also address #7622

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sweet overall. I had one question.

'!<%= src %>/core_plugins/timelion/vendor_components/**/*.js',
'!<%= src %>/fixtures/**/*.js',
'!<%= root %>/test/fixtures/scenarios/**/*.js'
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

...extraPaths
].map(path => resolve(path));

this.watcher = chokidar.watch(uniq(watchPaths), {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice attention to detail dude... I ❤️ it

if (report.warningCount > 0) errTypes.push('warning');
if (!errTypes.length) return;

grunt.log.write(formatter(report.results));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we get to this point if there are no errors? If there are no errors, do we still want to see the report results? Without knowing what the report contains, it seems like this could be useful information?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The report actually only contains errors and warnings, so if there are none of those then there isn't anything to report

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. How about renamingreport to errorReport or adding a comment to make that clearer? Otherwise I can see how someone might have the same question I had from reading this code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment describing what the report is. Since it contains errors, warnings, and fix info, errorReport didn't seem appropriate.

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweeeeeeet!

@epixa
Copy link
Contributor

epixa commented Dec 12, 2016

@spalger Can you update the PR description with an explanation of why the new task was necessary and such?

test/fixtures/scenarios
optimize
test/fixtures/scenarios
/src/ui/public/utils/decode_geo_hash.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this specific file excluded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's copied from an external source

@@ -165,17 +165,17 @@
"wreck": "6.2.0"
},
"devDependencies": {
"@elastic/eslint-config-kibana": "0.0.3",
"@elastic/eslint-config-kibana": "0.2.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once all of this eslint stuff is done, let's bump this to 1.0.0.

@@ -189,7 +189,6 @@
"grunt-karma": "2.0.0",
"grunt-run": "0.6.0",
"grunt-simple-mocha": "0.4.0",
"gruntify-eslint": "1.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@@ -24,7 +24,7 @@ export default class MockClusterFork extends EventEmitter {
dead = true;
this.emit('exit');
cluster.emit('exit', this, this.exitCode || 0);
}());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did this ever work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The babel parser missed the standard there apparently. it's valid for function expressions, just not arrow function expressions.

@@ -1,30 +1,33 @@
var resolve = require('path').resolve;
import { resolve } from 'path';
module.exports = grunt => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export default?

fix: false
};

module.exports = grunt => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export default?

Copy link
Contributor

@epixa epixa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments (mostly questions).

@spalger
Copy link
Contributor Author

spalger commented Dec 12, 2016

@epixa I believe that addresses your feedback

@epixa
Copy link
Contributor

epixa commented Dec 12, 2016

LGTM once the build is green

@spalger spalger merged commit 0c73672 into elastic:master Dec 12, 2016
elastic-jasper added a commit that referenced this pull request Dec 12, 2016
Backports PR #9357

**Commit 1:**
upgrade eslint, all related deps, and config files

* Original sha: 054e798
* Authored by spalger <email@spalger.com> on 2016-08-24T23:39:11Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:04:20Z

**Commit 2:**
replace gruntify-eslint with basic eslint-cli wrapper

* Original sha: 71732e7
* Authored by spalger <email@spalger.com> on 2016-09-02T21:33:02Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:41:36Z

**Commit 3:**
arrow-IIFEs must be invoked outside of the parens

* Original sha: b05662c
* Authored by spalger <email@spalger.com> on 2016-08-25T17:47:57Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:41:40Z

**Commit 4:**
move import statements before their use

* Original sha: 3572ab8
* Authored by spalger <email@spalger.com> on 2016-08-25T17:48:30Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:41:40Z

**Commit 5:**
reindent to satisfy new indentation check algorithm

* Original sha: b31dae1
* Authored by spalger <email@spalger.com> on 2016-08-25T17:49:47Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:41:58Z

**Commit 6:**
place missing semicolon

* Original sha: 7b39475
* Authored by spalger <email@spalger.com> on 2016-09-06T22:27:10Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:42:04Z

**Commit 7:**
ignore copy-pasted decode geohash code

* Original sha: 3c02df9
* Authored by spalger <email@spalger.com> on 2016-09-10T01:49:42Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:42:04Z

**Commit 8:**
Merge branch 'master' of github.com:elastic/kibana into upgrade/eslint-try2

* Original sha: 1224b18
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-10T04:14:32Z

**Commit 9:**
[grunt/eslint] fix argument spacing

* Original sha: 6fa2c6c
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-10T04:22:42Z

**Commit 10:**
[gurnt/eslint] add comment about contents of report

* Original sha: 71834ca
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-10T07:59:11Z

**Commit 11:**
Merge branch 'master' of github.com:elastic/kibana into upgrade/eslint-try2

* Original sha: 76e77a7
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-12T20:17:05Z

**Commit 12:**
[grunt/tasks] use `export default`

* Original sha: 803c0da
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-12T20:19:27Z
spalger pushed a commit that referenced this pull request Dec 12, 2016
Backports PR #9357

**Commit 1:**
upgrade eslint, all related deps, and config files

* Original sha: 054e798
* Authored by spalger <email@spalger.com> on 2016-08-24T23:39:11Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:04:20Z

**Commit 2:**
replace gruntify-eslint with basic eslint-cli wrapper

* Original sha: 71732e7
* Authored by spalger <email@spalger.com> on 2016-09-02T21:33:02Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:41:36Z

**Commit 3:**
arrow-IIFEs must be invoked outside of the parens

* Original sha: b05662c
* Authored by spalger <email@spalger.com> on 2016-08-25T17:47:57Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:41:40Z

**Commit 4:**
move import statements before their use

* Original sha: 3572ab8
* Authored by spalger <email@spalger.com> on 2016-08-25T17:48:30Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:41:40Z

**Commit 5:**
reindent to satisfy new indentation check algorithm

* Original sha: b31dae1
* Authored by spalger <email@spalger.com> on 2016-08-25T17:49:47Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:41:58Z

**Commit 6:**
place missing semicolon

* Original sha: 7b39475
* Authored by spalger <email@spalger.com> on 2016-09-06T22:27:10Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:42:04Z

**Commit 7:**
ignore copy-pasted decode geohash code

* Original sha: 3c02df9
* Authored by spalger <email@spalger.com> on 2016-09-10T01:49:42Z
* Committed by spalger <spalger@users.noreply.github.com> on 2016-12-02T23:42:04Z

**Commit 8:**
Merge branch 'master' of github.com:elastic/kibana into upgrade/eslint-try2

* Original sha: 1224b18
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-10T04:14:32Z

**Commit 9:**
[grunt/eslint] fix argument spacing

* Original sha: 6fa2c6c
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-10T04:22:42Z

**Commit 10:**
[gurnt/eslint] add comment about contents of report

* Original sha: 71834ca
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-10T07:59:11Z

**Commit 11:**
Merge branch 'master' of github.com:elastic/kibana into upgrade/eslint-try2

* Original sha: 76e77a7
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-12T20:17:05Z

**Commit 12:**
[grunt/tasks] use `export default`

* Original sha: 803c0da
* Authored by spalger <spalger@users.noreply.github.com> on 2016-12-12T20:19:27Z
@spalger spalger deleted the upgrade/eslint-try2 branch December 13, 2016 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v5.2.0 v6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.eslintignore file is superseded by "lintThese" config var in Gruntfile
3 participants