Created
March 10, 2026 12:11
-
-
Save fubits1/63385040dff3faca5306479d021e74f1 to your computer and use it in GitHub Desktop.
Oxlint + Svelte via Eslint (as of 2026-03)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "$schema": "./node_modules/oxlint/configuration_schema.json", | |
| "plugins": ["typescript", "unicorn"], | |
| "categories": { | |
| "correctness": "error" | |
| }, | |
| "ignorePatterns": ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"], | |
| "rules": { | |
| "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" | |
| }, | |
| "overrides": [ | |
| { | |
| "files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], | |
| "rules": { | |
| "no-var": "error", | |
| "prefer-const": "error", | |
| "prefer-rest-params": "error", | |
| "prefer-spread": "error" | |
| } | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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' | |
| } | |
| }, | |
| { | |
| 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 — disable overlapping ESLint rules there | |
| // skips config[0] (ignorePatterns) so ESLint still lints .svelte/.svelte.ts files with all rules | |
| ...oxlint | |
| .buildFromOxlintConfigFile('.oxlintrc.json') | |
| .slice(1) | |
| .map((config) => ({ | |
| ...config, | |
| files: config.files ?? tsJsFiles, | |
| ignores: [...(config.ignores ?? []), '**/*.svelte.ts', '**/*.svelte.js'] | |
| })) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment