From c3e2d2a66da834880bf21f573bb2015af055a88d Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 4 Sep 2024 13:56:06 +0200 Subject: [PATCH] feat: move disable rules to the end, remove deprecated rules --- src/configs/astro.ts | 1 - src/configs/disables.ts | 55 +++++++++++++++++++++++++++++++++++++++ src/configs/imports.ts | 9 ------- src/configs/index.ts | 1 + src/configs/javascript.ts | 8 ------ src/configs/markdown.ts | 1 - src/configs/test.ts | 1 + src/configs/typescript.ts | 27 ------------------- src/factory.ts | 5 ++++ 9 files changed, 62 insertions(+), 46 deletions(-) create mode 100644 src/configs/disables.ts diff --git a/src/configs/astro.ts b/src/configs/astro.ts index 6ae51f270a..70e4985896 100644 --- a/src/configs/astro.ts +++ b/src/configs/astro.ts @@ -58,7 +58,6 @@ export async function astro( ? { 'style/indent': 'off', 'style/jsx-closing-tag-location': 'off', - 'style/jsx-indent': 'off', 'style/jsx-one-expression-per-line': 'off', 'style/no-multiple-empty-lines': 'off', } diff --git a/src/configs/disables.ts b/src/configs/disables.ts new file mode 100644 index 0000000000..0d585ecca2 --- /dev/null +++ b/src/configs/disables.ts @@ -0,0 +1,55 @@ +import { GLOB_SRC, GLOB_SRC_EXT } from '../globs' +import type { TypedFlatConfigItem } from '../types' + +export async function disables(): Promise { + return [ + { + files: [`scripts/${GLOB_SRC}`], + name: 'antfu/disables/scripts', + rules: { + 'no-console': 'off', + 'ts/explicit-function-return-type': 'off', + 'unicorn/consistent-function-scoping': 'off', + }, + }, + { + files: [`cli/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`], + name: 'antfu/disables/cli', + rules: { + 'no-console': 'off', + }, + }, + { + files: ['**/bin/**/*', `**/bin.${GLOB_SRC_EXT}`], + name: 'antfu/disables/bin', + rules: { + 'antfu/no-import-dist': 'off', + 'antfu/no-import-node-modules-by-path': 'off', + }, + }, + { + files: ['**/*.d.?([cm])ts'], + name: 'antfu/disables/dts', + rules: { + 'eslint-comments/no-unlimited-disable': 'off', + 'import/no-duplicates': 'off', + 'no-restricted-syntax': 'off', + 'unused-imports/no-unused-vars': 'off', + }, + }, + { + files: ['**/*.{test,spec}.([tj])s?(x)'], + name: 'antfu/disables/test', + rules: { + 'no-unused-expressions': 'off', + }, + }, + { + files: ['**/*.js', '**/*.cjs'], + name: 'antfu/disables/cjs', + rules: { + 'ts/no-require-imports': 'off', + }, + }, + ] +} diff --git a/src/configs/imports.ts b/src/configs/imports.ts index a64b8cfd23..1ae2a263e9 100644 --- a/src/configs/imports.ts +++ b/src/configs/imports.ts @@ -1,6 +1,5 @@ import type { OptionsStylistic, TypedFlatConfigItem } from '../types' import { pluginAntfu, pluginImport } from '../plugins' -import { GLOB_SRC_EXT } from '../globs' export async function imports(options: OptionsStylistic = {}): Promise { const { @@ -34,13 +33,5 @@ export async function imports(options: OptionsStylistic = {}): Promise