Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"jsxSingleQuote": true,
"jsxBracketSameLine": false,
"singleQuote": true,
"semi": true,
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf",
"plugins": ["prettier-plugin-tailwindcss"]
}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ src/
- `build` — сборка production‑версии
- `start` — запуск production‑сборки
- `lint` — проверка кода ESLint
- `lint:fix` — исправление кода по правилам eslint(некоторые ошибки нужно исправлять самому)
- `format` — приведение кода к одному стилю что бы код везде выглядел одинаково
- `typecheck` — проверка типов в коде

---

Expand All @@ -100,6 +103,10 @@ src/

## 1️⃣ Slice (reducer)

**ВАЖНО**:
Не делаем розширение файла слайса и санков в формате `.tsx`, **это не компонент там только логика состояния и редьюсеры** формат только `.ts`,
также чтобы линтер не ругалься на `export default slice` пишем слпйс в таком формате `name.slice.ts`

Slice описывает **одну логическую область состояния** (например, авторизация).

### Пример: `authReducer.ts`
Expand Down
116 changes: 107 additions & 9 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,116 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
import { defineConfig, globalIgnores } from 'eslint/config';
import nextVitals from 'eslint-config-next/core-web-vitals';
import nextTs from 'eslint-config-next/typescript';
import prettierConfig from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import prettierPlugin from 'eslint-plugin-prettier';
import simpleImportSort from 'eslint-plugin-simple-import-sort';

const eslintConfig = defineConfig([
// Базовые конфиги Next.js
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
'.next/**',
'out/**',
'build/**',
'next-env.d.ts',
'node_modules/**',
'.history/**',
]),
{
plugins: {
'simple-import-sort': simpleImportSort,
import: importPlugin,
prettier: prettierPlugin,
},
rules: {
// Сортировка импортов
'simple-import-sort/imports': [
'error',
{
groups: [
// 1. Внешние библиотеки (самые важные первыми)
['^react', '^next', '^@?\\w'], // react, next, zustand, lodash и любые другие пакеты

// 2. Относительные импорты (совпадает с fsd/ordered-imports: non-FSD перед слоями)
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],

// 3. Слои FSD в правильном порядке (от верхних к нижним)
['^@/app'],
['^@/entities'],
['^@/features'],
['^@/store'],
['^@/i18n'],
['^@/ui'],

// 4. Стили (scss, css и т.д.)
['^.+\\.s?css$'],
],
},
],
'simple-import-sort/exports': 'error',

// Правила импортов
'import/first': 'error',
'import/newline-after-import': ['error', { count: 1 }],
'import/no-duplicates': 'error',

// Запрет дефолтных экспортов (глобально)
'import/no-default-export': 'error',

'prettier/prettier': 'error',

semi: 'off',
'arrow-body-style': ['error', 'as-needed'],
'react/self-closing-comp': 'error',
'no-multiple-empty-lines': ['error', { max: 1 }],
'no-empty': 'error',
},
},
{
files: ['src/**/*.{ts,tsx}'],
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
},
},

// Исключения для Next.js App Router
{
files: ['src/app/**/*.{ts,tsx}'],
rules: {
'import/no-default-export': 'off',
'import/prefer-default-export': 'error',
},
},
{
files: ['src/**/*.slice.{ts,js,mjs}'],
rules: {
'import/no-default-export': 'off',
},
},

// Исключения для конфигов в корне (next.config.ts, eslint.config.mjs и т.д.)
{
files: ['*.{js,mjs,ts}'],
rules: {
'import/no-default-export': 'off',
},
},
{
files: ['**/*.d.ts'],
rules: {
'import/no-default-export': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},

prettierConfig,
]);

export default eslintConfig;
4 changes: 4 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.css' {
const content: any;
export default content;
}
3 changes: 1 addition & 2 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { NextConfig } from "next";
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
trailingSlash: false,
poweredByHeader: false,

};

export default nextConfig;
Loading