Skip to content

Commit 7aeeaf8

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 7aeeaf8

File tree

29 files changed

+1049
-1430
lines changed

29 files changed

+1049
-1430
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: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
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+
33+
- name: Install Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
cache: 'pnpm'
38+
39+
- name: Install dependencies
40+
run: pnpm install
41+
42+
- name: Run knip
43+
run: pnpm lint:unused
44+
lint-js:
45+
name: Lint JS
46+
environment: 'test'
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
submodules: true
52+
53+
- uses: pnpm/action-setup@v4
54+
name: Install pnpm
55+
56+
- name: Install Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: 20
60+
cache: 'pnpm'
61+
62+
- name: Install dependencies
63+
run: pnpm install
64+
65+
- name: Lint Javascript
66+
run: pnpm generate:type && pnpm lint:js
67+
css-lint:
68+
name: Lint CSS
69+
environment: 'test'
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v4
73+
74+
- uses: pnpm/action-setup@v4
75+
name: Install pnpm
76+
77+
- name: Install Node.js
78+
uses: actions/setup-node@v4
79+
with:
80+
node-version: 20
81+
cache: 'pnpm'
82+
83+
- name: Install dependencies
84+
run: pnpm install
85+
86+
- name: Css Lint
87+
run: pnpm lint:css
88+
typecheck:
89+
name: Typecheck
90+
environment: 'test'
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@v4
94+
with:
95+
submodules: true
96+
97+
- uses: pnpm/action-setup@v4
98+
name: Install pnpm
99+
100+
- name: Install Node.js
101+
uses: actions/setup-node@v4
102+
with:
103+
node-version: 20
104+
cache: 'pnpm'
105+
106+
- name: Install dependencies
107+
run: pnpm install
108+
109+
- name: Lint Javascript
110+
run: pnpm generate:type && pnpm typecheck
111+
build:
112+
name: Build
113+
environment: 'test'
114+
needs: [lint-js, css-lint, typecheck]
115+
runs-on: ubuntu-latest
116+
steps:
117+
- uses: actions/checkout@v4
118+
with:
119+
submodules: true
120+
121+
- uses: pnpm/action-setup@v4
122+
name: Install pnpm
123+
124+
- name: Install Node.js
125+
uses: actions/setup-node@v4
126+
with:
127+
node-version: 20
128+
cache: 'pnpm'
129+
130+
- name: Install dependencies
131+
run: pnpm install
132+
133+
- name: Build
134+
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)