Skip to content

Conversation

@atiratree
Copy link
Member

@atiratree atiratree commented Jun 27, 2019

Faster and easier linting for plugin development. Usage:

yarn lintme packages/kubevirt-plugin

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 27, 2019
@atiratree atiratree mentioned this pull request Jun 27, 2019
1 task
@spadgett spadgett added this to the v4.2 milestone Jun 27, 2019
@atiratree
Copy link
Member Author

/retest

@mareklibra
Copy link
Contributor

Isn't this over-complicated?
IIUC, we are trying to reuse previous lint rule from individual packages.
And the only thing preventing us from reusing the existing top-level lint script is the folder . specified there.
The simplest solution is to introduce a new generic rule without the the folder, so specialized rule can reuse it by calling it with one extra parameter (the folder). Sort of generic-lint rule or similar. This approach seems to me much more clear at the first glance, so without the need to dig into another .ts file to get understanding what the linter does.

Please note, there is already related PR: #1411

@christianvogt
Copy link
Contributor

Adding a new eslint script without a path would be very flexible and solve your use case:
` "eslint": "eslint --ext .js,.jsx,.ts,.tsx --color",

Then do:
yarn eslint packages/kubevirt

or be more specific to test a single file:
yarn eslint **/MyFile.tsx

@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 28, 2019
@atiratree
Copy link
Member Author

yes that is much easier (although without autocompletion)

  • added generic eslint script

@atiratree
Copy link
Member Author

/retest

2 similar comments
@atiratree
Copy link
Member Author

/retest

@atiratree
Copy link
Member Author

/retest

@atiratree
Copy link
Member Author

Tests passed. Can we proceed with this one?

@vojtechszocs
Copy link
Contributor

And the only thing preventing us from reusing the existing top-level lint script is the folder . specified there.

@mareklibra Right, that's the drawback of ESLint CLI when compared to Jest - ESLint requires an explicit path to work with, while Jest falls back to current work dir if the path isn't specified. In essence, this makes the reuse of ESLint scripts/commands harder.

Adding a new eslint script without a path would be very flexible and solve your use case:
"eslint": "eslint --ext .js,.jsx,.ts,.tsx --color",

LGTM, but note that this causes the project-specific eslint script to over-shadow the actual binary ./node_modules/.bin/eslint (shouldn't be a problem, though).

@vojtechszocs
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 2, 2019
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 3, 2019
@atiratree
Copy link
Member Author

LGTM, but note that this causes the project-specific eslint script to over-shadow the actual binary ./node_modules/.bin/eslint (shouldn't be a problem, though).

Renamed to lintme. Let me know if somebody comes up with a better name

@atiratree
Copy link
Member Author

/test e2e-aws

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to go with @christianvogt's suggestion:

Adding a new eslint script without a path would be very flexible and solve your use case:
"eslint": "eslint --ext .js,.jsx,.ts,.tsx --color",

Please replace lintme with eslint. All developers should use the same eslint script for unified experience.

The fact that eslint script in package.json over-shadows ./node_modules/.bin/eslint delegation (yarn run) is not a problem, so no need to come up with alternative script names like lintme.

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be yarn eslint .

@vojtechszocs
Copy link
Contributor

/assign

@atiratree
Copy link
Member Author

reverted back to eslint

@atiratree
Copy link
Member Author

/test e2e-aws-console-olm
/test e2e-aws-console

@vojtechszocs
Copy link
Contributor

/lgtm

cc @christianvogt

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 15, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: suomiy, vojtechszocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 15, 2019
@openshift-merge-robot openshift-merge-robot merged commit 691192f into openshift:master Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants