Skip to content

Commit

Permalink
add and apply prettier and eslint separately (opensearch-project#242)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
ananzh authored May 24, 2022
1 parent b4dd79a commit 9f137e9
Show file tree
Hide file tree
Showing 171 changed files with 33,246 additions and 24,229 deletions.
5 changes: 2 additions & 3 deletions .ci/opendistro/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'

services:

elasticsearch:
build:
context: .
Expand All @@ -13,5 +12,5 @@ services:
- discovery.type=single-node
- bootstrap.memory_lock=true
ports:
- "9200:9200"
user: elasticsearch
- '9200:9200'
user: elasticsearch
3 changes: 1 addition & 2 deletions .ci/opensearch/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'

services:

opensearch:
build:
context: .
Expand All @@ -13,5 +12,5 @@ services:
- discovery.type=single-node
- bootstrap.memory_lock=true
ports:
- "9200:9200"
- '9200:9200'
user: opensearch
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
coverage
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"node": true,
"es6": true
},
"extends": [
"eslint:recommended",
"prettier"
],
"parser": "babel-eslint",
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
/*temporarily turn off no-unused-vars, open an issue to track https://github.com/opensearch-project/opensearch-js/issues/241*/
"no-unused-vars": "off",
/*temporarily turn off no-dupe-else-if, open an issue to track https://github.com/opensearch-project/opensearch-js/issues/240*/
"no-dupe-else-if": "off"
}
}
8 changes: 5 additions & 3 deletions .github/ISSUE_TEMPLATE/BUG_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ A clear and concise description of the bug.

**How can one reproduce the bug?**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -20,9 +21,10 @@ Steps to reproduce the behavior:
A clear and concise description of what you expected to happen.

**What is your host/environment?**
- OS: [e.g. iOS]
- Version [e.g. 22]
- Plugins

- OS: [e.g. iOS]
- Version [e.g. 22]
- Plugins

**Do you have any screenshots?**
If applicable, add screenshots to help explain your problem.
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ title: '[FEATURE]'
labels: enhancement
assignees: ''
---

**Is your feature request related to a problem?**
A clear and concise description of what the problem is, e.g. _I'm always frustrated when [...]_

Expand All @@ -15,4 +16,4 @@ A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.

**Do you have any additional context?**
Add any other context or screenshots about the feature request here.
Add any other context or screenshots about the feature request here.
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/PROPOSAL_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ title: '[PROPOSAL]'
labels: proposal
assignees: ''
---

## What kind of business use case are you trying to solve? What are your requirements?

A clear and concise description of the business problem, e.g. _My customers are asking for [...]_

**What is the problem? What is preventing you from meeting the requirements?**
Expand All @@ -18,4 +20,4 @@ Describe your proposed solution. It's OK if you don't have one.
Describe any assumptions you may be making that would limit the scope of this proposal.

**What are remaining open questions?**
List questions that may need to be answered before proceeding with an implementation.
List questions that may need to be answered before proceeding with an implementation.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ contact_links:
about: Please ask and answer questions here.
- name: AWS/Amazon Security
url: https://aws.amazon.com/security/vulnerability-reporting/
about: Please report security vulnerabilities here.
about: Please report security vulnerabilities here.
11 changes: 7 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
### Description

[Describe what this change achieves]

### Issues Resolved

[List any issues this PR will resolve]

### 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
- [ ] 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](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).
For more information on following Developer Certificate of Origin and signing off your commits, please check [here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).
74 changes: 37 additions & 37 deletions .github/workflows/bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,42 @@ jobs:

strategy:
matrix:
cluster: ["opendistro", "opensearch"]
cluster: ['opendistro', 'opensearch']

steps:
- uses: actions/checkout@v2

- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Runs ${{ matrix.cluster }} cluster
run: |
make cluster.clean cluster.${{ matrix.cluster }}.build cluster.${{ matrix.cluster }}.start
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Install
run: |
npm install
npm install --prefix test/bundlers/parcel-test
npm install --prefix test/bundlers/rollup-test
npm install --prefix test/bundlers/webpack-test
- name: Build
run: |
npm run build --prefix test/bundlers/parcel-test
npm run build --prefix test/bundlers/rollup-test
npm run build --prefix test/bundlers/webpack-test
- name: Run bundle
run: |
npm start --prefix test/bundlers/parcel-test
npm start --prefix test/bundlers/rollup-test
npm start --prefix test/bundlers/webpack-test
- uses: actions/checkout@v2

- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Runs ${{ matrix.cluster }} cluster
run: |
make cluster.clean cluster.${{ matrix.cluster }}.build cluster.${{ matrix.cluster }}.start
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Install
run: |
npm install
npm install --prefix test/bundlers/parcel-test
npm install --prefix test/bundlers/rollup-test
npm install --prefix test/bundlers/webpack-test
- name: Build
run: |
npm run build --prefix test/bundlers/parcel-test
npm run build --prefix test/bundlers/rollup-test
npm run build --prefix test/bundlers/webpack-test
- name: Run bundle
run: |
npm start --prefix test/bundlers/parcel-test
npm start --prefix test/bundlers/rollup-test
npm start --prefix test/bundlers/webpack-test
76 changes: 38 additions & 38 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
secured: ["true", "false"]
secured: ['true', 'false']
entry:
- { opensearch_version: 1.1.0 }
- { opensearch_version: 1.2.0 }
Expand All @@ -20,40 +20,40 @@ jobs:
- { opensearch_version: 1.3.1 }

steps:
- uses: actions/checkout@v2

- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Runs OpenSearch cluster
run: |
export OPENSEARCH_VERSION=${{ matrix.entry.opensearch_version }}
export SECURE_INTEGRATION=${{ matrix.secured }}
make cluster.clean cluster.opensearch.build cluster.opensearch.start
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x

- name: Install
run: |
npm install
- name: Integration test without security
if: ${{ matrix.secured == 'false'}}
run: |
npm run test:integration:helpers
- name: Integration test with security
if: ${{ matrix.secured == 'true'}}
run: |
npm run test:integration:helpers-secure
- name: Stop the OpenSearch cluster
run: |
make cluster.opensearch.stop
- uses: actions/checkout@v2

- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Runs OpenSearch cluster
run: |
export OPENSEARCH_VERSION=${{ matrix.entry.opensearch_version }}
export SECURE_INTEGRATION=${{ matrix.secured }}
make cluster.clean cluster.opensearch.build cluster.opensearch.start
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x

- name: Install
run: |
npm install
- name: Integration test without security
if: ${{ matrix.secured == 'false'}}
run: |
npm run test:integration:helpers
- name: Integration test with security
if: ${{ matrix.secured == 'true'}}
run: |
npm run test:integration:helpers-secure
- name: Stop the OpenSearch cluster
run: |
make cluster.opensearch.stop
38 changes: 19 additions & 19 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ jobs:
node-version: [12.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install
run: |
npm install
- name: Code coverage report
run: |
npm run test:coverage-report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage.lcov
fail_ci_if_error: true
- name: Install
run: |
npm install
- name: Code coverage report
run: |
npm run test:coverage-report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage.lcov
fail_ci_if_error: true

- name: Code coverage 90%
run: |
npm run test:coverage-90
- name: Code coverage 90%
run: |
npm run test:coverage-90
6 changes: 3 additions & 3 deletions .github/workflows/delete_backport_branch.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Delete merged branch of the backport PRs
on:
on:
pull_request:
types:
- closed

jobs:
delete-branch:
runs-on: ubuntu-latest
Expand All @@ -12,4 +12,4 @@ jobs:
- name: Delete merged branch
uses: SvanBoxel/delete-merged-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 9f137e9

Please sign in to comment.