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

[OSCI][Enhancement] lint checker for github actions #932

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: ESLint Checker
on:
push:
branches: [main]
pull_request:
branches: [main]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may want to support 2.x branch also

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Hailong-am

Sure. Should I add this branch right now, or could it be a separate issue and a separate PR? Because once a branch is added, then ESLint errors in all files would need to be fixed, the test will always fail if this is not ensured.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may want to run lint check on changed/new files only.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we need this workflow, since it's already part of lint-stage which has to happen before commit. Unless someone disabled it in a PR, but reviewer should never let it happen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bowenlan-amzn

Should we just close this PR as a similar code exists?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can close this one


jobs:
lint-check:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2


# Enable longer filenames for windows
- name: Enable longer filenames
if: ${{ matrix.os == 'windows-latest' }}
run: git config --system core.longpaths true
- name: Checkout OpenSearch-Dashboards
uses: actions/checkout@v2
with:
repository: opensearch-project/OpenSearch-Dashboards
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
path: OpenSearch-Dashboards
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: "./OpenSearch-Dashboards/.nvmrc"
registry-url: "https://registry.npmjs.org"
- name: Install Yarn
# Need to use bash to avoid having a windows/linux specific step
shell: bash
run: |
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
echo "Installing yarn@$YARN_VERSION"
npm i -g yarn@$YARN_VERSION
- run: node -v
- run: yarn -v
- name: Checkout Index Management Dashboards plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin
- name: Bootstrap plugin/OpenSearch-Dashboards
run: |
cd OpenSearch-Dashboards/plugins/index-management-dashboards-plugin
yarn osd bootstrap

- name: Install Dependencies
run: yarn install

- name: Run ESLint
run: yarn eslint:run
working-directory: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"osd": "node ../../scripts/osd",
"opensearch": "node ../../scripts/opensearch",
"lint": "node ../../scripts/eslint . && node ../../scripts/stylelint",
"eslint:fix": "npx eslint '**/*.{ts,tsx}' --fix",
"eslint:run": "npx eslint '**/*.{ts,tsx}'",
"plugin-helpers": "node ../../scripts/plugin_helpers",
"test:jest": "../../node_modules/.bin/jest --config ./test/jest.config.js",
"build": "yarn plugin-helpers build",
Expand Down Expand Up @@ -73,4 +75,4 @@
"engines": {
"yarn": "^1.21.1"
}
}
}
Loading