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

[eslint] duplicate conditions in indices and nodes API #240

Closed
ananzh opened this issue May 20, 2022 · 3 comments
Closed

[eslint] duplicate conditions in indices and nodes API #240

ananzh opened this issue May 20, 2022 · 3 comments
Assignees
Labels
🐛 bug Something isn't working

Comments

@ananzh
Copy link
Member

ananzh commented May 20, 2022

What is the bug?
eslint shows two APIs have duplicate conditions.

yarn lint
yarn run v1.22.5
$ eslint .

/opensearch-js/api/api/indices.js
  1112:14  error  This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain  no-dupe-else-if
  1115:14  error  This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain  no-dupe-else-if
  1118:14  error  This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain  no-dupe-else-if
  1127:14  error  This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain  no-dupe-else-if

/opensearch-js/api/api/nodes.js
  169:14  error  This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain  no-dupe-else-if
  180:14  error  This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain  no-dupe-else-if
  183:14  error  This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain  no-dupe-else-if

✖ 7 problems (7 errors, 0 warnings)

How can one reproduce the bug?
After eslint PR is merged

  1. Go to '.eslintrc.json'
  2. Remove ' "no-dupe-else-if": "off"'
  3. Run yarn lint
  4. See error

What is the expected behavior?
Research on this
Remove duplicate conditions

@ananzh ananzh self-assigned this May 20, 2022
@ananzh ananzh changed the title [BUG] duplicate conditions in indices and nodes API [eslint] duplicate conditions in indices and nodes API May 20, 2022
@ananzh
Copy link
Member Author

ananzh commented May 20, 2022

duplication:

if ((node_id || nodeId) != null) {
if (method == null) method = 'GET'
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
} else if ((node_id || nodeId) != null) {
if (method == null) method = 'GET'
path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
} else if ((node_id || nodeId) != null) {
if (method == null) method = 'GET'
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
} else if ((node_id || nodeId) != null) {
if (method == null) method = 'GET'
path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
} else {
if (method == null) method = 'GET'
path = '/' + '_nodes' + '/' + 'hot_threads'
}

@frost017
Copy link

Good day @ananzh !
I want to let you know that I am working on this issue. Thank you for this opportunity!

@wbeckler wbeckler added the 🐛 bug Something isn't working label Oct 3, 2023
@nhtruong
Copy link
Collaborator

nhtruong commented Jan 9, 2025

Closing since this has been replaced by generated API functions.

@nhtruong nhtruong closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants