quality / commitlint (push) Skipped
CD / update-wiki (push) Failing after 7s
quality / changes (push) Successful in 4s
quality / docker-check (push) Skipped
quality / web (push) Failing after 38s
quality / api (push) Successful in 49s
CD / quality (push) Failing after 1m36s
CD / publish (push) Skipped
102 lines
3.0 KiB
JavaScript
102 lines
3.0 KiB
JavaScript
import js from '@eslint/js'
|
|
import globals from 'globals'
|
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
import tseslint from 'typescript-eslint'
|
|
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
|
|
const rawHtmlElements = ['table', 'select', 'hr']
|
|
|
|
export default defineConfig([
|
|
globalIgnores(['dist', 'src/components/blocks/**']),
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
extends: [
|
|
js.configs.recommended,
|
|
tseslint.configs.recommended,
|
|
reactHooks.configs.flat.recommended,
|
|
reactRefresh.configs.vite,
|
|
],
|
|
languageOptions: {
|
|
globals: globals.browser,
|
|
},
|
|
rules: {
|
|
'react-hooks/set-state-in-effect': 'off',
|
|
'no-restricted-imports': [
|
|
'error',
|
|
{
|
|
patterns: [
|
|
{
|
|
group: ['@/components/ui/*'],
|
|
message: 'Импортируйте примитивы через @cdnmanager/ui/components/*',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
'no-restricted-syntax': [
|
|
'error',
|
|
...rawHtmlElements.map((name) => ({
|
|
selector: `JSXOpeningElement[name.name="${name}"]`,
|
|
message: `Используйте shadcn-компонент вместо <${name}>`,
|
|
})),
|
|
{
|
|
selector:
|
|
'JSXAttribute[name.name="className"] Literal[value=/\\bspace-[xy]-/]',
|
|
message: 'Используйте flex + gap-* вместо space-y-* / space-x-*',
|
|
},
|
|
{
|
|
selector:
|
|
'JSXAttribute[name.name="className"] Literal[value=/\\bbg-(emerald|red|green|blue|yellow|orange)-/]',
|
|
message: 'Используйте semantic tokens (bg-primary, bg-muted и т.д.)',
|
|
},
|
|
{
|
|
selector:
|
|
'JSXAttribute[name.name="className"] Literal[value=/\\btext-(blue|red|green)-/]',
|
|
message: 'Используйте semantic tokens (text-foreground, text-muted-foreground)',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ['src/routes/**/*.{ts,tsx}'],
|
|
rules: {
|
|
'react-refresh/only-export-components': 'off',
|
|
},
|
|
},
|
|
{
|
|
files: ['src/components/tagged-input.tsx'],
|
|
rules: {
|
|
'react-refresh/only-export-components': 'off',
|
|
},
|
|
},
|
|
{
|
|
files: [
|
|
'**/services-board/*-row.tsx',
|
|
'**/groups-board/*-row.tsx',
|
|
'**/layout/app-shell.tsx',
|
|
],
|
|
rules: {
|
|
'no-restricted-syntax': 'off',
|
|
},
|
|
},
|
|
{
|
|
files: [
|
|
'src/components/reui/**/*.{ts,tsx}',
|
|
'src/components/reui-kit/**/*.{ts,tsx}',
|
|
'src/components/columns/**/*.{ts,tsx}',
|
|
],
|
|
rules: {
|
|
'react-refresh/only-export-components': 'off',
|
|
'react-hooks/incompatible-library': 'off',
|
|
'react-hooks/use-memo': 'off',
|
|
'react-hooks/immutability': 'off',
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
'no-restricted-syntax': 'off',
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-expressions': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'prefer-const': 'off',
|
|
},
|
|
},
|
|
])
|