- Prettier — единственный форматтер (табы, 140, одинарные кавычки, в CSS — двойные); форматтер biome выключен, biome остаётся линтером и сортирует импорты. - ESLint (flat config): js/typescript-eslint/react-hooks recommended + правила biome.json, eslint-config-prettier последним. - npm run format / make format: eslint --fix → biome check --write → prettier --write. - npm run lint: eslint + prettier --check; входит в make lint и make check. - Разовое переформатирование 4 файлов, `(A | B)[]` вместо Array<…> в 3 местах, две находки ESLint в ConsoleTable (лишний `?? null`, тернарник-инструкция). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
// ESLint для разработчиков фронта. Правила повторяют biome.json (biome остаётся в make lint/check);
|
|
// форматирование — только Prettier, поэтому eslint-config-prettier подключается последним.
|
|
import js from '@eslint/js';
|
|
import prettier from 'eslint-config-prettier';
|
|
import react from 'eslint-plugin-react';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import globals from 'globals';
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
export default tseslint.config(
|
|
{ ignores: ['node_modules', 'dist'] },
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
{
|
|
files: ['src/**/*.{ts,tsx}'],
|
|
languageOptions: { globals: globals.browser },
|
|
plugins: { react, 'react-hooks': reactHooks },
|
|
settings: { react: { version: 'detect' } },
|
|
rules: {
|
|
// correctness
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
|
],
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
// nursery
|
|
'no-dupe-else-if': 'error',
|
|
'no-nested-ternary': 'error',
|
|
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
|
|
// style
|
|
'default-case': 'error',
|
|
'@typescript-eslint/prefer-for-of': 'error',
|
|
'react/jsx-fragments': ['error', 'syntax'],
|
|
'@typescript-eslint/array-type': ['error', { default: 'array' }],
|
|
'operator-assignment': 'error',
|
|
// suspicious
|
|
'no-console': 'warn',
|
|
'no-empty': 'error',
|
|
'@typescript-eslint/no-empty-function': 'error',
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'require-await': 'error',
|
|
},
|
|
},
|
|
prettier,
|
|
);
|