Skip to content

Instantly share code, notes, and snippets.

@NazCodeland
Last active December 7, 2025 19:40
Show Gist options
  • Select an option

  • Save NazCodeland/31ee981a69f31099cfbab312403f1fcc to your computer and use it in GitHub Desktop.

Select an option

Save NazCodeland/31ee981a69f31099cfbab312403f1fcc to your computer and use it in GitHub Desktop.
flat eslint config
import antfu from '@antfu/eslint-config'
import convex from '@convex-dev/eslint-plugin'
export default antfu(
{
// 1. Core Configuration
svelte: true,
stylistic: true, // Replaces Prettier
// Enable type-aware rules (Required for 'no-floating-promises')
typescript: {
tsconfigPath: 'tsconfig.json',
},
// Formatters (Since Prettier extension is gone)
formatters: {
css: true,
html: true,
markdown: 'prettier',
},
// 2. Ignores (Merged from your old config + .gitignore is read automatically)
ignores: [
'**/build',
'**/.svelte-kit',
'**/dist',
'**/convex/_generated',
'**/src/convex/_generated',
'**/src/lib/components/ui', // Keep ignoring shadcn/ui components if desired
],
},
// 3. General Rule Overrides
{
rules: {
// Antfu renames '@typescript-eslint' rules to 'ts'
'ts/no-explicit-any': 'off',
// Revert Antfu's aggressive "auto-remove unused imports" to your preferred "warn" style
'unused-imports/no-unused-imports': 'off',
'ts/no-unused-vars': [
'warn',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
],
},
},
// 4. Convex Plugin Integration
{
plugins: {
convex,
},
// Apply recommended convex rules
rules: {
...convex.configs.recommended.rules,
},
},
// 5. Convex Specific Rules (Ported from your old config)
{
files: ['convex/**/*.ts'],
rules: {
// Ensure promises are handled in DB functions
'ts/no-floating-promises': 'error',
// Your specific import restrictions for Convex
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['*/_generated/server'],
importNames: ['query', 'mutation', 'action'],
message: 'Use functions.ts for query, mutation, action',
},
],
},
],
},
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment