Configuration
Advanced oxlint configuration options
The examples use the Next.js preset, but the same patterns work with any preset.
Overrides
Use
overrides
when a rule should only change for specific files.
import next from "@octopus-energy/oxc/oxlint/nextjs";
import { defineConfig } from "oxlint";
export default defineConfig({
extends: [next],
overrides: [
{
files: ["**/*.test.ts", "**/*.test.tsx"],
rules: {
"typescript/no-explicit-any": "off",
},
},
],
});Ignore patterns
Use ignorePatterns
for generated output, build directories, and framework caches.
import next from "@octopus-energy/oxc/oxlint/nextjs";
import { defineConfig } from "oxlint";
export default defineConfig({
extends: [next],
ignorePatterns: ["**/node_modules/**", "**/.next/**", "**/dist/**"],
});Type-aware linting
Enable type-aware rules with
typeAware and typeCheck.
These rules catch more issues, but they need TypeScript project information and
may take longer to run.
import next from "@octopus-energy/oxc/oxlint/nextjs";
import { defineConfig } from "oxlint";
export default defineConfig({
extends: [next],
options: {
typeAware: true,
typeCheck: true,
},
});JSON config
This package exports
JSON configuration
files alongside the built JS files. oxlint currently
does not resolve package exports
in JSON extends, so reference the file through node_modules:
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": ["node_modules/@octopus-energy/oxc/oxlint/nextjs.json"]
}Speed up oxlint with JSON config
TypeScript configuration files need a Node.js instance to load, which adds a small startup cost. Use JSON configs if that overhead matters for your project.
JS plugins
oxlint includes many common plugins, but vendor-specific ESLint plugins can be
loaded through
jsPlugins. Install
any plugin listed in jsPlugins as a development dependency in the same
project.
import next from "@octopus-energy/oxc/oxlint/nextjs";
import { defineConfig } from "oxlint";
export default defineConfig({
extends: [next],
jsPlugins: ["eslint-plugin-turbo"],
rules: {
"turbo/no-undeclared-env-vars": "error",
},
overrides: [
{
files: ["**/app1/**/*.tsx"],
jsPlugins: ["eslint-plugin-turbo"],
rules: {
"turbo/no-undeclared-env-vars": "off",
},
},
],
});