# @icebreakers/eslint-config - [简体中文指南](./README.zh.md) ## Overview `@icebreakers/eslint-config` extends the `@antfu/eslint-config` flat presets and layers extra rules for Tailwind CSS, MDX, Vue accessibility, and Icebreaker specific TypeScript defaults. It returns a `FlatConfigComposer`, so you can opt into only the presets you need and keep adding workspace specific overrides. ## Requirements - Node.js `^22.23.4 || ^24.22.1 || >=26.12.1` (24.22.1 LTS recommended) - ESLint 9 with flat config support - React core plugins are bundled with this package. Next.js, Query, accessibility, Astro, Svelte, and other ecosystem presets remain optional and are skipped automatically when their plugins are missing. - Wevu compatibility checks are bundled and require no additional install. Install optional plugins when you turn on Tailwind (`eslint-plugin-tailwindcss` or `eslint-plugin-better-tailwindcss`), MDX (`eslint-plugin-mdx`), UnoCSS (`@unocss/eslint-plugin`), the Stylelint bridge (`eslint-plugin-better-stylelint`), React accessibility (`eslint-plugin-jsx-a11y`), Vue accessibility (`eslint-plugin-vuejs-accessibility` plus its `globals` peer), Astro (`eslint-plugin-astro` and `astro-eslint-parser`), or Svelte (`eslint-plugin-svelte`, `svelte-eslint-parser`, and `svelte`). XML/SVG formatting needs `@prettier/plugin-xml`; Astro formatting needs `prettier-plugin-astro`. ## Installation ```bash pnpm add -D eslint @icebreakers/eslint-config ``` ## Quick Start Create `eslint.config.ts` (or `.mjs`) in your project root: ```ts import { icebreaker } from '@icebreakers/eslint-config' export default icebreaker() ``` Run ESLint via your package manager: ```bash pnpm eslint "src/**/*.ts" ``` If you need the legacy array config, call `icebreakerLegacy()` instead. ## Enabling Presets Each optional preset mirrors the flags in `@antfu/eslint-config` and adds Icebreaker tweaks: ```ts import { icebreaker } from '@icebreakers/eslint-config' export default icebreaker({ vue: true, // or { vueVersion: 2 } react: true, query: true, typescript: true, test: true, tailwindcss: true, betterTailwindcss: { entryPoint: './src/tailwind.css', rules: 'recommended', }, unocss: { strict: true, }, mdx: process.env.LINT_MDX === 'true', a11y: true, nestjs: true, ionic: true, miniProgram: true, formatters: true, }) ``` - `miniProgram` – injects Mini Program globals, ignores common outputs/config files, enables Vue-side Mini Program compatibility tweaks when `vue` is on, and loads the bundled `@weapp-vite/eslint` compatibility checks. - `vue` – enables Vue + optionally version specific overrides (Vue 2/3) and ionic/miniProgram adjustments. - `react` – defers to the upstream React preset. The required React core lint plugins are bundled with this package; React accessibility still requires `eslint-plugin-jsx-a11y` when `a11y` is enabled. - `query` – toggles the TanStack Query plugin (`@tanstack/eslint-plugin-query`) and its recommended lint rules. Missing plugin installs are treated as a no-op. - `tailwindcss` – pass `true` to enable `eslint-plugin-tailwindcss`. - `betterTailwindcss` – pass `true` or `{ entryPoint, tailwindConfig }` to enable `eslint-plugin-better-tailwindcss` for Tailwind v4/v3 projects. Object mode defaults to fast syntax checks (`no-duplicate-classes` and `no-unnecessary-whitespace`) and scopes relative entry points to their source directory; set `rules: 'recommended'` to opt into the full recommended preset. - `unocss` – pass `true` to use the upstream Antfu UnoCSS preset, or provide `{ strict, attributify, configPath }` to keep the same preset while using the Icebreaker wrapper API. - `mdx` – activates MDX linting via `eslint-plugin-mdx`. - `astro` – enables the upstream Astro preset. Install `eslint-plugin-astro` and `astro-eslint-parser`; missing installs are skipped. - `svelte` – enables the upstream Svelte preset. Install `eslint-plugin-svelte`, `svelte-eslint-parser`, and `svelte`; missing installs are skipped. - `stylelint` – bridges Stylelint diagnostics into ESLint for `*.css`, `*.scss`, and Vue `