45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import type { FlatESLintConfig } from '@aet/eslint-define-config';
|
|
import type { Linter } from 'eslint';
|
|
|
|
type MiddlewareResult = Linter.Config | Linter.Config[];
|
|
|
|
export type Middleware =
|
|
| (() => Promise<MiddlewareResult>)
|
|
| (() => Promise<{ default: MiddlewareResult }>);
|
|
|
|
/**
|
|
* Returns a ESLint config object.
|
|
*
|
|
* By default, it includes `["@typescript-eslint", "import-x", "prettier", "unicorn"]` configs.
|
|
* Additional bundled plugins include:
|
|
*
|
|
* 1. [`react`](https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules)
|
|
* (automatically enables
|
|
* [`react-hooks`](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks))
|
|
* 2. [`react-refresh`](https://github.com/ArnaudBarre/eslint-plugin-react-refresh)
|
|
* 3. [`jsx-a11y`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y#supported-rules)
|
|
* 4. [`unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn#rules)
|
|
* 5. [`n`](https://github.com/eslint-community/eslint-plugin-n#-rules) (Node.js specific,
|
|
* requires `minimatch`)
|
|
* 6. [`jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc#rules)
|
|
*
|
|
* Non bundled:
|
|
* 1. [`graphql`](https://the-guild.dev/graphql/eslint/rules)
|
|
*
|
|
* @param of Configuration options.
|
|
* @returns ESLint configuration object.
|
|
*/
|
|
export function extendConfig({
|
|
auto,
|
|
middlewares: addMiddlewares,
|
|
configs,
|
|
}: {
|
|
auto?: boolean;
|
|
middlewares?: Middleware[];
|
|
configs: FlatESLintConfig[];
|
|
}): Promise<FlatESLintConfig[]>;
|
|
|
|
export const error = 'error';
|
|
export const warn = 'warn';
|
|
export const off = 'off';
|