import antfu, { OptionsConfig, TypedFlatConfigItem, ConfigNames } from '@antfu/eslint-config'; import { FlatConfigComposer } from 'eslint-flat-config-utils'; import { Linter } from 'eslint'; interface NextOptions { /** * Enable the core web vitals rules. * @see https://nextjs.org/docs/app/building-your-application/configuring/eslint#core-web-vitals * @default true */ webVitals?: boolean; } /* eslint-disable */ /* prettier-ignore */ declare module 'eslint' { namespace Linter { interface RulesRecord extends RuleOptions {} } } interface RuleOptions { /** * Enforce font-display behavior with Google Fonts. * @see https://nextjs.org/docs/messages/google-font-display */ '@next/next/google-font-display'?: Linter.RuleEntry<[]> /** * Ensure `preconnect` is used with Google Fonts. * @see https://nextjs.org/docs/messages/google-font-preconnect */ '@next/next/google-font-preconnect'?: Linter.RuleEntry<[]> /** * Enforce `id` attribute on `next/script` components with inline content. * @see https://nextjs.org/docs/messages/inline-script-id */ '@next/next/inline-script-id'?: Linter.RuleEntry<[]> /** * Prefer `next/script` component when using the inline script for Google Analytics. * @see https://nextjs.org/docs/messages/next-script-for-ga */ '@next/next/next-script-for-ga'?: Linter.RuleEntry<[]> /** * Prevent assignment to the `module` variable. * @see https://nextjs.org/docs/messages/no-assign-module-variable */ '@next/next/no-assign-module-variable'?: Linter.RuleEntry<[]> /** * Prevent client components from being async functions. * @see https://nextjs.org/docs/messages/no-async-client-component */ '@next/next/no-async-client-component'?: Linter.RuleEntry<[]> /** * Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`. * @see https://nextjs.org/docs/messages/no-before-interactive-script-outside-document */ '@next/next/no-before-interactive-script-outside-document'?: Linter.RuleEntry<[]> /** * Prevent manual stylesheet tags. * @see https://nextjs.org/docs/messages/no-css-tags */ '@next/next/no-css-tags'?: Linter.RuleEntry<[]> /** * Prevent importing `next/document` outside of `pages/_document.js`. * @see https://nextjs.org/docs/messages/no-document-import-in-page */ '@next/next/no-document-import-in-page'?: Linter.RuleEntry<[]> /** * Prevent duplicate usage of `` in `pages/_document.js`. * @see https://nextjs.org/docs/messages/no-duplicate-head */ '@next/next/no-duplicate-head'?: Linter.RuleEntry<[]> /** * Prevent usage of `` element. * @see https://nextjs.org/docs/messages/no-head-element */ '@next/next/no-head-element'?: Linter.RuleEntry<[]> /** * Prevent usage of `next/head` in `pages/_document.js`. * @see https://nextjs.org/docs/messages/no-head-import-in-document */ '@next/next/no-head-import-in-document'?: Linter.RuleEntry<[]> /** * Prevent usage of `` elements to navigate to internal Next.js pages. * @see https://nextjs.org/docs/messages/no-html-link-for-pages */ '@next/next/no-html-link-for-pages'?: Linter.RuleEntry /** * Prevent usage of `` element due to slower LCP and higher bandwidth. * @see https://nextjs.org/docs/messages/no-img-element */ '@next/next/no-img-element'?: Linter.RuleEntry<[]> /** * Prevent page-only custom fonts. * @see https://nextjs.org/docs/messages/no-page-custom-font */ '@next/next/no-page-custom-font'?: Linter.RuleEntry<[]> /** * Prevent usage of `next/script` in `next/head` component. * @see https://nextjs.org/docs/messages/no-script-component-in-head */ '@next/next/no-script-component-in-head'?: Linter.RuleEntry<[]> /** * Prevent usage of `styled-jsx` in `pages/_document.js`. * @see https://nextjs.org/docs/messages/no-styled-jsx-in-document */ '@next/next/no-styled-jsx-in-document'?: Linter.RuleEntry<[]> /** * Prevent synchronous scripts. * @see https://nextjs.org/docs/messages/no-sync-scripts */ '@next/next/no-sync-scripts'?: Linter.RuleEntry<[]> /** * Prevent usage of `` with `Head` component from `next/document`. * @see https://nextjs.org/docs/messages/no-title-in-document-head */ '@next/next/no-title-in-document-head'?: Linter.RuleEntry<[]> /** * Prevent common typos in Next.js data fetching functions. */ '@next/next/no-typos'?: Linter.RuleEntry<[]> /** * Prevent duplicate polyfills from Polyfill.io. * @see https://nextjs.org/docs/messages/no-unwanted-polyfillio */ '@next/next/no-unwanted-polyfillio'?: Linter.RuleEntry<[]> /** * Enforce a consistent and logical order of the Tailwind CSS classnames * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/classnames-order.md */ 'tailwindcss/classnames-order'?: Linter.RuleEntry<TailwindcssClassnamesOrder> /** * Warns about dash prefixed classnames using arbitrary values * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-negative-arbitrary-values.md */ 'tailwindcss/enforces-negative-arbitrary-values'?: Linter.RuleEntry<TailwindcssEnforcesNegativeArbitraryValues> /** * Enforces the usage of shorthand Tailwind CSS classnames * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-shorthand.md */ 'tailwindcss/enforces-shorthand'?: Linter.RuleEntry<TailwindcssEnforcesShorthand> /** * Detect obsolete classnames when upgrading to Tailwind CSS v3 * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/migration-from-tailwind-2.md */ 'tailwindcss/migration-from-tailwind-2'?: Linter.RuleEntry<TailwindcssMigrationFromTailwind2> /** * Forbid using arbitrary values in classnames * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-arbitrary-value.md */ 'tailwindcss/no-arbitrary-value'?: Linter.RuleEntry<TailwindcssNoArbitraryValue> /** * Avoid contradicting Tailwind CSS classnames (e.g. "w-3 w-5") * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-contradicting-classname.md */ 'tailwindcss/no-contradicting-classname'?: Linter.RuleEntry<TailwindcssNoContradictingClassname> /** * Detect classnames which do not belong to Tailwind CSS * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-custom-classname.md */ 'tailwindcss/no-custom-classname'?: Linter.RuleEntry<TailwindcssNoCustomClassname> /** * Forbid using arbitrary values in classnames when an equivalent preset exists * @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-unnecessary-arbitrary-value.md */ 'tailwindcss/no-unnecessary-arbitrary-value'?: Linter.RuleEntry<TailwindcssNoUnnecessaryArbitraryValue> } /* ======= Declarations ======= */ // ----- @next/next/no-html-link-for-pages ----- type NextNextNoHtmlLinkForPages = []|[(string | string[])] // ----- tailwindcss/classnames-order ----- type TailwindcssClassnamesOrder = []|[{ callees?: string[] ignoredKeys?: string[] config?: (string | { [k: string]: unknown | undefined }) removeDuplicates?: boolean tags?: string[] [k: string]: unknown | undefined }] // ----- tailwindcss/enforces-negative-arbitrary-values ----- type TailwindcssEnforcesNegativeArbitraryValues = []|[{ callees?: string[] ignoredKeys?: string[] config?: (string | { [k: string]: unknown | undefined }) tags?: string[] [k: string]: unknown | undefined }] // ----- tailwindcss/enforces-shorthand ----- type TailwindcssEnforcesShorthand = []|[{ callees?: string[] ignoredKeys?: string[] config?: (string | { [k: string]: unknown | undefined }) tags?: string[] [k: string]: unknown | undefined }] // ----- tailwindcss/migration-from-tailwind-2 ----- type TailwindcssMigrationFromTailwind2 = []|[{ callees?: string[] ignoredKeys?: string[] config?: (string | { [k: string]: unknown | undefined }) tags?: string[] [k: string]: unknown | undefined }] // ----- tailwindcss/no-arbitrary-value ----- type TailwindcssNoArbitraryValue = []|[{ callees?: string[] ignoredKeys?: string[] config?: (string | { [k: string]: unknown | undefined }) tags?: string[] [k: string]: unknown | undefined }] // ----- tailwindcss/no-contradicting-classname ----- type TailwindcssNoContradictingClassname = []|[{ callees?: string[] ignoredKeys?: string[] config?: (string | { [k: string]: unknown | undefined }) tags?: string[] [k: string]: unknown | undefined }] // ----- tailwindcss/no-custom-classname ----- type TailwindcssNoCustomClassname = []|[{ callees?: string[] ignoredKeys?: string[] config?: (string | { [k: string]: unknown | undefined }) cssFiles?: string[] cssFilesRefreshRate?: number tags?: string[] whitelist?: string[] [k: string]: unknown | undefined }] // ----- tailwindcss/no-unnecessary-arbitrary-value ----- type TailwindcssNoUnnecessaryArbitraryValue = []|[{ callees?: string[] ignoredKeys?: string[] config?: (string | { [k: string]: unknown | undefined }) tags?: string[] [k: string]: unknown | undefined }] type TailwindSettings = NonNullable<TailwindcssEnforcesShorthand>[0]; interface TailwindOptions { settings?: TailwindSettings; } type Options = { next?: NextOptions | boolean; tailwind?: TailwindOptions | boolean; } & Omit<OptionsConfig, "lessOpinionated" | "overrides" | "unicorn"> & Omit<TypedFlatConfigItem, "files">; type Composer = FlatConfigComposer<TypedFlatConfigItem, ConfigNames>; /** * This function * * @returns A flat ESLint configuration, export this in your `eslint.config.{js,mjs}` file. */ declare function configure(options?: Options, ...configs: Array<Parameters<typeof antfu>[1]>): Composer; declare const configs: { /** * For backwards compatibility. * * @deprecated * It is recommended to use {@link configure()} instead for complex configurations. */ readonly recommended: Composer; }; export { type Composer, type Options, configs, configure };