The @zayne-labs/eslint-config package exports individual config functions that can be used directly if you prefer more granular control over your ESLint configuration.
Core Configs
javascript()
Core JavaScript ESLint configuration with recommended rules.
import { javascript } from "@zayne-labs/eslint-config" ;
export default [
... await javascript ({
overrides: {
"no-console" : "warn" ,
} ,
}),
] ;
overrides
Record<string, RuleEntry>
Override specific JavaScript rule configurations.
Key Features:
ECMAScript latest with module support
Browser and Node.js globals
Strict error detection rules
Enforces modern JavaScript patterns
Complexity limits (max depth: 2, complexity: 50)
Notable Rules:
no-console: Error (allows warn, error, info, trace)
prefer-const: Error with destructuring support
no-var: Error
eqeqeq: Error (always, except for null)
curly: Error (multi-line)
typescript()
TypeScript ESLint configuration with optional type-aware rules.
import { typescript } from "@zayne-labs/eslint-config" ;
export default [
... await typescript ({
tsconfigPath: "./tsconfig.json" ,
isTypeAware: true ,
stylistic: true ,
}),
] ;
tsconfigPath
true | string | string[] | null
default: "true"
Path to tsconfig.json for type-aware rules. Set to true for auto-discovery.
Enable type-aware rules. Automatically true if tsconfigPath is provided.
files
string[]
default: "['**/*.ts', '**/*.tsx', ...componentExts]"
Glob patterns for TypeScript files.
Glob patterns for type-aware files.
ignoresTypeAware
string[]
default: "['**/*.md/**', '**/*.astro/*.ts']"
Patterns to exclude from type checking.
Additional component file extensions (e.g., ['vue']).
Component extensions that should be type-aware.
Enable erasable syntax only rules from eslint-plugin-erasable-syntax-only.
Enable TypeScript stylistic rules.
allowDefaultProject
string[]
default: "undefined"
Default projects to allow in the parser project service (max 8).
Additional TypeScript parser options.
overrides
Record<string, RuleEntry>
Override specific TypeScript rule configurations.
Key Features:
Strict or strict-type-checked presets
Type-aware rules when tsconfig provided
Stylistic TypeScript rules
Component extension support
Notable Rules:
ts-eslint/consistent-type-definitions: Type aliases preferred
ts-eslint/array-type: Array-simple style
ts-eslint/no-unused-vars: Warning with underscore prefix support
ts-eslint/prefer-nullish-coalescing: Error (ignores conditional tests)
ts-eslint/no-import-type-side-effects: Error
jsx()
JSX-specific linting rules with optional accessibility support.
import { jsx } from "@zayne-labs/eslint-config" ;
export default [
... await jsx ({
a11y: true ,
}),
] ;
a11y
boolean | object
default: "false"
Enable JSX accessibility rules. Requires eslint-plugin-jsx-a11y. When passing an object:
overrides: Override specific a11y rule configurations
overrides
Record<string, RuleEntry>
Override specific JSX rule configurations.
ignores()
Configure global ignore patterns.
import { ignores } from "@zayne-labs/eslint-config" ;
export default [
... ignores ([ "dist" , "build" , ".cache" ]),
] ;
patterns
string[] | ((originals: string[]) => string[])
Ignore patterns to add, or a function to transform the default patterns.
gitIgnores()
Automatically use .gitignore patterns for ESLint.
import { gitIgnores } from "@zayne-labs/eslint-config" ;
export default [
... await gitIgnores (),
] ;
Framework Configs
react()
Comprehensive React linting with hooks, compiler, and refresh support.
import { react } from "@zayne-labs/eslint-config" ;
export default [
... await react ({
typescript: true ,
compiler: true ,
refresh: true ,
nextjs: true ,
}),
] ;
react
boolean | object
default: "true"
Enable default React rules from @eslint-react/eslint-plugin. When passing an object:
overrides: Override specific React rule configurations
compiler
boolean | object
default: "true"
Enable React compiler rules for optimization. When passing an object:
overrides: Override specific compiler rule configurations
refresh
boolean | object
default: "true"
Enable react-refresh/HMR rules. When passing an object:
overrides: Override specific refresh rule configurations
youMightNotNeedAnEffect
boolean | object
default: "true"
Enable rules to avoid unnecessary useEffect usage. When passing an object:
overrides: Override specific rule configurations
nextjs
boolean | object
default: "auto-detect"
Enable Next.js specific rules. Auto-detects if Next.js is installed. When passing an object:
overrides: Override specific Next.js rule configurations
Enable TypeScript support for React files.
files
string[]
default: "['src/**/*']"
Glob patterns for React files.
filesTypeAware
string[]
default: "['**/*.ts', '**/*.tsx']"
Patterns for type-aware React files.
ignoresTypeAware
string[]
default: "['**/*.md/**', '**/*.astro/*.ts']"
Patterns to exclude from type checking.
overrides
Record<string, RuleEntry>
Override specific React rule configurations.
Required Plugins:
@eslint-react/eslint-plugin
eslint-plugin-react-hooks
eslint-plugin-react-refresh
eslint-plugin-react-you-might-not-need-an-effect
@next/eslint-plugin-next (if Next.js is used)
vue()
Vue 2/3 linting with SFC block support.
import { vue } from "@zayne-labs/eslint-config" ;
export default [
... await vue ({
vueVersion: 3 ,
typescript: true ,
stylistic: true ,
}),
] ;
Vue version to apply appropriate rule sets.
sfcBlocks
boolean | VueBlocksOptions
default: "true"
Enable linting for Vue SFC blocks using eslint-processor-vue-blocks.
Enable TypeScript support for Vue files.
Enable Vue stylistic rules.
overrides
Record<string, RuleEntry>
Override specific Vue rule configurations.
solid()
SolidJS linting support.
import { solid } from "@zayne-labs/eslint-config" ;
export default [
... await solid ({
typescript: true ,
}),
] ;
Enable TypeScript support for Solid files.
Glob patterns for Solid files.
overrides
Record<string, RuleEntry>
Override specific Solid rule configurations.
astro()
Astro framework linting.
import { astro } from "@zayne-labs/eslint-config" ;
export default [
... await astro ({
typescript: true ,
}),
] ;
Enable TypeScript support for Astro files.
Glob patterns for Astro files.
overrides
Record<string, RuleEntry>
Override specific Astro rule configurations.
stylistic()
Stylistic formatting rules via @stylistic/eslint-plugin.
import { stylistic } from "@zayne-labs/eslint-config" ;
export default [
... await stylistic ({
indent: 2 ,
quotes: "single" ,
jsx: true ,
}),
] ;
Number of spaces for indentation.
quotes
'single' | 'double' | 'backtick'
default: "'single'"
Quote style preference.
Enable JSX-specific stylistic rules.
overrides
Record<string, RuleEntry>
Override specific stylistic rule configurations.
perfectionist()
Sorting and ordering rules via eslint-plugin-perfectionist.
import { perfectionist } from "@zayne-labs/eslint-config" ;
export default [
... await perfectionist ({
overrides: {
"perfectionist/sort-imports" : "error" ,
} ,
}),
] ;
overrides
Record<string, RuleEntry>
Override specific perfectionist rule configurations.
jsonc()
JSON/JSONC linting support.
import { jsonc } from "@zayne-labs/eslint-config" ;
export default [
... await jsonc (),
] ;
sortPackageJson()
Automatically sort package.json files.
import { sortPackageJson } from "@zayne-labs/eslint-config" ;
export default [
... sortPackageJson (),
] ;
sortTsconfig()
Automatically sort tsconfig.json files.
import { sortTsconfig } from "@zayne-labs/eslint-config" ;
export default [
... sortTsconfig (),
] ;
yaml()
YAML linting support.
import { yaml } from "@zayne-labs/eslint-config" ;
export default [
... await yaml ({ stylistic: true }),
] ;
toml()
TOML linting support.
import { toml } from "@zayne-labs/eslint-config" ;
export default [
... await toml ({ stylistic: true }),
] ;
markdown()
Markdown code block linting.
import { markdown } from "@zayne-labs/eslint-config" ;
export default [
... await markdown ({ componentExts: [ "vue" ] }),
] ;
Code Quality
imports()
Import/export linting rules.
import { imports } from "@zayne-labs/eslint-config" ;
export default [
... await imports ({
typescript: true ,
stylistic: true ,
}),
] ;
node()
Node.js specific rules with optional security.
import { node } from "@zayne-labs/eslint-config" ;
export default [
... await node ({
type: "app" ,
security: true ,
}),
] ;
unicorn()
eslint-plugin-unicorn rules for code quality.
import { unicorn } from "@zayne-labs/eslint-config" ;
export default [
... await unicorn ({ type: "lib" }),
] ;
jsdoc()
JSDoc linting and validation.
import { jsdoc } from "@zayne-labs/eslint-config" ;
export default [
... await jsdoc ({ stylistic: true }),
] ;
ESLint comment directive validation.
import { comments } from "@zayne-labs/eslint-config" ;
export default [
... await comments ({ type: "app" }),
] ;
Utility Configs
pnpm()
pnpm workspace and catalogs support.
import { pnpm } from "@zayne-labs/eslint-config" ;
export default [
... await pnpm ({
catalogs: true ,
sort: true ,
}),
] ;
expo()
Expo-specific rules.
import { expo } from "@zayne-labs/eslint-config" ;
export default [
... await expo (),
] ;
tanstack()
TanStack Query and Router linting.
import { tanstack } from "@zayne-labs/eslint-config" ;
export default [
... await tanstack ({
query: true ,
router: true ,
}),
] ;
tailwindcssBetter()
Tailwind CSS class name linting.
import { tailwindcssBetter } from "@zayne-labs/eslint-config" ;
export default [
... await tailwindcssBetter ({
settings: {
callees: [ "cn" , "clsx" ],
} ,
}),
] ;
depend()
Dependency management rules.
import { depend } from "@zayne-labs/eslint-config" ;
export default [
... await depend (),
] ;
Usage Example
Combine individual configs for full control:
import {
javascript ,
typescript ,
react ,
stylistic ,
imports ,
jsonc ,
} from "@zayne-labs/eslint-config" ;
export default [
... await javascript (),
... await typescript ({
tsconfigPath: "./tsconfig.json" ,
isTypeAware: true ,
}),
... await react ({
nextjs: true ,
compiler: true ,
}),
... await stylistic ({
indent: 2 ,
quotes: "single" ,
jsx: true ,
}),
... await imports ({
typescript: true ,
stylistic: true ,
}),
... await jsonc (),
{
files: [ "**/*.tsx" ] ,
rules: {
"react-x/no-clone-element" : "error" ,
} ,
},
] ;