Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
49 changes: 21 additions & 28 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,31 @@
"i18n-ally.localesPaths": [
"**/locales"
],

"eslint.enable": true,
"biome.enabled": false,

//"eslint.useFlatConfig": true,
//"eslint.useESLintClass": false, // важно!
"editor.tabSize": 4,

// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
//"source.fixAll.biome": "explicit",
//"source.organizeImports.biome": "explicit",

"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

//"eslint.runtime": "node",

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "info", "fixable": true },
{ "rule": "*-indent", "severity": "info", "fixable": true },
{ "rule": "*-spacing", "severity": "info", "fixable": true },
{ "rule": "*-spaces", "severity": "info", "fixable": true },
{ "rule": "*-order", "severity": "info", "fixable": true },
{ "rule": "*-dangle", "severity": "info", "fixable": true },
{ "rule": "*-newline", "severity": "info", "fixable": true },
{ "rule": "*quotes", "severity": "info", "fixable": true },
{ "rule": "*semi", "severity": "info", "fixable": true }
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],

// Enable eslint for all supported languages
Expand All @@ -47,17 +39,18 @@
"html",
"markdown",
"json",
"json5",
"jsonc",
"yaml",
"toml",
"xml"
],

"pair-diff.patterns": [
{
"source": "./fixtures/output/**/*.*",
"target": "./fixtures/input/<base>"
}
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"@changesets/cli": "^2.28.1",
"turbo": "^2.5.0"
},
"packageManager": "pnpm@10.7.0",
"packageManager": "pnpm@10.14.0",
"engines": {
"node": ">=20",
"pnpm": ">=10.7.0"
"pnpm": ">=10.14.0"
}
}
229 changes: 123 additions & 106 deletions packages/eslint/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,100 @@ import turboPlugin from 'eslint-plugin-turbo';
import globals from 'globals';

export const overridesStylisticConfig: Exclude<OptionsConfig['stylistic'], boolean | undefined>['overrides'] = {
/* comma */
'style/comma-dangle': ['error', 'never'],
/* comma */
'style/comma-dangle': ['error', 'never'],

/* spacing rules */
'style/type-annotation-spacing': ['error', { before: false, after: true, overrides: { arrow: { before: false, after: true } } }],
'style/type-generic-spacing': ['error'],
'style/type-named-tuple-spacing': ['error'],
'style/template-tag-spacing': ['error'],
/* spacing rules */
'style/type-annotation-spacing': ['error', {
before: false,
after: true,
overrides: { arrow: { before: true, after: true } }
}],
'style/type-generic-spacing': ['error'],
'style/type-named-tuple-spacing': ['error'],
'style/template-tag-spacing': ['error'],

/* misc */
'style/max-len': ['warn', { code: 140, tabWidth: 2, ignoreTrailingComments: true, ignoreUrls: true, ignoreStrings: true, ignoreTemplateLiterals: true, ignoreRegExpLiterals: true, ignorePattern: '^\\s*var\\s.+=\\s*require\\s*\\(' }],
'style/one-var-declaration-per-line': ['error', 'always'],
'style/max-statements-per-line': ['error', { max: 3 }],
/* misc */
'style/max-len': ['warn', {
code: 140,
tabWidth: 4,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true
}],
'style/indent': ['warn', 4],
'style/one-var-declaration-per-line': ['error', 'always'],
'style/max-statements-per-line': ['error', { max: 3 }],
'style/newline-per-chained-call': ['error', { ignoreChainWithDepth: 3 }],
'style/object-curly-newline': ['warn', { consistent: true, minProperties: 4 }],
'style/array-bracket-newline': ['warn', { minItems: 4 }],

/* jsx */
'style/jsx-quotes': ['error', 'prefer-single'],
'style/jsx-curly-brace-presence': ['warn', 'always'],
'style/jsx-curly-spacing': [2, { when: 'always' }],
/* jsx */
'style/jsx-quotes': ['error', 'prefer-single'],
'style/jsx-curly-brace-presence': ['warn', 'always'],
'style/jsx-curly-spacing': [2, { when: 'never' }],

/* semis */
'style/no-extra-semi': 'error',
/* semis */
'style/no-extra-semi': 'error',

/* bracket */
'style/arrow-parens': ['warn', 'always']
/* bracket */
'style/arrow-parens': ['warn', 'always']
};

export const overridesTsConfig: Exclude<OptionsConfig['typescript'], boolean | undefined>['overrides'] = {
'ts/consistent-type-exports': 'error',
'ts/consistent-type-imports': 'error',
'ts/consistent-type-definitions': [
'error',
'type'
],
'ts/naming-convention': [
'warn',
{
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
selector: 'variable'
},
{
format: ['PascalCase'],
selector: 'typeLike'
}
]
'ts/consistent-type-exports': 'error',
'ts/consistent-type-imports': 'error',
'ts/consistent-type-definitions': ['error', 'type'],
'ts/naming-convention': [
'warn',
{
format: [
'camelCase',
'UPPER_CASE',
'PascalCase'
],
selector: 'variable'
},
{
format: ['PascalCase'],
selector: 'typeLike'
}
]
};

export const general: TypedFlatConfigItem[] = [
{
plugins: {
turbo: turboPlugin
{
plugins: {
turbo: turboPlugin
},
rules: {
'turbo/no-undeclared-env-vars': 'warn',
'ts/consistent-type-definitions': ['error', 'type'],
'no-console': ['warn'],
'antfu/no-top-level-await': ['off'],
'node/prefer-global/process': ['off'],
'node/no-process-env': ['error'],
'perfectionist/sort-imports': ['error', {
tsconfigRootDir: import.meta.dirname
}]
}
},
rules: {
'turbo/no-undeclared-env-vars': 'warn',
'ts/consistent-type-definitions': ['error', 'type'],
'no-console': ['warn'],
'antfu/no-top-level-await': ['off'],
'node/prefer-global/process': ['off'],
'node/no-process-env': ['error'],
'perfectionist/sort-imports': ['error', {
tsconfigRootDir: import.meta.dirname
}]
}
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.chai,
...globals.mocha,
...globals.node,
...globals.es2024
}
{
languageOptions: {
globals: {
...globals.browser,
...globals.chai,
...globals.mocha,
...globals.node,
...globals.es2024
}
}
},
{
ignores: ['dist/**']
}
},
{
ignores: ['dist/**']
}
];

export type ESLintAntfuConfig = ReturnType<typeof antfu>;
Expand All @@ -99,27 +116,27 @@ export const createEslintConfig: typeof antfu = antfu;
* @param {string} dirname - The directory name to use for the config.
*/
export function eslintReactConfig(dirname: string): ESLintAntfuConfig {
return antfu(
{
pnpm: true,
react: true,
typescript: {
parserOptions: {
projectService: true,
tsconfigRootDir: dirname
},
overrides: overridesTsConfig
},
stylistic: {
jsx: true,
semi: true,
overrides: overridesStylisticConfig
},
jsx: true,
formatters: true,
...general
}
);
return antfu(
{
pnpm: true,
react: true,
typescript: {
parserOptions: {
projectService: true,
tsconfigRootDir: dirname
},
overrides: overridesTsConfig
},
stylistic: {
jsx: true,
semi: true,
overrides: overridesStylisticConfig
},
jsx: true,
formatters: true,
...general
}
);
}

/**
Expand All @@ -129,25 +146,25 @@ export function eslintReactConfig(dirname: string): ESLintAntfuConfig {
* @param {string} dirname - The directory name to use for the config.
*/
export function eslintNodeConfig(dirname: string): ESLintAntfuConfig {
return antfu(
{
pnpm: true,
react: false,
typescript: {
parserOptions: {
projectService: true,
tsconfigRootDir: dirname
},
overrides: overridesTsConfig
},
stylistic: {
jsx: false,
semi: true,
overrides: overridesStylisticConfig
},
jsx: false,
formatters: true,
...general
}
);
return antfu(
{
pnpm: true,
react: false,
typescript: {
parserOptions: {
projectService: true,
tsconfigRootDir: dirname
},
overrides: overridesTsConfig
},
stylistic: {
jsx: false,
semi: true,
overrides: overridesStylisticConfig
},
jsx: false,
formatters: true,
...general
}
);
}
2 changes: 1 addition & 1 deletion packages/eslint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"extends": "@flippo/tsconfig",
"compilerOptions": {
"composite": false,
"types": ["node"],
"allowImportingTsExtensions": false,
"allowJs": true,
"declaration": false,
"declarationMap": false,
"composite": false,
"emitDeclarationOnly": false,
"isolatedDeclarations": false
},
Expand Down
Loading
Loading