From 56d44a043e56732fb2b0533312ca60cae3efe144 Mon Sep 17 00:00:00 2001 From: Tharun T Date: Tue, 23 Jul 2024 21:08:09 +0530 Subject: [PATCH 1/2] fix: separate eslint check Signed-off-by: Tharun T --- .github/workflows/build-and-preview-site.yml | 3 --- .github/workflows/checks.yml | 25 ++++++++++++++++++++ CONTRIBUTING.md | 12 ++++++++++ Makefile | 6 ++++- 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/checks.yml diff --git a/.github/workflows/build-and-preview-site.yml b/.github/workflows/build-and-preview-site.yml index 765a02d06a23..a1ba8eaf7f4b 100644 --- a/.github/workflows/build-and-preview-site.yml +++ b/.github/workflows/build-and-preview-site.yml @@ -20,9 +20,6 @@ jobs: npm install npm run noIndex - - name: Run Eslint - run: npm run checklint - - name: Zip Site run: bash ./script.sh diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 000000000000..ff9913a19db4 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,25 @@ +name: Checks +on: + pull_request: + branches: [ master ] + types: [opened, synchronize, reopened] + + +jobs: + checks: + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@master + with: + persist-credentials: false + fetch-depth: 1 + + - name: NPM Install + run: npm install + + - name: Build + run: npm run build + + - name: Run Eslint + run: npm run checklint diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 96f3a58c74b3..50c584d46295 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -558,6 +558,18 @@ git push -u origin **15.** Once you’ve committed and pushed all of your changes to GitHub, go to the page for your fork on GitHub, select your development branch, and click the pull request button. Please ensure that you compare your feature branch to the desired branch of the repo you are supposed to make a PR to. If you need to make any adjustments to your pull request, just push the updates to GitHub. Your pull request will automatically track the changes in your development branch and update it. +### Lint Rules + +Layer5 uses ESLint to maintain code quality and consistency in our UI code. Use this command to trigger a lint check: + +```sh +make lint +``` + +> Note: +> - Eslint in Gatsby requires generating config files from CLI. Run `gatsby build` or `gatsby develop` if you face this error during linting. + + ## Signing-off on Commits To contribute to this project, you must agree to the **Developer Certificate of diff --git a/Makefile b/Makefile index 78c65c399da0..9dbf266c3c6e 100644 --- a/Makefile +++ b/Makefile @@ -37,4 +37,8 @@ build: clean: gatsby clean && make site -.PHONY: setup build site clean site-fast \ No newline at end of file +## Run Eslint on your local machine. +lint: + npm run lint + +.PHONY: setup build site clean site-fast lint From c6f8e927267d05bb155b82f81e1150466fea1b50 Mon Sep 17 00:00:00 2001 From: Tharun T Date: Tue, 23 Jul 2024 21:33:42 +0530 Subject: [PATCH 2/2] fix: eslint err introduced in #5681 Signed-off-by: Tharun T --- src/sections/Projects/Sistent/components/button/code-block.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sections/Projects/Sistent/components/button/code-block.js b/src/sections/Projects/Sistent/components/button/code-block.js index e3831a70b6b0..b3e4945c40e5 100644 --- a/src/sections/Projects/Sistent/components/button/code-block.js +++ b/src/sections/Projects/Sistent/components/button/code-block.js @@ -11,7 +11,7 @@ export const CodeBlock = ({ name, code }) => { - {showCode && ( + {showCode && ( )}