- Debian-based api image (bookworm-slim), docker/debian mirrors, prisma binaryTargets for openssl 3.0 - nginx: admin SPA under /admin, TLS via acme.sh (ZeroSSL) + auto-renewal cron, http->https redirect - prisma: add origin_goods.delisted migration, sync missing schema (good_image/tag_font_color/good_tags), fix users.createdAt Timestamptz - api: CORS wildcard reflection, helmet CORP cross-origin, price backfill in persistProductDetail, categoryIcon ancestor fallback, mediaByColor per-color gallery in public goods detail - admin: /admin base path (vite + router) - import-data.mjs: udt_name casting, serial sequence advance fix
3.3 KiB
3.3 KiB
@antfu/eslint-config
Flat ESLint config that handles both linting and formatting - replaces Prettier.
Setup
pnpm add -D eslint @antfu/eslint-config
// eslint.config.mjs
import antfu from '@antfu/eslint-config'
export default antfu()
{ "scripts": { "lint": "eslint ." } }
Configuration Options
import antfu from '@antfu/eslint-config'
export default antfu({
type: 'lib', // 'lib' for libraries, 'app' for applications
ignores: ['**/fixtures', '**/dist'],
stylistic: { indent: 2, quotes: 'single' },
typescript: true, // Auto-detected
vue: true, // Auto-detected
})
Framework Support
| Framework | Option | Required Package |
|---|---|---|
| Vue | vue: true |
(auto-detected) |
| React | react: true |
@eslint-react/eslint-plugin eslint-plugin-react-hooks |
| Next.js | nextjs: true |
@next/eslint-plugin-next |
| Svelte | svelte: true |
eslint-plugin-svelte |
| Astro | astro: true |
eslint-plugin-astro |
| Solid | solid: true |
eslint-plugin-solid |
| UnoCSS | unocss: true |
@unocss/eslint-plugin |
Formatters (CSS, HTML, Markdown)
For files ESLint doesn't handle natively:
export default antfu({
formatters: {
css: true, // Prettier for CSS/LESS/SCSS
html: true, // Prettier for HTML
markdown: 'prettier' // or 'dprint'
}
})
// Requires: pnpm add -D eslint-plugin-format
Rule Overrides
Global
export default antfu(
{ /* config options */ },
{ rules: { 'style/semi': ['error', 'never'] } }
)
Per-integration
export default antfu({
vue: { overrides: { 'vue/operator-linebreak': ['error', 'before'] } },
typescript: { overrides: { 'ts/consistent-type-definitions': ['error', 'interface'] } },
})
Plugin Prefix Renaming
| New Prefix | Original |
|---|---|
ts/* |
@typescript-eslint/* |
style/* |
@stylistic/* |
import/* |
import-lite/* |
node/* |
n/* |
test/* |
vitest/* |
// eslint-disable-next-line ts/consistent-type-definitions
Type-Aware Rules
export default antfu({
typescript: { tsconfigPath: 'tsconfig.json' },
})
VS Code Settings
{
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.organizeImports": "never" },
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true }
],
"eslint.validate": ["javascript", "typescript", "vue", "html", "markdown", "json", "yaml"]
}