UNPKG

eslint-config-sheriff

Version:

A comprehensive and opinionated TypeScript-first ESLint configuration.

118 lines (117 loc) 4.81 kB
import tseslint from "typescript-eslint"; import { TSESLint, TSESLint as TSESLint$1 } from "@typescript-eslint/utils"; //#region ../sheriff-types/dist/index.d.ts interface NoRestrictedSyntaxSlice { selector: string; message: string; } interface Entry { ruleName: string; parentPluginName: string; severity: NumericSeverity; ruleOptions: RuleOptionsConfig; affectedFiles: string; docs: { description: string; url: string; }; } type NumericSeverity = 0 | 1 | 2; type StringSeverity = 'error' | 'warn' | 'off'; type Severity = NumericSeverity | StringSeverity; type RuleOptions = [Severity, ...(Record<string, unknown> | string)[]] | Severity | undefined; type RuleOptionsConfig = (Record<string, any> | string)[]; interface SheriffConfigurablePlugins { /** * React support. */ react: boolean; /** * Lodash support. */ lodash: boolean; /** * Remeda support. */ remeda: boolean; /** * Nextjs support. */ next: boolean; /** * Astro support. */ astro: boolean; /** * Playwright support. */ playwright: boolean; /** * Storybook support. */ storybook: boolean; /** * Jest support. Select this or vitest, not both. */ jest: boolean; /** * Vitest support. Select this or jest, not both. */ vitest: boolean; } interface SheriffSettings extends Partial<SheriffConfigurablePlugins> { /** * This parameter allows you to override the paths for some Sheriff settings. */ pathsOverrides?: { /** * With this setting, if you have multiple tsconfig.json files in your project (like tsconfig.json, tsconfig.eslint.json, tsconfig.node.json, etc...) you can specify which config Sheriff will pickup. You can also specify a list of paths, see: https://typescript-eslint.io/linting/typed-linting/monorepos/#one-tsconfigjson-per-package-and-an-optional-one-in-the-root. */ tsconfigLocation?: string | string[]; /** * This setting overrides the default Sheriff filepaths for Vitest and Jest linting. It accepts an array of filepaths, dictaced by minimatch syntax. Sheriff will apply Jest or Vitest rules only on these files. */ tests?: string[]; /** * This setting overrides the default Sheriff filepaths for Playwright linting. It accepts an array of filepaths, dictaced by minimatch syntax. Sheriff will apply Playwright rules only on these files. */ playwrightTests?: string[]; }; /** * This setting apply some ignore patterns to the whole config. */ ignores?: { /** * Some commonly ignored folders. */ recommended?: boolean; /** * With this setting, Sheriff will ignore all the files that are currently ignored by git. Chances are that if you are ignoring a file in git, you don't want to lint it, which usually is the case with temporary and autogenerated files. */ inheritedFromGitignore?: boolean; }; /** * This setting accepts an array of filepaths, dictaced by minimatch syntax. Only the matching files found in this array will be linted. All other files will be ignored. This is useful if you want to lint only a subset of your project. */ files?: string[]; } interface ServerResponse { compiledConfig: Entry[]; pluginsNames: string[]; totalAvailableRulesAmount?: number; } //#endregion //#region src/getExportableConfig.d.ts declare const getExportableConfig: (userConfigChoices?: SheriffSettings, /** @internal */ areAllRulesForced?: boolean) => TSESLint$1.FlatConfig.ConfigArray; //#endregion //#region src/index.d.ts declare const exportableAllJsExtensions = "js,mjs,cjs,ts,mts,cts"; declare const exportableAllJsxExtensions = "jsx,mjsx,tsx,mtsx"; declare const exportableIgnores: readonly ["**/node_modules/**", "**/dist/**", "**/build/**", "**/artifacts/**", "**/coverage/**", "eslint.config.{js,mjs,cjs}"]; declare const exportableSheriffStartingOptions: SheriffConfigurablePlugins; declare const exportableSupportedFileTypes = "**/*{js,mjs,cjs,ts,mts,cts,jsx,mjsx,tsx,mtsx,astro}"; declare const exportableTestsFilePatterns: readonly ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts}", "**/tests/**/*.{js,mjs,cjs,ts,mts,cts}", "**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts}"]; //#endregion export { Entry, NoRestrictedSyntaxSlice, NumericSeverity, RuleOptions, RuleOptionsConfig, ServerResponse, Severity, SheriffConfigurablePlugins, SheriffSettings, StringSeverity, type TSESLint, exportableAllJsExtensions as allJsExtensions, exportableAllJsxExtensions as allJsxExtensions, getExportableConfig as default, getExportableConfig as sheriff, exportableIgnores as ignores, exportableSheriffStartingOptions as sheriffStartingOptions, exportableSupportedFileTypes as supportedFileTypes, exportableTestsFilePatterns as testsFilePatterns, tseslint }; //# sourceMappingURL=index.d.ts.map