diff --git a/.changeset/brown-singers-whisper.md b/.changeset/brown-singers-whisper.md new file mode 100644 index 00000000..7e71832c --- /dev/null +++ b/.changeset/brown-singers-whisper.md @@ -0,0 +1,7 @@ +--- +"eslint-config-sheriff": major +"@sherifforg/constants": patch +"@sherifforg/types": patch +--- + +feat!: make astro support optional diff --git a/packages/eslint-config-sheriff/src/getBaseConfig.ts b/packages/eslint-config-sheriff/src/getBaseConfig.ts index d61b8c7c..7f30d2fe 100644 --- a/packages/eslint-config-sheriff/src/getBaseConfig.ts +++ b/packages/eslint-config-sheriff/src/getBaseConfig.ts @@ -14,7 +14,6 @@ import arrowReturnStyle from 'eslint-plugin-arrow-return-style'; import stylistic from '@stylistic/eslint-plugin'; import { supportedFileTypes, allJsExtensions } from '@sherifforg/constants'; import { SheriffSettings } from '@sherifforg/types'; -import { getAstroConfig } from './getAstroConfig'; import { fpHandPickedRules } from './handpickedRules/fpHandPickedRules'; import { getTsNamingConventionRule } from './utils/getTsNamingConventionRule'; import { importHandPickedRules } from './handpickedRules/importHandPickedRules'; @@ -29,7 +28,6 @@ import { getLanguageOptionsTypescript } from './utils/getLanguageOptionsTypescri export const getBaseConfig = (userConfigChoices: SheriffSettings) => { const customTSConfigPath = userConfigChoices.pathsOverrides?.tsconfigLocation; const { noRestrictedSyntaxOverride } = userConfigChoices; - const hasReact = Boolean(userConfigChoices.react); return tseslint.config( { @@ -180,7 +178,6 @@ export const getBaseConfig = (userConfigChoices: SheriffSettings) => { plugins: { fsecond }, rules: { 'fsecond/prefer-destructured-optionals': 2 }, }, - getAstroConfig(hasReact, customTSConfigPath), { files: [`**/*.config.{${allJsExtensions}}`], rules: { diff --git a/packages/eslint-config-sheriff/src/getExportableConfig.ts b/packages/eslint-config-sheriff/src/getExportableConfig.ts index ef5e4678..a2da72d2 100644 --- a/packages/eslint-config-sheriff/src/getExportableConfig.ts +++ b/packages/eslint-config-sheriff/src/getExportableConfig.ts @@ -7,6 +7,7 @@ import { ignores, sheriffStartingOptions } from '@sherifforg/constants'; import { getReactConfig } from './getReactConfig'; import { getBaseConfig } from './getBaseConfig'; import { nextjsConfig } from './nextjsConfig'; +import { getAstroConfig } from './getAstroConfig'; import { playwrightConfig } from './playwrightConfig'; import { lodashConfig } from './lodashConfig'; import { getJestConfig } from './getJestConfig'; @@ -60,6 +61,14 @@ export const getExportableConfig = ( exportableConfig.push(lodashConfig); } + if (userConfigChoices.astro) { + const customTSConfigPath = + userConfigChoices.pathsOverrides?.tsconfigLocation; + const hasReact = Boolean(userConfigChoices.react); + + exportableConfig.push(getAstroConfig(hasReact, customTSConfigPath)); + } + if (userConfigChoices.playwright) { exportableConfig.push(playwrightConfig); } diff --git a/packages/sheriff-constants/src/index.ts b/packages/sheriff-constants/src/index.ts index 9edb1632..a3aa7109 100644 --- a/packages/sheriff-constants/src/index.ts +++ b/packages/sheriff-constants/src/index.ts @@ -4,6 +4,7 @@ export const sheriffStartingOptions: SheriffConfigurablePlugins = { react: false, lodash: false, next: false, + astro: false, playwright: false, jest: false, vitest: false, @@ -13,6 +14,7 @@ export const configCombinationDefaultValues = { react: true, lodash: true, next: true, + astro: true, playwright: true, jest: false, vitest: true, diff --git a/packages/sheriff-types/src/index.ts b/packages/sheriff-types/src/index.ts index 425e96b8..7006832a 100644 --- a/packages/sheriff-types/src/index.ts +++ b/packages/sheriff-types/src/index.ts @@ -71,6 +71,10 @@ export interface SheriffConfigurablePlugins { * Nextjs support. */ next: boolean; + /** + * Astro support. + */ + astro: boolean; /** * Playwright support. */