chore(eslint): configure stylistic rules

This commit is contained in:
Kirill Gavrilov 2025-01-21 20:33:09 +03:00
parent 3f22c5ceda
commit 66d34ade0b
2 changed files with 27 additions and 0 deletions

View file

@ -1,6 +1,7 @@
// @ts-check
import eslint from '@eslint/js'
import stylistic from '@stylistic/eslint-plugin'
import perfectionist from 'eslint-plugin-perfectionist'
import globals from 'globals'
import tseslint from 'typescript-eslint'
@ -8,6 +9,31 @@ import tseslint from 'typescript-eslint'
export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
stylistic.configs.customize({
flat: true,
jsx: false,
indent: 2,
quotes: 'single',
semi: false,
commaDangle: 'always-multiline',
braceStyle: '1tbs',
quoteProps: 'as-needed',
}),
{
rules: {
'@stylistic/curly-newline': ['error', { consistent: true }],
'@stylistic/max-len': ['error', { code: 100, ignoreUrls: true, ignoreComments: true }],
'@stylistic/array-bracket-newline': ['error', 'consistent'],
'@stylistic/array-element-newline': ['error', 'consistent'],
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
'@stylistic/no-confusing-arrow': 'error',
'@stylistic/nonblock-statement-body-position': 'error',
'@stylistic/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
'@stylistic/padding-line-between-statements': 'error',
'@stylistic/switch-colon-spacing': 'error',
},
},
{
plugins: {
perfectionist,

View file

@ -16,6 +16,7 @@
"license": "MIT",
"devDependencies": {
"@eslint/js": "9.18.0",
"@stylistic/eslint-plugin": "2.13.0",
"@types/node": "22.10.7",
"enquirer": "2.4.1",
"esbuild": "0.24.2",