UNPKG

@nivalis/eslint-config

Version:

ESLint shareable flat config used at Nivalis Studio

164 lines (162 loc) 4.99 kB
import { ESLint, Linter } from "eslint"; //#region src/prettier-types.d.ts /** * Vendor types from Prettier so we don't rely on the dependency. */ type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>; type VendoredPrettierOptionsRequired = { /** * Specify the line length that the printer will wrap on. * @default 120 */ printWidth: number; /** * Specify the number of spaces per indentation-level. */ tabWidth: number; /** * Indent lines with tabs instead of spaces */ useTabs?: boolean; /** * Print semicolons at the ends of statements. */ semi: boolean; /** * Use single quotes instead of double quotes. */ singleQuote: boolean; /** * Use single quotes in JSX. */ jsxSingleQuote: boolean; /** * Print trailing commas wherever possible. */ trailingComma: 'none' | 'es5' | 'all'; /** * Print spaces between brackets in object literals. */ bracketSpacing: boolean; /** * Put the `>` of a multi-line HTML (HTML, XML, JSX, Vue, Angular) element at the end of the last line instead of being * alone on the next line (does not apply to self closing elements). */ bracketSameLine: boolean; /** * Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line. * @deprecated use bracketSameLine instead */ jsxBracketSameLine: boolean; /** * Format only a segment of a file. */ rangeStart: number; /** * Format only a segment of a file. * @default Number.POSITIVE_INFINITY */ rangeEnd: number; /** * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer. * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out. * @default "preserve" */ proseWrap: 'always' | 'never' | 'preserve'; /** * Include parentheses around a sole arrow function parameter. * @default "always" */ arrowParens: 'avoid' | 'always'; /** * Provide ability to support new languages to prettier. */ plugins: Array<string | ESLint.Plugin>; /** * How to handle whitespaces in HTML. * @default "css" */ htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore'; /** * Which end of line characters to apply. * @default "lf" */ endOfLine: 'auto' | 'lf' | 'crlf' | 'cr'; /** * Change when properties in objects are quoted. * @default "as-needed" */ quoteProps: 'as-needed' | 'consistent' | 'preserve'; /** * Whether or not to indent the code inside <script> and <style> tags in Vue files. * @default false */ vueIndentScriptAndStyle: boolean; /** * Enforce single attribute per line in HTML, XML, Vue and JSX. * @default false */ singleAttributePerLine: boolean; /** * How to handle whitespaces in XML. * @default "preserve" */ xmlQuoteAttributes: 'single' | 'double' | 'preserve'; /** * Whether to put a space inside the brackets of self-closing XML elements. * @default true */ xmlSelfClosingSpace: boolean; /** * Whether to sort attributes by key in XML elements. * @default false */ xmlSortAttributesByKey: boolean; /** * How to handle whitespaces in XML. * @default "ignore" */ xmlWhitespaceSensitivity: 'ignore' | 'strict' | 'preserve'; }; //#endregion //#region src/options.d.ts type TSConfigOptions = false | null | undefined | { disableTypeChecking?: boolean; }; type PrettierOptions = false | null | undefined | VendoredPrettierOptions; type TailwindOptions = false | null | undefined | { /** * @default 'tailwind.config.ts' */ configPath?: string; }; type ConfigOptions = { nextjs?: boolean | null; react?: boolean | null; typescript?: TSConfigOptions; tailwindcss?: TailwindOptions; ignores?: string[]; prettier?: PrettierOptions; } | undefined; //#endregion //#region src/factory.d.ts declare const nivalis: (options?: ConfigOptions, ...userConfigs: Linter.Config[]) => Promise<Linter.Config<Linter.RulesRecord>[]>; //#endregion //#region src/globs.d.ts declare const GLOB_MARKDOWN = "**/*.md"; declare const GLOB_ASTRO = "**/*.astro"; declare const GLOB_ASTRO_TS = "**/*.astro/*.ts"; declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)"; declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)"; declare const GLOB_SRC_TS = "**/*.?([cm])ts?(x)"; declare const GLOB_SRC_JS = "**/*.?([cm])js?(x)"; declare const GLOB_JS = "**/*.?([cm])js"; declare const GLOB_TS = "**/*.?([cm])ts"; declare const GLOB_REACT = "**/*.?([cm])?(j|t)sx"; declare const GLOB_JSX = "**/*.?([cm])jsx"; declare const GLOB_TSX = "**/*.?([cm])tsx"; declare const GLOB_YAML = "**/*.y?(a)ml"; declare const GLOB_TOML = "**/*.toml"; declare const GLOB_EXCLUDE: string[]; //#endregion export { GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_EXCLUDE, GLOB_JS, GLOB_JSX, GLOB_MARKDOWN, GLOB_REACT, GLOB_SRC, GLOB_SRC_EXT, GLOB_SRC_JS, GLOB_SRC_TS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_YAML, nivalis };