Skip to content

Commit

Permalink
feat!: make astro support optional
Browse files Browse the repository at this point in the history
  • Loading branch information
lishaduck committed Jul 16, 2024
1 parent d1971c3 commit aa57685
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/brown-singers-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"eslint-config-sheriff": major
"@sherifforg/constants": patch
"@sherifforg/types": patch
---

feat!: make astro support optional
3 changes: 0 additions & 3 deletions packages/eslint-config-sheriff/src/getBaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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(
{
Expand Down Expand Up @@ -180,7 +178,6 @@ export const getBaseConfig = (userConfigChoices: SheriffSettings) => {
plugins: { fsecond },
rules: { 'fsecond/prefer-destructured-optionals': 2 },
},
getAstroConfig(hasReact, customTSConfigPath),
{
files: [`**/*.config.{${allJsExtensions}}`],
rules: {
Expand Down
9 changes: 9 additions & 0 deletions packages/eslint-config-sheriff/src/getExportableConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/sheriff-constants/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const sheriffStartingOptions: SheriffConfigurablePlugins = {
react: false,
lodash: false,
next: false,
astro: false,
playwright: false,
jest: false,
vitest: false,
Expand All @@ -13,6 +14,7 @@ export const configCombinationDefaultValues = {
react: true,
lodash: true,
next: true,
astro: true,
playwright: true,
jest: false,
vitest: true,
Expand Down
4 changes: 4 additions & 0 deletions packages/sheriff-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export interface SheriffConfigurablePlugins {
* Nextjs support.
*/
next: boolean;
/**
* Astro support.
*/
astro: boolean;
/**
* Playwright support.
*/
Expand Down

0 comments on commit aa57685

Please sign in to comment.