GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — tools: auto fix custom eslint rule for lowercase-name-for-primitive.js by shobhitchittora · Pull Request #17715 · nodejs/node Conversation
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hey @apapirovski @BridgeAR . |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
8654800 to
594ae58
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please remove the console.log()
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yeah forgot it was there! Removed 👍🏻.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
594ae58 to
ece39e7
Compare
|
Do we usually have tests for fixer functions? /cc @not-an-aardvark |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Trott not afaik. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@shobhitchittora Looks good to me. Thanks for the pull request! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1. Fixer for lowercase-name-for-primitive.js 2. Modified the node passed to fix it. Refs : nodejs#16636
ece39e7 to
a389548
Compare
There was an error while loading. Please reload this page.
|
Hi @shobhitchittora ! Thank you for working on this! Could you expand the test in Here is an example to see how it works: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Happy to approve again after @strakwang's requested test is implemented.
1. Extends test cases with output scenarios. Refs : nodejs#16636
|
@starkwang Thanks for the heads up. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Seems good but a bit of clean up would be nice.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| names.elements.forEach((name) => { | ||
| checkName(node, name.value); | ||
| names.elements.forEach((name, index) => { | ||
| checkName(names.elements[index], name.value); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this just be name instead of names.elements[index]? Pretty sure we can also get rid of the second argument here and above.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -36,8 +36,18 @@ module.exports = function(context) { | |||
| const lowercaseName = name.toLowerCase(); | |||
| if (primitives.includes(lowercaseName) && !primitives.includes(name)) { | |||
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
name could just be replaced with node.value now.
Also, pretty sure !primitives.includes(name) could be simplified to name !== lowercaseName (and it could be put as the first condition so the includes only runs if necessary).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Made the changes.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI: https://ci.nodejs.org/job/node-test-pull-request-lite/31/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1. Changes as per review comments. Refs : nodejs#16636
|
CI to merge: https://ci.nodejs.org/job/node-test-pull-request-lite/42/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| code: 'new errors.TypeError("ERR_INVALID_ARG_TYPE", "a", "Number")', | ||
| errors: [{ message: 'primitive should use lowercase: Number' }] | ||
| errors: [{ message: 'primitive should use lowercase: Number' }], | ||
| output: 'new errors.TypeError("ERR_INVALID_ARG_TYPE", "a", "number")' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
CI failed due to a small problem:
The input code and expected output are using double quotes ", but the autofixer will change it to single quotes, which makes the actual output cannot match the expected output.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@shobhitchittora Could you change these double quotes in code and output to using single quotes?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@starkwang pushed a fix. How did you check the problem in Jenkins that the output is not correct?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I modified some codes in eslint (eslint/lib/testers/rule-tester.js) to expose the error message.
You can see eslint/eslint#9769 for more detail. 😉
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I also send a PR to eslint for more detailed assert message: eslint/eslint#9769 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1. Fixed test with proper quotes. Refs : nodejs#16636
|
New CI: https://ci.nodejs.org/job/node-test-pull-request-lite/44/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The CI failed again: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| code: 'new errors.TypeError("ERR_INVALID_ARG_TYPE", "a", "Number")', | ||
| errors: [{ message: 'primitive should use lowercase: Number' }] | ||
| code: `new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', | ||
| 'Number')`, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@shobhitchittora Could you change these backquote to singlequote? For example:
{ code: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' + '\'Number\'' }
In addition, you can use this command to check if your change will pass CI:
node test/parallel/test-eslint-lowercase-name-for-primitive.js
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done and started a build.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1. Removes template string 2. Uses escaped quote. Refs : nodejs#16636
|
CI: https://ci.nodejs.org/job/node-test-pull-request-lite/47/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in 639770c 💯 🥇 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
PR-URL: #17715 Refs: #16636 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.