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

add eslint and prettier and apply #242

Merged
merged 2 commits into from
May 24, 2022
Merged

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented May 20, 2022

Description

  • add prettier and apply prettier
  • add eslint and its config; apply eslint
  • modify package.json script
  • turn off no-unused-vars and no-dupe-else-if. will fix them in separate PRs
  • modify workflow to run yarn lint for restricter format check
  • remove standard

Issue Resolved:

#243

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

@ananzh ananzh requested a review from a team as a code owner May 20, 2022 17:10
@ananzh
Copy link
Member Author

ananzh commented May 20, 2022

unit and integration:

yarn test:unit
yarn run v1.22.5
$ tap test/unit/{*,**/*}.test.js
 RUNS  test/unit/api.test.js 217ms
 RUNS  test/unit/api.test.js 265ms
 SKIP  test/unit/esm/index.test.js
 ~ Skip because Node version < 12.17.0

 RUNS  test/unit/api.test.js 365ms
 SKIP  test/unit/esm/index.test.js 1 skip of 1 3.425ms
 ~ Skip because Node version < 12.17.0

 PASS  test/unit/selectors.test.js 8 OK 9.563ms
 PASS  test/unit/cloud-connection-pool.test.js 4 OK 14.875ms
 PASS  test/unit/helpers/search.test.js 8 OK 25.07ms
 PASS  test/unit/events.test.js 19 OK 33.283ms
 PASS  test/unit/errors.test.js 36 OK 29.342ms
 PASS  test/unit/api.test.js 25 OK 73.62ms
 PASS  test/unit/serializer.test.js 19 OK 33.465ms
 PASS  test/unit/base-connection-pool.test.js 44 OK 88.767ms
 PASS  test/unit/connection-pool.test.js 89 OK 168.016ms
 PASS  test/unit/child.test.js 36 OK 151.196ms
test/unit/helpers/bulk.test.js 2> (node:358889) DeprecationWarning: strictEqual() is deprecated, use equal() instead
test/unit/helpers/bulk.test.js 2> (node:358889) DeprecationWarning: deepEqual() is deprecated, use same() instead
 PASS  test/unit/helpers/scroll.test.js 58 OK 189.959ms
 PASS  test/unit/helpers/bulk.test.js 291 OK 244.887ms
 PASS  test/unit/helpers/msearch.test.js 49 OK 567.967ms
 PASS  test/unit/connection.test.js 73 OK 3s
 PASS  test/unit/transport.test.js 202 OK 4s
 PASS  test/unit/client.test.js 116 OK 11s

                         
  🌈 SUMMARY RESULTS 🌈  
                         

 SKIP  test/unit/esm/index.test.js 1 skip of 1 3.425ms
 ~ Skip because Node version < 12.17.0

Suites:   17 passed, 17 of 17 completed
Asserts:  1077 passed, 1 skip, of 1078
Time:     12s
Done in 12.34s.


yarn test:integration:helpers
yarn run v1.22.5
$ tap test/integration/helpers/*.test.js
 PASS  test/integration/helpers/search.test.js 11 OK 2s
 PASS  test/integration/helpers/msearch.test.js 27 OK 6s
 PASS  test/integration/helpers/scroll.test.js 215 OK 6s
 PASS  test/integration/helpers/bulk.test.js 25 OK 8s

                         
  🌈 SUMMARY RESULTS 🌈  
                         

Suites:   4 passed, 4 of 4 completed
Asserts:  278 passed, of 278
Time:     8s
Done in 8.71s.

@ananzh
Copy link
Member Author

ananzh commented May 20, 2022

sanity test:

node data.js
Creating index:
{ acknowledged: true, shards_acknowledged: true, index: 'books' }
Cluster health:
{ cluster_name: 'runTask',
  status: 'yellow',
  timed_out: false,
  number_of_nodes: 1,
  number_of_data_nodes: 1,
  discovered_master: true,
  discovered_cluster_manager: true,
  active_primary_shards: 4,
  active_shards: 4,
  relocating_shards: 0,
  initializing_shards: 0,
  unassigned_shards: 12,
  delayed_unassigned_shards: 0,
  number_of_pending_tasks: 0,
  number_of_in_flight_fetch: 0,
  task_max_waiting_in_queue_millis: 0,
  active_shards_percent_as_number: 25 }
Cluster getSettings use master_timeout:
{ persistent: {}, transient: {} }
Cluster getSettings use cluster_manager_timeout:
{ persistent: {}, transient: {} }
Adding document:
{ _index: 'books',
  _id: '1',
  _version: 1,
  result: 'created',
  forced_refresh: true,
  _shards: { total: 4, successful: 1, failed: 0 },
  _seq_no: 0,
  _primary_term: 1 }
Search results:
{ total: { value: 1, relation: 'eq' },
  max_score: 0.5753642,
  hits:
   [ { _index: 'books',
       _id: '1',
       _score: 0.5753642,
       _source: [Object] } ] }
Deleting document:
{ _index: 'books',
  _id: '1',
  _version: 2,
  result: 'deleted',
  _shards: { total: 4, successful: 1, failed: 0 },
  _seq_no: 1,
  _primary_term: 1 }
Deleting index:
{ acknowledged: true }

@ananzh ananzh requested review from kavilla, tmarkley and boktorbb May 20, 2022 17:12
@ananzh ananzh force-pushed the format branch 2 times, most recently from 59133cd to 9ab3d03 Compare May 20, 2022 20:17
package.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
.github/workflows/nodejs.yml Show resolved Hide resolved
* add prettier and apply prettier
* add eslint and its config; apply eslint
* modify package.json script
* turn off no-unused-vars and no-dupe-else-if. will fix them
in separate PRs
* modify workflow to run yarn lint for restricter format check
* remove standard

Issue Resolved:
opensearch-project#243

Signed-off-by: Anan Zhuang <[email protected]>

remove yarn from devDependency and add it as engine

Signed-off-by: Ubuntu <[email protected]>

fix merge conflict

Signed-off-by: Anan Zhuang <[email protected]>
@ananzh ananzh merged commit 9f137e9 into opensearch-project:main May 24, 2022
@kavilla kavilla linked an issue May 26, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PROPOSAL] format opensearch-js code base via eslint+prettier
4 participants