This commit is contained in:
Ivan 2025-03-02 21:21:34 +03:00
parent 338cb9543c
commit c3cc8f5d89
10 changed files with 105 additions and 44 deletions

View File

@ -41,6 +41,7 @@ jobs:
- name: Run CI - name: Run CI
run: | run: |
npm run lint npm run lint
npm run lint:playwright
npm test npm test
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: ${{ !cancelled() }} if: ${{ !cancelled() }}

25
.vscode/settings.json vendored
View File

@ -4,7 +4,30 @@
".pytest_cache/": true ".pytest_cache/": true
}, },
"typescript.tsdk": "rsconcept/frontend/node_modules/typescript/lib", "typescript.tsdk": "rsconcept/frontend/node_modules/typescript/lib",
"eslint.workingDirectories": ["rsconcept/frontend"], "eslint.probe": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"eslint.workingDirectories": [
{
"directory": "./",
"overrideConfigFile": "eslint.config.js",
"changeProcessCWD": true
},
{
"directory": "./",
"pattern": "tests/**",
"overrideConfigFile": "eslint.playwright.config.js"
}
],
"isort.args": [ "isort.args": [
"--line-length", "--line-length",
"100", "100",

View File

@ -1,21 +0,0 @@
# Frontend Developer guidelines
Styling conventions
- static > conditional static > props. All dynamic styling should go in styles props
- dimensions = rectangle + outer layout
<details>
<summary>clsx className grouping and order</summary>
<pre>
- layer: z-position
- outer layout: fixed bottom-1/2 left-0 -translate-x-1/2
- rectangle: mt-3 min-w-fit min-w-10 flex-grow shrink-0
- inner layout: px-3 py-2 flex flex-col gap-3 justify-between items-center
- overflow behavior: overflow-scroll overscroll-contain
- border: borer-2 outline-none shadow-md
- text: text-start text-sm font-semibold whitespace-nowrap bg-prim-200 fg-app-100
- behavior modifiers: select-none disabled:cursor-auto
- transitions:
</pre>
</details>

View File

@ -6,13 +6,21 @@ import reactCompilerPlugin from 'eslint-plugin-react-compiler';
import reactHooksPlugin from 'eslint-plugin-react-hooks'; import reactHooksPlugin from 'eslint-plugin-react-hooks';
import importPlugin from 'eslint-plugin-import'; import importPlugin from 'eslint-plugin-import';
import simpleImportSort from 'eslint-plugin-simple-import-sort'; import simpleImportSort from 'eslint-plugin-simple-import-sort';
import playwright from 'eslint-plugin-playwright';
export default [ export default [
...typescriptPlugin.configs.recommendedTypeChecked, ...typescriptPlugin.configs.recommendedTypeChecked,
...typescriptPlugin.configs.stylisticTypeChecked, ...typescriptPlugin.configs.stylisticTypeChecked,
{ {
ignores: ['**/parser.ts', '**/node_modules/**', '**/public/**', '**/dist/**', 'eslint.config.js'] ignores: [
'**/parser.ts',
'**/node_modules/**',
'**/public/**',
'**/dist/**',
'eslint.config.js',
'playwright.config.ts',
'eslint.playwright.config.js',
'tests/**'
]
}, },
{ {
languageOptions: { languageOptions: {
@ -21,16 +29,11 @@ export default [
ecmaVersion: 'latest', ecmaVersion: 'latest',
sourceType: 'module', sourceType: 'module',
globals: { ...globals.browser, ...globals.es2020, ...globals.jest }, globals: { ...globals.browser, ...globals.es2020, ...globals.jest },
project: ['./tsconfig.json', './tsconfig.vite.json', './tsconfig.test.json'], project: ['./tsconfig.json', './tsconfig.vite.json'],
projectService: true projectService: true
} }
} }
}, },
{
...playwright.configs['flat/recommended'],
files: ['tests/**'],
rules: { ...playwright.configs['flat/recommended'].rules }
},
{ {
plugins: { plugins: {
'react': reactPlugin, 'react': reactPlugin,
@ -42,6 +45,8 @@ export default [
settings: { react: { version: 'detect' } }, settings: { react: { version: 'detect' } },
rules: { rules: {
'react-compiler/react-compiler': 'error', 'react-compiler/react-compiler': 'error',
'react-refresh/only-export-components': ['off', { allowConstantExport: true }],
'@typescript-eslint/consistent-type-imports': [ '@typescript-eslint/consistent-type-imports': [
'warn', 'warn',
{ {
@ -61,8 +66,8 @@ export default [
} }
], ],
'react-refresh/only-export-components': ['off', { allowConstantExport: true }], 'simple-import-sort/exports': 'error',
'import/no-duplicates': 'warn',
'simple-import-sort/imports': [ 'simple-import-sort/imports': [
'warn', 'warn',
{ {
@ -88,8 +93,6 @@ export default [
] ]
} }
], ],
'simple-import-sort/exports': 'error',
'import/no-duplicates': 'warn',
...reactHooksPlugin.configs.recommended.rules ...reactHooksPlugin.configs.recommended.rules
} }

View File

@ -0,0 +1,40 @@
import globals from 'globals';
import typescriptParser from '@typescript-eslint/parser';
import playwright from 'eslint-plugin-playwright';
import importPlugin from 'eslint-plugin-import';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
export default [
{
...playwright.configs['flat/recommended'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.es2020
}
}
},
plugins: {
'playwright': playwright,
'simple-import-sort': simpleImportSort,
'import': importPlugin
},
rules: {
...playwright.configs['flat/recommended'].rules,
'simple-import-sort/exports': 'error',
'import/no-duplicates': 'warn',
'simple-import-sort/imports': 'warn'
},
files: ['tests/**/*.ts']
}
];

View File

@ -9,7 +9,8 @@
"teste2e": "playwright test", "teste2e": "playwright test",
"dev": "vite --host", "dev": "vite --host",
"build": "tsc && vite build", "build": "tsc && vite build",
"lint": "eslint . --report-unused-disable-directives --max-warnings 0", "lint": "eslint . --config eslint.config.js --report-unused-disable-directives --max-warnings 0",
"lint:playwright": "eslint . --config eslint.playwright.config.js --report-unused-disable-directives --max-warnings 0",
"lintFix": "eslint . --report-unused-disable-directives --max-warnings 0 --fix", "lintFix": "eslint . --report-unused-disable-directives --max-warnings 0 --fix",
"preview": "vite preview --port 3000" "preview": "vite preview --port 3000"
}, },

View File

@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2022", "dom"],
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"isolatedModules": false,
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
},
"types": ["playwright"]
},
"include": ["playwright.config.ts", "tests/**/*.ts"]
}

View File

@ -1,8 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"types": ["playwright/test"],
"isolatedModules": false
},
"include": ["src", "tests"]
}

View File

@ -11,5 +11,5 @@
"@/*": ["*"] "@/*": ["*"]
} }
}, },
"include": ["vite.config.ts", "package.json", "playwright.config.ts"] "include": ["vite.config.ts", "package.json"]
} }

View File

@ -21,6 +21,7 @@ function LintBackend() {
function LintFrontend() { function LintFrontend() {
Set-Location $frontend Set-Location $frontend
& npm run lint & npm run lint
& npm run lint:playwright
} }
RunLinters RunLinters