chore: настройка линтинга, форматирования и проверок
ESLint 9 flat config, Prettier, Stylelint, husky-хуки, lint-staged и nx-таргеты проверок в корневом project.json.
This commit is contained in:
1 parent
8c368cd68f
commit
efba11d83f
7 files changed
+265
-1
No files matched your search
Executable
+1
@@ -0,0 +1 @@
|
||||
yarn lint-staged
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
yarn lint:branch-name
|
||||
@@ -4,3 +4,4 @@
|
||||
/.nx/cache
|
||||
/.nx/workspace-data
|
||||
.nx/self-healing
|
||||
/.claude
|
||||
+22
-1
@@ -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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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/**/*"
|
||||
]
|
||||
}
|
||||
@@ -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: {},
|
||||
},
|
||||
];
|
||||
@@ -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/**\""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user