Skip to content

Commit fec6c72

Browse files
committed
Resolve conflicts
2 parents b9c9959 + b30eeb1 commit fec6c72

24 files changed

+14007
-1301
lines changed

.github/workflows/pipeline.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
push:
3+
4+
env:
5+
NODE_VERSION: 20
6+
7+
jobs:
8+
unit-test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # for SonarQube
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ env.NODE_VERSION }}
20+
21+
- name: Cache NPM dependencies
22+
uses: actions/cache@v4
23+
with:
24+
path: "./node_modules"
25+
key: ${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
26+
27+
- run: npm ci
28+
- run: npx playwright install chromium
29+
- run: npm run pipeline
30+
env:
31+
STORYBOOK_DISABLE_TELEMETRY: 1
32+
33+
- name: SonarQube Cloud Scan
34+
uses: SonarSource/sonarcloud-github-action@master
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for PR metadata
37+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pnpm-debug.log*
88
lerna-debug.log*
99

1010
node_modules
11+
coverage
1112
dist
1213
dist-ssr
1314
*.local
@@ -22,3 +23,7 @@ dist-ssr
2223
*.njsproj
2324
*.sln
2425
*.sw?
26+
27+
# Storybook
28+
storybook-static
29+
*storybook.log

.prettierrc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"trailingComma": "all",
3+
"singleQuote": false
4+
}

.storybook/main.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { mergeConfig } from "vite";
2+
3+
/**
4+
* @type {import('@storybook/react-vite').StorybookConfig}
5+
*/
6+
const config = {
7+
stories: [
8+
"../src/**/*.mdx",
9+
"../src/**/*.stories.ts",
10+
"../src/**/*.stories.tsx",
11+
],
12+
addons: [
13+
"@storybook/addon-essentials",
14+
"@storybook/addon-interactions",
15+
"@storybook/addon-links",
16+
],
17+
framework: {
18+
name: "@storybook/react-vite",
19+
options: {},
20+
},
21+
docs: {
22+
autodocs: true,
23+
},
24+
viteFinal: async (config) => {
25+
const { default: istanbul } = await import("vite-plugin-istanbul");
26+
return mergeConfig(config, {
27+
build: { sourcemap: true },
28+
plugins: [
29+
istanbul({
30+
// coverage: pure components only
31+
include: "src/components/**",
32+
exclude: [
33+
// sonar.test.inclusions should include these files
34+
"**/*.stories.ts",
35+
"**/*.stories.tsx",
36+
],
37+
}),
38+
],
39+
});
40+
},
41+
};
42+
export default config;

.storybook/preview.jsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from "react";
2+
3+
import { AppProviders } from "../src/components/AppProviders";
4+
5+
/**
6+
* @type {import('@storybook/react').Preview}
7+
*/
8+
const preview = {
9+
decorators: [
10+
(Story) => (
11+
<AppProviders>
12+
<Story />
13+
</AppProviders>
14+
),
15+
],
16+
};
17+
18+
export default preview;

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ export default tseslint.config({
1818
languageOptions: {
1919
// other options...
2020
parserOptions: {
21-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
21+
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
2222
tsconfigRootDir: import.meta.dirname,
2323
},
2424
},
25-
})
25+
});
2626
```
2727

2828
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
@@ -31,11 +31,11 @@ export default tseslint.config({
3131

3232
```js
3333
// eslint.config.js
34-
import react from 'eslint-plugin-react'
34+
import react from "eslint-plugin-react";
3535

3636
export default tseslint.config({
3737
// Set the react version
38-
settings: { react: { version: '18.3' } },
38+
settings: { react: { version: "18.3" } },
3939
plugins: {
4040
// Add the react plugin
4141
react,
@@ -44,7 +44,7 @@ export default tseslint.config({
4444
// other rules...
4545
// Enable its recommended rules
4646
...react.configs.recommended.rules,
47-
...react.configs['jsx-runtime'].rules,
47+
...react.configs["jsx-runtime"].rules,
4848
},
49-
})
49+
});
5050
```

eslint.config.js

+78-20
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,86 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
5-
import tseslint from 'typescript-eslint'
6-
7-
export default tseslint.config(
8-
{ ignores: ['dist'] },
1+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
2+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
3+
4+
import js from "@eslint/js";
5+
import prettier from "eslint-config-prettier";
6+
import { flatConfigs as importConfigs } from "eslint-plugin-import";
7+
import jsxA11y from "eslint-plugin-jsx-a11y";
8+
import react from "eslint-plugin-react";
9+
import reactHooks from "eslint-plugin-react-hooks";
10+
import reactRefresh from "eslint-plugin-react-refresh";
11+
import storybook from "eslint-plugin-storybook";
12+
import globals from "globals";
13+
import { configs as typescriptConfigs } from "typescript-eslint";
14+
15+
/** @type {import('eslint').Linter.Config[]} */
16+
export default [
17+
js.configs.recommended,
18+
jsxA11y.flatConfigs.recommended,
19+
prettier,
20+
{ ignores: ["coverage", "dist", "storybook-static"] },
21+
22+
// import
23+
importConfigs.recommended,
24+
importConfigs.typescript,
925
{
10-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
12-
languageOptions: {
13-
ecmaVersion: 2020,
14-
globals: globals.browser,
26+
rules: {
27+
"import/no-extraneous-dependencies": "error",
28+
"import/order": [
29+
"error",
30+
{
31+
alphabetize: { order: "asc", orderImportKind: "desc" },
32+
"newlines-between": "always",
33+
warnOnUnassignedImports: true,
34+
},
35+
],
1536
},
16-
plugins: {
17-
'react-hooks': reactHooks,
18-
'react-refresh': reactRefresh,
37+
settings: {
38+
"import/internal-regex": "^@/",
39+
"import/resolver": { node: true, typescript: true },
1940
},
41+
},
42+
43+
// react
44+
react.configs.flat.recommended,
45+
react.configs.flat["jsx-runtime"],
46+
{ settings: { react: { version: "detect" } } },
47+
48+
// react-hooks
49+
{
50+
plugins: { "react-hooks": reactHooks },
51+
rules: reactHooks.configs.recommended.rules,
52+
},
53+
54+
// react-refresh
55+
{
56+
plugins: { "react-refresh": reactRefresh },
2057
rules: {
21-
...reactHooks.configs.recommended.rules,
22-
'react-refresh/only-export-components': [
23-
'warn',
58+
"react-refresh/only-export-components": [
59+
"warn",
2460
{ allowConstantExport: true },
2561
],
2662
},
2763
},
28-
)
64+
65+
// storybook
66+
...storybook.configs["flat/recommended"],
67+
{ ignores: ["!.storybook"] },
68+
69+
// typescript
70+
...typescriptConfigs.recommendedTypeChecked,
71+
{
72+
languageOptions: {
73+
ecmaVersion: 2020,
74+
globals: globals.browser,
75+
parserOptions: {
76+
projectService: {
77+
allowDefaultProject: [".storybook/*.js", "*.js"],
78+
},
79+
tsconfigRootDir: import.meta.dirname,
80+
},
81+
},
82+
rules: {
83+
"@typescript-eslint/no-deprecated": "error",
84+
},
85+
},
86+
];

0 commit comments

Comments
 (0)