Overview
JS Style Kit provides a comprehensive ESLint configuration using the modern ESLint v9 flat config format. This configuration includes sensible defaults for JavaScript and TypeScript projects, with optional support for React, testing frameworks, and code organization.Basic Setup
Create aneslint.config.js
file in your project root:
eslint.config.mjs
file instead:
package.json
:
Configuration Options
TheeslintConfig()
function accepts a configuration object with the following options:
Function Style Configuration
Controls how functions should be written throughout your codebase. Some configurations are auto-fixable, but some may require manual adjustment.TypeScript Configuration
TypeScript support is enabled by default. You can:Import Plugin Configuration
The import plugin rules are enabled by default. These rules help maintain proper import/export syntax and detect issues with imports.Custom Rules Configuration
You can override or configure specific ESLint rules using therules
option:
React Configuration
React support is disabled by default.JSDoc Configuration
JSDoc validation is enabled by default, but requirement rules are off:Sorting Configuration
Code organization rules from Perfectionist are enabled by default:Testing Configuration
Testing support is enabled by default with Vitest configuration. You can customize it or disable it entirely:Storybook Configuration
Storybook support is disabled by default.Additional Rules
Adding Ignores
By default, JS Style Kit ignoresnode_modules
and dist
directories. You can add additional paths to ignore:
Custom ESLint Configurations
You can extend the base configuration by providing additional ESLint config objects as rest parameters:Migrating from ESLint Legacy Config
If you’re coming from a legacy ESLint configuration (.eslintrc.js
or other formats), you’ll need to adapt to the new flat config format. Here are some key differences:
- The configuration file is now named
eslint.config.js
oreslint.config.mjs
- The format is different, using an array of configuration objects rather than a nested object
- Plugins, parsers, and other extensions are imported directly rather than being referenced by string names