Skip to content

Instantly share code, notes, and snippets.

@fubits1
Last active April 27, 2026 22:46
Show Gist options
  • Select an option

  • Save fubits1/63385040dff3faca5306479d021e74f1 to your computer and use it in GitHub Desktop.

Select an option

Save fubits1/63385040dff3faca5306479d021e74f1 to your computer and use it in GitHub Desktop.
Oxlint + Svelte via Eslint (as of 2026-04-27; oxlint v1.62.0) for Svelte Vite SPA
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "unicorn"],
"jsPlugins": ["@e18e/eslint-plugin", "eslint-plugin-depend"],
"options": { "typeAware": true },
"categories": {
"correctness": "error"
},
"ignorePatterns": ["**/*.svelte", "public/mockServiceWorker.js"],
"rules": {
"e18e/prefer-array-at": "error",
"e18e/prefer-array-fill": "error",
"e18e/prefer-includes": "error",
"e18e/prefer-array-to-reversed": "error",
"e18e/prefer-array-to-sorted": "error",
"e18e/prefer-array-to-spliced": "error",
"e18e/prefer-nullish-coalescing": "error",
"e18e/prefer-object-has-own": "error",
"e18e/prefer-spread-syntax": "error",
"e18e/prefer-url-canparse": "error",
"e18e/ban-dependencies": "error",
"e18e/prefer-array-from-map": "error",
"e18e/prefer-timer-args": "error",
"e18e/prefer-date-now": "error",
"e18e/prefer-regex-test": "error",
"e18e/prefer-array-some": "error",
"e18e/prefer-static-regex": "error",
"depend/ban-dependencies": "error",
"no-case-declarations": "error",
"no-empty": "error",
"no-fallthrough": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-array-constructor": "error",
"preserve-caught-error": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-empty-object-type": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unnecessary-type-constraint": "error",
"@typescript-eslint/no-unsafe-function-type": "error",
"@typescript-eslint/prefer-find": "error",
"@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/prefer-regexp-exec": "error"
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
"rules": {
"no-var": "error",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error"
}
}
]
}
// For more info, see https://github.com/storybookjs/storybook/tree/next/code/lib/eslint-plugin#configuration-eslintrc
import storybook from 'eslint-plugin-storybook'
import depend from 'eslint-plugin-depend'
import e18e from '@e18e/eslint-plugin'
import prettier from 'eslint-config-prettier'
import { fileURLToPath } from 'node:url'
import { includeIgnoreFile } from '@eslint/compat'
import js from '@eslint/js'
import svelte from 'eslint-plugin-svelte'
import { defineConfig } from 'eslint/config'
import globals from 'globals'
import ts from 'typescript-eslint'
import svelteConfig from './svelte.config.js'
import oxlint from 'eslint-plugin-oxlint'
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url))
const tsJsFiles = ['**/*.ts', '**/*.js', '**/*.mts', '**/*.cts']
export default defineConfig(
includeIgnoreFile(gitignorePath),
e18e.configs.recommended,
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs.recommended,
...storybook.configs['flat/recommended'],
prettier,
...svelte.configs.prettier,
{
plugins: { depend },
rules: depend.configs.recommended.rules
},
{
languageOptions: { globals: { ...globals.browser, ...globals.node } },
rules: {
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
'no-undef': 'off',
'svelte/no-at-html-tags': 'off' /* FIXME: undo when done fixing errors */
}
},
{
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
languageOptions: {
parserOptions: {
projectService: true,
extraFileExtensions: ['.svelte'],
parser: ts.parser,
svelteConfig
}
}
},
// oxlint handles core JS/TS rules on .ts/.js (incl. .svelte.ts/.svelte.js) — disable overlapping ESLint rules there
// skips config[0] (ignorePatterns); .svelte stays oxlint-ignored, so ESLint keeps full rule set on .svelte
...oxlint
.buildFromOxlintConfigFile('.oxlintrc.json')
.slice(1)
.map((config) => ({
...config,
files: config.files ?? tsJsFiles,
ignores: [...(config.ignores ?? []), '**/*.svelte']
})),
// oxlint runs e18e + depend via jsPlugins on .ts/.js (incl. .svelte.ts/.svelte.js) — disable in ESLint to avoid double-reporting
// (eslint-plugin-oxlint doesn't auto-sync jsPlugins yet)
{
files: tsJsFiles,
ignores: ['**/*.svelte'],
rules: {
...Object.fromEntries(
Object.keys(e18e.configs.recommended.rules || {}).map((r) => [r, 'off'])
),
...Object.fromEntries(
Object.keys(depend.configs.recommended.rules || {}).map((r) => [r, 'off'])
)
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment