-
Notifications
You must be signed in to change notification settings - Fork 124
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
[CCI][#240][eslint] Fixed duplicate conditions in indices and nodes API #428
[CCI][#240][eslint] Fixed duplicate conditions in indices and nodes API #428
Conversation
…t in package.json Signed-off-by: Raiymbek Aiymbet <[email protected]> Signed-off-by: frost017 <[email protected]>
Signed-off-by: frost017 <[email protected]>
Signed-off-by: frost017 <[email protected]>
Signed-off-by: frost017 <[email protected]>
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!
I am concerned that no tests broke given what I think is a bug below. Can you please beef up the putMapping
tests to make sure we cover every path of the changed if
?
Delete commented out code, and any unrelated changes.
package.json
Outdated
"./": "./" | ||
"./*": "./", | ||
"./opensearch/*": "./lib/opensearch/*", | ||
"./lib/*": "./lib/*" |
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.
Are these changes related to this fix? Rebase your branch.
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.
Are these changes related to this fix? Rebase your branch.
No, they aren't. It was intended to fix deprecation mapping error when using NodeJS 16 and TypeScript #365. I am removing this fix for now, leaving it as it was previously.
package.json
Outdated
@@ -91,6 +93,7 @@ | |||
"xmlbuilder2": "^3.0.2" | |||
}, | |||
"dependencies": { | |||
"@types/react": "17.0.53", |
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 think you didn't want this change.
api/api/indices.js
Outdated
} | ||
|
||
path += '_mapping'; |
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 will make /_maping/_mapping
in the last else
case at least.
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.
/_mapping/_mapping
shouldn't be the case in any way, right?
Yes, of course, I will do my best to cover it with tests. The thing is that I am not yet familiar with the structure of unit tests in the project, so I may put |
Signed-off-by: frost017 <[email protected]>
Signed-off-by: frost017 <[email protected]>
Description
Summary about
indices.js
: This error is triggered when runningyarn lint
with next rule removed -"no-dupe-else-if": "off"
. Previously, there were else-if statements having the same condition, which means only one of them can be executed and others are ignored. These were removed because of duplication:The code above resulted in following:
FIX in
indices.js
: Removed duplicate conditions and made separateif
statement for each case. By doing this, path is picked correctly and cases are not ignored because of duplicate conditions.Summary about
nodes.js
: Same case as inindices.js
. It has duplicate conditions, all check same case. It means all four are executed, which makes three conditions to be ignored. These lines of code were removed:The code above resulted in following:
FIX in
nodes.js
: Removed those aforementioned four conditions, and put oneif-else
condition which checks ifnode_id
ornodeId
is notnull
.Issues Resolved
Following issue is resolved: #240
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.