From 6f15039a6cab3ac565bf2528aa028265b5a6fa25 Mon Sep 17 00:00:00 2001 From: ljuba_ch Date: Tue, 22 Apr 2025 20:48:38 +0300 Subject: [PATCH 1/5] added sanity-check --- .github/workflows/sanity-check.yml | 22 ++++++++++++++++++++++ eslint.config.mjs | 1 + src/sum.test.js | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/sanity-check.yml diff --git a/.github/workflows/sanity-check.yml b/.github/workflows/sanity-check.yml new file mode 100644 index 0000000..1692694 --- /dev/null +++ b/.github/workflows/sanity-check.yml @@ -0,0 +1,22 @@ +name: PR Sanity Check + +on: pull_request + +jobs: + lint: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + user: actions/checkout@v4 + + - name: Install Packages + run: | + npm install + + - name: Lint check + run: | + npm run lint + + - name: Lint check + run: | + npm run test diff --git a/eslint.config.mjs b/eslint.config.mjs index b32b314..cd28111 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -14,6 +14,7 @@ export default defineConfig([ rules: { "prefer-const": "error", "no-unused-vars": "error", + "no-console": "error", "semi": "error", }, }, diff --git a/src/sum.test.js b/src/sum.test.js index 1d4044a..72f0f84 100644 --- a/src/sum.test.js +++ b/src/sum.test.js @@ -2,6 +2,6 @@ import { sum } from './sum'; describe('sum', () => { it('return sum of two numbers', () => { - expect(sum(2, 3)).toEqual(5); + expect(sum(2, 3)).toEqual(6); }); }); From 4532e24ce2b6d62e4495c3cdf427a36d84a54974 Mon Sep 17 00:00:00 2001 From: ljuba_ch Date: Tue, 22 Apr 2025 20:53:29 +0300 Subject: [PATCH 2/5] fix --- .github/workflows/sanity-check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sanity-check.yml b/.github/workflows/sanity-check.yml index 1692694..c38281b 100644 --- a/.github/workflows/sanity-check.yml +++ b/.github/workflows/sanity-check.yml @@ -1,13 +1,13 @@ name: PR Sanity Check -on: pull_request +on: jobs: lint: runs-on: ubuntu-20.04 steps: - name: Checkout - user: actions/checkout@v4 + uses: actions/checkout@v4 - name: Install Packages run: | From b9cdfeed0677f0d00ed05b4968396660d01b4c2d Mon Sep 17 00:00:00 2001 From: ljuba_ch Date: Thu, 24 Apr 2025 14:24:21 +0300 Subject: [PATCH 3/5] fix sanity-check --- .github/workflows/sanity-check.yml | 2 +- .prettierrc | 2 +- babel.config.js | 4 ++-- eslint.config.mjs | 8 +++----- package.json | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sanity-check.yml b/.github/workflows/sanity-check.yml index c38281b..bbe6de6 100644 --- a/.github/workflows/sanity-check.yml +++ b/.github/workflows/sanity-check.yml @@ -1,6 +1,6 @@ name: PR Sanity Check -on: +on: pull_request jobs: lint: diff --git a/.prettierrc b/.prettierrc index 4c179e3..1a20fe9 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,4 +2,4 @@ "semi": true, "singleQuote": true, "trailingComma": "all" -} \ No newline at end of file + } \ No newline at end of file diff --git a/babel.config.js b/babel.config.js index a90fb23..a1db3ce 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: [['@babel/preset-env', {targets: {node: 'current'}}]], - }; \ No newline at end of file + presets: [['@babel/preset-env', {targets: {node: 'current'}}]], +}; \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs index cd28111..6e8c818 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,7 +3,6 @@ import globals from "globals"; import { defineConfig } from "eslint/config"; import jest from "eslint-plugin-jest"; import eslintRecommended from "eslint-plugin-prettier/recommended"; -import plugin from "eslint-plugin-jest"; export default defineConfig([ @@ -12,10 +11,9 @@ export default defineConfig([ { files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: globals.browser } }, { rules: { - "prefer-const": "error", - "no-unused-vars": "error", - "no-console": "error", - "semi": "error", + "prefer-const": "error", + "no-unused-vars": "error", + "semi": "error", }, }, { diff --git a/package.json b/package.json index 5c23204..39c60da 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "url": "https://github.com/Chudofa-L/JavaScript--set-up-the-environment/issues" }, "homepage": "https://github.com/Chudofa-L/JavaScript--set-up-the-environment#readme", - "lint-staged": { + "lint-staged": { "src/**/*.js": "eslint" }, "devDependencies": { From 8de6bb076549b29a60d3821a684d889eda38d4d1 Mon Sep 17 00:00:00 2001 From: ljuba_ch Date: Thu, 24 Apr 2025 14:31:33 +0300 Subject: [PATCH 4/5] fix ubuntu --- .github/workflows/sanity-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sanity-check.yml b/.github/workflows/sanity-check.yml index bbe6de6..15b429f 100644 --- a/.github/workflows/sanity-check.yml +++ b/.github/workflows/sanity-check.yml @@ -4,7 +4,7 @@ on: pull_request jobs: lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 From 9c20f73b9b011a5546b64f3a91135efeb052c3e6 Mon Sep 17 00:00:00 2001 From: ljuba_ch Date: Thu, 24 Apr 2025 14:35:09 +0300 Subject: [PATCH 5/5] fix --- src/sum.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sum.test.js b/src/sum.test.js index 72f0f84..1d4044a 100644 --- a/src/sum.test.js +++ b/src/sum.test.js @@ -2,6 +2,6 @@ import { sum } from './sum'; describe('sum', () => { it('return sum of two numbers', () => { - expect(sum(2, 3)).toEqual(6); + expect(sum(2, 3)).toEqual(5); }); });