-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[eslint] enable no undef #10825
[eslint] enable no undef #10825
Conversation
ed1bceb
to
2dd2761
Compare
src/cli/cluster/cluster_manager.js
Outdated
@@ -83,8 +80,8 @@ module.exports = class ClusterManager { | |||
} | |||
|
|||
setupWatching(extraPaths) { | |||
const chokidar = require('chokidar'); | |||
const fromRoot = require('../../utils/from_root'); | |||
const chokidar = require('chokidar'); // kibana-jscodeshift-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// kibana-jscodeshift-ignore
What is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a signal to the jscodeshift transforms that the require statement on that line needs to stay on that line, I planned to remove them before submitting the pr
|
||
function fixture(name) { | ||
return resolve(__dirname, 'fixtures', name); | ||
} | ||
|
||
describe('cli/serve/read_yaml_config', function () { | ||
it('reads a single config file', function () { | ||
const config = readYamlConfig(fixture('one.yml')); | ||
readYamlConfig(fixture('one.yml')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this call anymore? Are there other places where we have situations like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like it
@@ -33,7 +33,7 @@ describe(`Server logging configuration`, function () { | |||
|
|||
let asserted = false; | |||
let json = Infinity; | |||
const conf = setLoggingJson(true); | |||
setLoggingJson(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this call anymore? What is this doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is writing a config file that is then read by the server on startup.
src/cli/cluster/cluster_manager.js
Outdated
@@ -83,8 +80,8 @@ module.exports = class ClusterManager { | |||
} | |||
|
|||
setupWatching(extraPaths) { | |||
const chokidar = require('chokidar'); | |||
const fromRoot = require('../../utils/from_root'); | |||
const chokidar = require('chokidar'); // kibana-jscodeshift-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's kibana-jscodeshift-ignore
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ignore require
-> import
?
@@ -17,7 +17,7 @@ async function listPackages(settings) { | |||
.map(file => file.replace(/\\/g, '/')) | |||
.map(file => file.match(regExp)) | |||
.compact() | |||
.map(([ file, _, folder ]) => ({ file, folder })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing that eslint complains about. If we really don't like this style I think we should just stop destructuring the arg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, true. I'll live with it. It's just JS being weird.
@@ -37,13 +37,13 @@ function UrlParams(description, defaults) { | |||
description = _.clone(description || {}); | |||
_.defaults(description, defaults); | |||
_.each(description, function (p_description, param) { | |||
var values, component; | |||
var component; | |||
component = new ParamComponent(param, this.rootComponent, p_description); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: could be changed to const component = new ParamComponent(...)
now
@@ -10,7 +9,7 @@ var HighlightRules = require("./output_highlight_rules").OutputJsonHighlightRule | |||
var MatchingBraceOutdent = ace.require("ace/mode/matching_brace_outdent").MatchingBraceOutdent; | |||
var CstyleBehaviour = ace.require("ace/mode/behaviour/cstyle").CstyleBehaviour; | |||
var CStyleFoldMode = ace.require("ace/mode/folding/cstyle").FoldMode; | |||
var WorkerClient = ace.require("ace/worker/worker_client").WorkerClient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This require has side-effects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, playing it safe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -2,10 +2,8 @@ require('ace'); | |||
|
|||
const module = require('ui/modules').get('app/sense'); | |||
|
|||
module.run(function (Private, $rootScope) { | |||
module.setupResizeCheckerForRootEditors = ($el, ...editors) => { | |||
// mock the resize checker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe keep the comment? (can put it above instead of within)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
const { series, markings } = newProps; | ||
const { | ||
series | ||
} = newProps; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: styling
@@ -68,7 +68,7 @@ class Timeseries extends Component { | |||
if (row.data[i] && pos.x < row.data[i][0]) break; | |||
} | |||
if (!row.data[closest]) return values[row.id] = null; | |||
const [ time, value ] = row.data[closest]; | |||
const [ , value ] = row.data[closest]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I think this is actually legal, but for clarity we probably want to keep time
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint complains, and I think that's the right thing to do unless we want to pick a variable pattern we can use for unused placeholders (something we can tell eslint to ignore, like unused{N}
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should just be const value = row.data[closest][1]
? I just found this a bit "confusing" (as in: I wasn't sure whether or not it was actually legal, which I find to be a bad sign)
(However: I'm absolutely okey with keeping it, I think enabling this rule in eslint is much more important than discussing this case)
@@ -23,7 +22,6 @@ module.exports = function (directory) { | |||
}) | |||
.map(function (file) { | |||
const parts = file.split('/'); | |||
const name = parts[parts.length - 2]; | |||
return getTuple(directory, parts[parts.length - 2]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe getTuple(directory, name)
instead of removing name
?
@@ -25,14 +22,12 @@ const init = function () { | |||
// Load the application | |||
ngMock.module('kibana'); | |||
|
|||
ngMock.module('kibana', function ($provide) { | |||
ngMock.module('kibana', function () { | |||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed anymore?
@@ -44,8 +44,7 @@ export default class DashboardPage { | |||
await PageObjects.common.try(async () => { | |||
const goToDashboardLink = await PageObjects.common.findByCssSelector('a[href="#/dashboard"]'); | |||
await goToDashboardLink.click(); | |||
// Once the searchFilter can be found, we know the page finished loading. | |||
const searchFilter = await PageObjects.common.findTestSubject('searchFilter'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the comment?
@w33ble @kjbekkelund pushed updates to address feedback if you would like to take another look |
} = props; | ||
|
||
const aggs = model.metrics.map(createAggRowRender(props)); | ||
|
||
let caretClassName = 'fa fa-caret-down'; | ||
if (!visible) caretClassName = 'fa fa-caret-right'; | ||
!visible; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now commenting on the correct line 🙈 This one is weird ^
@@ -64,7 +64,8 @@ uiModules.get('apps/management') | |||
}); | |||
|
|||
$scope.$watchCollection('indexPattern.fields', function () { | |||
$scope.indexPattern.fields.filter(() => { type: 'conflict'; }); | |||
$scope.conflictFields = $scope.indexPattern.fields | |||
.filter(field => field.type === 'conflict'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @spalger!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see this looks great now.
Can we do this change to 5.x as well? @jgowdyelastic Would this be a problem for ML? I think this is already happening on x-pack-kibana, but I figured I'd confirm anyway. |
Hm, I'm not sure how this passed, I am getting build failures on a PR for code I didn't touch: e.g. this file still seems to have issues: @spalger the rule doesn't seem to pick up when a component is used in inlined html. e.g.:
the |
* [codeshift] add proper ignore comments * use more descriptive file ignore pattern * [codeshift] apply require-to-import transform * [codeshift/fixup] remove duplicate imports * [eslint] upgrade config for react "unused" support (cherry picked from commit aa2bb17) * [eslint] remove no-unused-vars override * [eslint] remove no-unused-vars override * add eslint-plugin-react peerDependency * [codeshift] apply remove-unused-basic-requires transform * [codeshift] apply remove-unused-function-arguments transform * [lintroller] fix argument list spacing * [codeshift] apply remove-unused-basic-vars transform * [codeshift/fixup] fixup unused basic var removals * manually apply remove-unused-assignments transform * [codeshift] reapply remove-unused-imports transform * [codeshift] reapply remove-unused-function-arguments transform * [resizeChecker] remove assignment to unused var * [eslint] autofix param spacing * manually fix remaining no-undef errors * replace values that looked unused in tests * remove // kibana-jscodeshift-no-babel comment * remove import statements from code required by api tests * Remove '// kibana-jscodeshift-ignore' comments * address review feedback * remove remnant of removed if condition * [console] use * import for settings
Re-enabled the
no-undef
eslint rule and fixed all the violation using a mixture of jscodeshift transforms and manual adjustments.