Skip to content

Commit 850bf07

Browse files
guibrancodeepsource-autofix[bot]gstraccini[bot]
authored
Update workflows (#431)
* Update build.yml * Update package.json * Update build.yml * Create validate.yml * Update build.yml * Update validate.yml * Update deploy.yml * Add eslint-plugin-react * style: format code with Prettier This commit fixes the style issues introduced in a85398e according to the output from Prettier. Details: #431 * Fix settings * style: format code with Prettier This commit fixes the style issues introduced in 47fbba2 according to the output from Prettier. Details: #431 * Fix issues * Restore config * style: format code with Prettier This commit fixes the style issues introduced in 3dbfd51 according to the output from Prettier. Details: #431 * Add baseline-browser-mapping * Fix ESlint * style: format code with Prettier This commit fixes the style issues introduced in 0ab08f9 according to the output from Prettier. Details: #431 * Fix eslint problems * style: format code with Prettier This commit fixes the style issues introduced in be25b73 according to the output from Prettier. Details: #431 * Fix ESLint errors and warnings * style: format code with Prettier This commit fixes the style issues introduced in ccfa622 according to the output from Prettier. Details: #431 --------- Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> Co-authored-by: gstraccini[bot] <150967461+gstraccini[bot]@users.noreply.github.com>
1 parent 7042c19 commit 850bf07

28 files changed

Lines changed: 2283 additions & 226 deletions

.github/workflows/build.yml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,5 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
12-
build:
13-
name: Build and Test
14-
runs-on: ubuntu-latest
15-
16-
steps:
17-
- name: Checkout repository
18-
uses: actions/checkout@v6
19-
with:
20-
fetch-depth: 0
21-
22-
- name: Set up Node.js
23-
uses: actions/setup-node@v6
24-
with:
25-
node-version: 22
26-
cache: "npm"
27-
28-
- name: Install dependencies
29-
run: npm ci
30-
31-
- name: Build
32-
run: npm run build
33-
34-
# - name: Test
35-
# run: npm test
36-
37-
12+
validate:
13+
uses: ./.github/workflows/validate.yml

.github/workflows/deploy.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77

88
concurrency:
9-
group: 'pages'
9+
group: pages
1010
cancel-in-progress: true
1111

1212
permissions:
@@ -15,8 +15,12 @@ permissions:
1515
id-token: write
1616

1717
jobs:
18+
validate:
19+
uses: ./.github/workflows/validate.yml
20+
1821
build:
1922
name: Build
23+
needs: validate
2024
runs-on: ubuntu-latest
2125
outputs:
2226
fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}
@@ -30,42 +34,32 @@ jobs:
3034
- name: Install GitVersion
3135
uses: gittools/actions/gitversion/setup@v4.5.0
3236
with:
33-
versionSpec: "6.x"
37+
versionSpec: 6.x
3438

3539
- name: Determine Version
3640
id: gitversion
3741
uses: gittools/actions/gitversion/execute@v4.5.0
3842
with:
3943
useConfigFile: true
4044

41-
- name: Set up Node.js
45+
- name: Setup Node.js
4246
uses: actions/setup-node@v6
4347
with:
4448
node-version: 22
45-
cache: "npm"
49+
cache: npm
4650

4751
- name: Install dependencies
4852
run: npm ci
4953

5054
- name: Build
51-
run: npm run build
55+
run: CI=true npm run build
5256

5357
- name: Upload build artifacts
5458
uses: actions/upload-artifact@v7
5559
with:
5660
name: build-output
5761
path: dist/
5862

59-
# - name: Test
60-
# run: npm test
61-
62-
# - name: Upload test results
63-
# if: always()
64-
# uses: actions/upload-artifact@v7
65-
# with:
66-
# name: test-results
67-
# path: test-results.json
68-
6963
deploy:
7064
name: Deploy GH Pages
7165
needs: build
@@ -77,18 +71,18 @@ jobs:
7771
with:
7872
name: build-output
7973
path: ./dist
80-
74+
8175
- name: Setup Pages
8276
uses: actions/configure-pages@v6
83-
77+
8478
- name: Upload artifact
8579
uses: actions/upload-pages-artifact@v4
8680
with:
87-
path: './dist'
88-
81+
path: ./dist
82+
8983
- name: Deploy to GitHub Pages
9084
uses: actions/deploy-pages@v5
91-
85+
9286
create_release:
9387
name: Create release
9488
needs: [build, deploy]

.github/workflows/validate.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Validate project
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
validate:
8+
name: Validate
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v6
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v6
19+
with:
20+
node-version: 22
21+
cache: npm
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Type check
27+
run: npm run typecheck
28+
29+
- name: Lint
30+
run: npm run lint
31+
32+
- name: Build
33+
run: CI=true npm run build
34+
35+
# optional
36+
# - name: Test
37+
# run: npm test
38+
39+
# - name: Upload test results
40+
# if: always()
41+
# uses: actions/upload-artifact@v7
42+
# with:
43+
# name: test-results
44+
# path: test-results.json

eslint.config.js

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,81 @@
11
import js from "@eslint/js";
22
import globals from "globals";
3+
import react from "eslint-plugin-react";
34
import reactHooks from "eslint-plugin-react-hooks";
45
import reactRefresh from "eslint-plugin-react-refresh";
5-
import tseslint from "typescript-eslint";
6+
import tsPlugin from "@typescript-eslint/eslint-plugin";
7+
import tsParser from "@typescript-eslint/parser";
68

7-
export default tseslint.config(
8-
{ ignores: ["dist"] },
9+
export default [
910
{
10-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
1111
files: ["**/*.{ts,tsx}"],
12+
ignores: ["dist"],
13+
languageOptions: {
14+
parser: tsParser,
15+
parserOptions: {
16+
ecmaVersion: 2020,
17+
sourceType: "module",
18+
ecmaFeatures: {
19+
jsx: true,
20+
},
21+
},
22+
globals: globals.browser,
23+
},
24+
plugins: {
25+
react,
26+
"react-hooks": reactHooks,
27+
"react-refresh": reactRefresh,
28+
"@typescript-eslint": tsPlugin,
29+
},
30+
rules: {
31+
...js.configs.recommended.rules,
32+
...tsPlugin.configs.recommended.rules,
33+
...reactHooks.configs.recommended.rules,
34+
35+
// Catch missing JSX imports
36+
"react/jsx-no-undef": "error",
37+
38+
// React Refresh
39+
"react-refresh/only-export-components": [
40+
"warn",
41+
{ allowConstantExport: true },
42+
],
43+
44+
// Optional TypeScript stricter rules
45+
"@typescript-eslint/explicit-function-return-type": "warn",
46+
"@typescript-eslint/no-unused-vars": [
47+
"error",
48+
{ argsIgnorePattern: "^_" },
49+
],
50+
},
51+
settings: {
52+
react: {
53+
version: "detect",
54+
},
55+
},
56+
},
57+
{
58+
files: ["**/*.{js,jsx}"],
1259
languageOptions: {
1360
ecmaVersion: 2020,
61+
sourceType: "module",
1462
globals: globals.browser,
63+
parserOptions: { ecmaFeatures: { jsx: true } },
1564
},
1665
plugins: {
66+
react,
1767
"react-hooks": reactHooks,
1868
"react-refresh": reactRefresh,
1969
},
2070
rules: {
71+
...js.configs.recommended.rules,
2172
...reactHooks.configs.recommended.rules,
73+
"react/jsx-no-undef": "error",
2274
"react-refresh/only-export-components": [
2375
"warn",
2476
{ allowConstantExport: true },
2577
],
2678
},
79+
settings: { react: { version: "detect" } },
2780
},
28-
);
81+
];

0 commit comments

Comments
 (0)