Skip to content

Commit fe6e751

Browse files
committed
Add github workflows
- Remove unused things - Fix issue with knip - Update eslint flat config for compatibility with knip
1 parent ce6a2de commit fe6e751

File tree

29 files changed

+1072
-1402
lines changed

29 files changed

+1072
-1402
lines changed

eslint.config.js renamed to .eslintrc.cjs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
import { FlatCompat } from '@eslint/eslintrc';
2-
import js from '@eslint/js';
3-
import process from 'process';
4-
5-
const dirname = process.cwd();
6-
7-
const compat = new FlatCompat({
8-
baseDirectory: dirname,
9-
resolvePluginsRelativeTo: dirname,
10-
});
11-
12-
const appConfigs = compat.config({
1+
const config = {
132
env: {
143
node: true,
154
browser: true,
@@ -118,17 +107,6 @@ const appConfigs = compat.config({
118107
}
119108
}
120109
]
121-
}).map((conf) => ({
122-
...conf,
123-
files: ['src/**/*.tsx', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.js', 'generated/**/*.ts'],
124-
}));
125-
126-
const otherConfig = {
127-
files: ['*.js', '*.ts', '*.cjs'],
128-
...js.configs.recommended,
129110
};
130111

131-
export default [
132-
...appConfigs,
133-
otherConfig,
134-
];
112+
module.exports = config;

.github/workflows/ci.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Lint & Build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'develop'
8+
9+
env:
10+
APP_TITLE: ${{ vars.APP_TITLE }}
11+
APP_ENVIRONMENT: ${{ vars.APP_ENVIRONMENT }}
12+
APP_GRAPHQL_CODEGEN_ENDPOINT: ${{ vars.APP_GRAPHQL_CODEGEN_ENDPOINT }}
13+
APP_GRAPHQL_API_ENDPOINT: ${{ vars.APP_GRAPHQL_API_ENDPOINT }}
14+
APP_AUTH_URL: ${{ vars.APP_AUTH_URL }}
15+
APP_ADMIN_URL: ${{ vars.APP_ADMIN_URL }}
16+
APP_UMAMI_SRC: ${{ vars.APP_UMAMI_SRC }}
17+
APP_UMAMI_ID: ${{ vars.APP_UMAMI_ID }}
18+
GITHUB_WORKFLOW: true
19+
20+
jobs:
21+
unused:
22+
name: Find unused things
23+
environment: 'test'
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
submodules: true
29+
30+
- uses: pnpm/action-setup@v4
31+
name: Install pnpm
32+
with:
33+
version: 8.6.0
34+
run_install: false
35+
36+
- name: Install Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 20
40+
cache: 'pnpm'
41+
42+
- name: Install dependencies
43+
run: pnpm install
44+
45+
- name: Run knip
46+
run: pnpm lint:unused
47+
lint-js:
48+
name: Lint JS
49+
environment: 'test'
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
with:
54+
submodules: true
55+
56+
- uses: pnpm/action-setup@v4
57+
name: Install pnpm
58+
with:
59+
version: 8.6.0
60+
run_install: false
61+
62+
- name: Install Node.js
63+
uses: actions/setup-node@v4
64+
with:
65+
node-version: 20
66+
cache: 'pnpm'
67+
68+
- name: Install dependencies
69+
run: pnpm install
70+
71+
- name: Lint Javascript
72+
run: pnpm generate:type && pnpm lint:js
73+
css-lint:
74+
name: Lint CSS
75+
environment: 'test'
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: actions/checkout@v4
79+
80+
- uses: pnpm/action-setup@v4
81+
name: Install pnpm
82+
with:
83+
version: 8.6.0
84+
run_install: false
85+
86+
- name: Install Node.js
87+
uses: actions/setup-node@v4
88+
with:
89+
node-version: 20
90+
cache: 'pnpm'
91+
92+
- name: Install dependencies
93+
run: pnpm install
94+
95+
- name: Css Lint
96+
run: pnpm lint:css
97+
typecheck:
98+
name: Typecheck
99+
environment: 'test'
100+
runs-on: ubuntu-latest
101+
steps:
102+
- uses: actions/checkout@v4
103+
with:
104+
submodules: true
105+
106+
- uses: pnpm/action-setup@v4
107+
name: Install pnpm
108+
with:
109+
version: 8.6.0
110+
run_install: false
111+
112+
- name: Install Node.js
113+
uses: actions/setup-node@v4
114+
with:
115+
node-version: 20
116+
cache: 'pnpm'
117+
118+
- name: Install dependencies
119+
run: pnpm install
120+
121+
- name: Lint Javascript
122+
run: pnpm generate:type && pnpm typecheck
123+
build:
124+
name: Build
125+
environment: 'test'
126+
needs: [lint-js, css-lint, typecheck]
127+
runs-on: ubuntu-latest
128+
steps:
129+
- uses: actions/checkout@v4
130+
with:
131+
submodules: true
132+
133+
- uses: pnpm/action-setup@v4
134+
name: Install pnpm
135+
with:
136+
version: 8.6.0
137+
run_install: false
138+
139+
- name: Install Node.js
140+
uses: actions/setup-node@v4
141+
with:
142+
node-version: 20
143+
cache: 'pnpm'
144+
145+
- name: Install dependencies
146+
run: pnpm install
147+
148+
- name: Build
149+
run: pnpm generate:type && pnpm build

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ pnpm-debug.log*
1010
# Custom
1111
build/
1212
generated/
13+
coverage/
1314
stats.html
14-

codegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const config: CodegenConfig = {
99
ignoreNoDocuments: true, // for better experience with the watcher
1010
generates: {
1111
'./generated/types/': {
12-
preset: 'client'
12+
preset: 'client',
1313
}
1414
},
1515
config: {

knip.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
{
22
"$schema": "https://unpkg.com/knip@5/schema.json",
3-
"entry": ["src/index.tsx!"],
4-
"project": ["src/**/*.tsx!", "src/**/*.ts!"]
3+
"ignoreDependencies": [
4+
"virtual:pwa-info",
5+
"virtual:pwa-register"
6+
],
7+
"entry": [
8+
"src/**/*.test.ts",
9+
"src/**/*.test.tsx",
10+
"generated/**/*.ts",
11+
"src/index.tsx!"
12+
],
13+
"project": [
14+
"src/**/*.d.ts",
15+
"src/**/*.test.ts",
16+
"src/**/*.test.tsx",
17+
"src/**/*.tsx!",
18+
"src/**/*.ts!"
19+
]
520
}

package.json

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"build": "vite build",
99
"preview": "vite preview",
1010
"generate-and-watch:type": "graphql-codegen --require dotenv/config --config codegen.ts --watch",
11-
"generate:type": "graphql-codegen --require dotenv/config --config codegen.ts && eslint --fix generated/",
11+
"generate:type": "graphql-codegen --require dotenv/config --config codegen.ts",
1212
"typecheck": "tsc",
13+
"lint": "pnpm lint:js && pnpm lint:css",
14+
"lint:fix": "pnpm lint:js --fix && pnpm lint:css --fix",
1315
"lint:js": "eslint src",
1416
"lint:css": "stylelint \"./src/**/*.css\"",
15-
"lint": "yarn lint:js && yarn lint:css",
16-
"lint:unused": "knip",
17-
"lint:fix": "yarn lint:js --fix && yarn lint:css --fix",
17+
"lint:unused": "knip --tags=-knipignore",
1818
"test": "vitest",
1919
"test:coverage": "vitest run --coverage",
2020
"postinstall": "patch-package"
@@ -40,11 +40,8 @@
4040
"urql": "^4.1.0"
4141
},
4242
"devDependencies": {
43-
"@eslint/eslintrc": "^2.0.3",
4443
"@graphql-codegen/cli": "^5.0.2",
4544
"@graphql-codegen/client-preset": "^4.3.3",
46-
"@graphql-codegen/introspection": "^4.0.3",
47-
"@graphql-codegen/typescript-operations": "^4.2.3",
4845
"@graphql-typed-document-node/core": "^3.2.0",
4946
"@julr/vite-plugin-validate-env": "^1.0.1",
5047
"@types/node": "^20.11.6",
@@ -57,27 +54,26 @@
5754
"@vitejs/plugin-react-swc": "^3.5.0",
5855
"@vitest/coverage-v8": "^1.2.2",
5956
"autoprefixer": "^10.4.14",
60-
"core": "link:@types/dnd-kit/core",
57+
"dotenv": "^16.4.5",
6158
"eslint": "^8.40.0",
6259
"eslint-config-airbnb": "^19.0.4",
6360
"eslint-import-resolver-typescript": "^3.5.5",
6461
"eslint-plugin-import": "^2.27.5",
65-
"eslint-plugin-import-exports-imports-resolver": "^1.0.1",
6662
"eslint-plugin-import-newlines": "^1.3.4",
6763
"eslint-plugin-jsx-a11y": "^6.7.1",
6864
"eslint-plugin-react": "^7.32.2",
6965
"eslint-plugin-react-hooks": "^4.6.0",
7066
"eslint-plugin-react-refresh": "^0.3.4",
7167
"eslint-plugin-simple-import-sort": "^10.0.0",
72-
"knip": "^5.27.3",
68+
"graphql": "^16.9.0",
69+
"happy-dom": "^15.7.3",
70+
"knip": "^5.29.2",
7371
"patch-package": "^7.0.0",
7472
"postcss": "^8.3.0",
7573
"postcss-nested": "^6.0.1",
7674
"postcss-normalize": "^10.0.1",
7775
"postcss-preset-env": "^8.3.2",
78-
"postinstall-postinstall": "^2.1.0",
7976
"rollup-plugin-visualizer": "^5.9.0",
80-
"sortable": "link:@types/dnd-kit/sortable",
8177
"stylelint": "^16.7.0",
8278
"stylelint-config-concentric": "^2.0.2",
8379
"stylelint-config-recommended": "^14.0.1",

0 commit comments

Comments
 (0)