From efba11d83f9d7ed02b02cf7e8324518172e37f29 Mon Sep 17 00:00:00 2001 From: Arswarog Date: Mon, 26 Oct 2026 17:16:13 +0300 Subject: [PATCH] =?UTF-8?q?chore:=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B9=D0=BA=D0=B0=20=D0=BB=D0=B8=D0=BD=D1=82=D0=B8=D0=BD=D0=B3?= =?UTF-8?q?=D0=B0,=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B8=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B5=D1=80=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ESLint 9 flat config, Prettier, Stylelint, husky-хуки, lint-staged и nx-таргеты проверок в корневом project.json. --- .husky/pre-commit | 1 + .husky/pre-push | 1 + .prettierignore | 3 +- .prettierrc | 23 ++++++++- .stylelintrc.json | 86 ++++++++++++++++++++++++++++++++++ eslint.config.mjs | 117 ++++++++++++++++++++++++++++++++++++++++++++++ project.json | 37 +++++++++++++++ 7 files changed, 266 insertions(+), 2 deletions(-) create mode 100755 .husky/pre-commit create mode 100755 .husky/pre-push create mode 100644 .stylelintrc.json create mode 100644 eslint.config.mjs create mode 100644 project.json diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..3723623 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +yarn lint-staged diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000..86a2edf --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1 @@ +yarn lint:branch-name diff --git a/.prettierignore b/.prettierignore index 6f422af..e299534 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,5 @@ /coverage /.nx/cache /.nx/workspace-data -.nx/self-healing \ No newline at end of file +.nx/self-healing +/.claude diff --git a/.prettierrc b/.prettierrc index 544138b..817d0ca 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,24 @@ { - "singleQuote": true + "printWidth": 100, + "useTabs": false, + "tabWidth": 4, + "semi": true, + "singleQuote": true, + "trailingComma": "all", + "bracketSpacing": true, + "singleAttributePerLine": true, + "overrides": [ + { + "files": ["*.json"], + "options": { + "printWidth": 10 + } + }, + { + "files": ["*.md", "*.mdx"], + "options": { + "proseWrap": "always" + } + } + ] } diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000..5eacb86 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,86 @@ +{ + "extends": [ + "stylelint-config-standard", + "stylelint-config-recess-order", + "stylelint-config-standard-scss", + "stylelint-prettier/recommended", + "stylelint-config-prettier-scss" + ], + "plugins": [ + "stylelint-order", + "stylelint-scss" + ], + "rules": { + "scss/at-rule-no-unknown": [ + true, + { + "ignoreAtRules": [ + "tailwind", + "apply", + "layer", + "screen", + "responsive", + "variants", + "config", + "source", + "theme", + "utility", + "custom-variant", + "plugin" + ] + } + ], + "selector-pseudo-class-no-unknown": [ + true, + { + "ignorePseudoClasses": [ + "global" + ] + } + ], + "max-nesting-depth": [ + 3, + { + "ignore": [ + "blockless-at-rules", + "pseudo-classes" + ] + } + ], + "selector-class-pattern": null, + "scss/dollar-variable-pattern": null, + "custom-property-pattern": null, + "selector-id-pattern": null, + "no-descending-specificity": null, + "order/order": [ + "custom-properties", + "declarations", + { + "type": "at-rule", + "name": "media" + }, + { + "type": "rule", + "selector": "^&::(before|after)" + }, + { + "type": "rule", + "selector": "^&:\\w" + }, + { + "type": "rule", + "selector": "^&_" + }, + { + "type": "rule", + "selector": "^." + } + ], + "color-hex-length": null + }, + "ignoreFiles": [ + "coverage/**/*", + "apps/*/dist/**/*", + "dist/**/*" + ] +} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..f7983d2 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,117 @@ +import nx from '@nx/eslint-plugin'; +import importPlugin from 'eslint-plugin-import-x'; +import unusedImports from 'eslint-plugin-unused-imports'; + +export default [ + ...nx.configs['flat/base'], + ...nx.configs['flat/typescript'], + ...nx.configs['flat/javascript'], + { + ignores: [ + '**/dist', + '**/out-tsc', + '**/vite.config.*.timestamp*', + '**/vitest.config.*.timestamp*', + ], + }, + { + files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], + plugins: { + 'import-x': importPlugin, + 'unused-imports': unusedImports, + }, + rules: { + '@nx/enforce-module-boundaries': [ + 'error', + { + enforceBuildableLibDependency: true, + allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?[jt]s$'], + allowCircularSelfDependency: true, + depConstraints: [ + { + sourceTag: '*', + onlyDependOnLibsWithTags: ['*'], + }, + ], + }, + ], + '@typescript-eslint/no-empty-function': 'warn', + '@typescript-eslint/no-inferrable-types': 'warn', + 'no-restricted-globals': 'warn', + + 'import-x/order': [ + 'error', + { + pathGroups: [ + { + pattern: 'react', + group: 'builtin', + position: 'before', + }, + { + pattern: '@geo-platform/**', + group: 'internal', + }, + ], + + pathGroupsExcludedImportTypes: ['react'], + 'newlines-between': 'always', + groups: ['builtin', 'external', 'internal', 'parent', ['sibling', 'index']], + + alphabetize: { + order: 'asc', + caseInsensitive: true, + }, + }, + ], + 'sort-imports': [ + 'error', + { + ignoreCase: true, + ignoreDeclarationSort: true, + ignoreMemberSort: false, + memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], + allowSeparatedGroups: false, + }, + ], + 'unused-imports/no-unused-imports': 'error', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'off', + 'unused-imports/no-unused-vars': [ + 'error', + { + vars: 'all', + varsIgnorePattern: '^_', + args: 'after-used', + argsIgnorePattern: '^_', + caughtErrors: 'all', + caughtErrorsIgnorePattern: '^_', + }, + ], + 'import-x/no-duplicates': 'error', + '@typescript-eslint/ban-ts-comment': [ + 'error', + { + 'ts-ignore': 'allow-with-description', + 'ts-nocheck': 'allow-with-description', + 'ts-check': false, + 'ts-expect-error': false, + }, + ], + }, + }, + { + files: [ + '**/*.ts', + '**/*.tsx', + '**/*.cts', + '**/*.mts', + '**/*.js', + '**/*.jsx', + '**/*.cjs', + '**/*.mjs', + ], + // Override or add rules here + rules: {}, + }, +]; diff --git a/project.json b/project.json new file mode 100644 index 0000000..a42876d --- /dev/null +++ b/project.json @@ -0,0 +1,37 @@ +{ + "name": "geo-platform", + "$schema": "./node_modules/nx/schemas/project-schema.json", + "targets": { + "lint": { + "executor": "@nx/eslint:lint", + "options": { + "lintFilePatterns": [ + "tools/**/*.{ts,js}", + "*.{ts,mjs}" + ], + "fix": true + } + }, + "lint-check": { + "executor": "@nx/eslint:lint", + "options": { + "lintFilePatterns": [ + "tools/**/*.{ts,js}", + "*.{ts,mjs}" + ] + } + }, + "format": { + "executor": "nx:run-commands", + "options": { + "command": "prettier --write . \"!apps/**\" \"!packages/**\"" + } + }, + "format-check": { + "executor": "nx:run-commands", + "options": { + "command": "prettier --check . \"!apps/**\" \"!packages/**\"" + } + } + } +}