Shared ESLint configurations for different environments and technology stacks with utilities for configuration customization.
9️⃣ Requires ESLint v9+ ("flat config" format).
This package includes a curated set of ESLint-related dependencies:
@eslint/js
typescript-eslint
eslint-plugin-unicorn
eslint-plugin-n
eslint-plugin-jsdoc
eslint-config-prettier
globals
Installing @simbo/eslint-config
automatically includes these dependencies —
you do not need to add them separately.
Install ESLint and @simbo/eslint-config
from the npm registry:
npm i -D eslint @simbo/eslint-config
Add one or more configurations to your eslint configuration file (e.g.
eslint.config.ts
).
See examples below, or consult the API reference.
Inspect and debug your configuration with the ESLint Config
Inspector:
npx @eslint/config-inspector@latest --config=./eslint.config.ts
All configuration exports are ConfigsRecord
objects.
A ConfigsRecord
provides the following environments and variations:
import type { Linter } from 'eslint';
interface ConfigsRecord {
node: {
recommended: Linter.Config[]; // Recommended for Node.js projects
};
browser: {
recommended: Linter.Config[]; // Recommended for browser projects
};
}
⭐️ Use the all-in-one configs
export, which combines all configuration
supersets:
import { configs } from '@simbo/eslint-config';
Each of the following supersets extends curated third-party configurations:
Superset of @eslint/js
Exported as eslintJsConfigs
import { eslintJsConfigs } from '@simbo/eslint-config/eslint-js';
Superset of typescript-eslint
Exported as typescriptEslintConfigs
import { typescriptEslintConfigs } from '@simbo/eslint-config/typescript-eslint';
Superset of eslint-plugin-unicorn
Exported as unicornConfigs
import { unicornConfigs } from '@simbo/eslint-config/unicorn';
Superset of eslint-plugin-jsdoc
Exported as jsdocConfigs
import { jsdocConfigs } from '@simbo/eslint-config/jsdoc';
Superset of eslint-plugin-n
Exported as nConfigs
import { nConfigs } from '@simbo/eslint-config/n';
Superset of eslint-config-prettier
Exported as prettierConfigs
import { prettierConfigs } from '@simbo/eslint-config/prettier';
Overrides tailored for spec files and mocks.
Exported as testingConfigs
import { testingConfigs } from '@simbo/eslint-config/testing';
Utilities can be imported from either @simbo/eslint-config
or
@simbo/eslint-config/utils
.
Creates a rule set with all specified rules turned off.
Creates a rule set with ESLint's no-restricted-globals
rule to restrict
use of all global variables in a specific context, with an optional
allow-list.
globals
Re-export from globals
.
parser
Re-exports from @typescript-eslint/parser
.
Using the recommended configuration for Node.js projects:
import { configs, globals } from '@simbo/eslint-config';
import { defineConfig, globalIgnores } from 'eslint/config';
export default defineConfig([
globalIgnores(['**/dist/', '**/coverage/']),
{
// Set up language options for TypeScript with globals for Node.js.
languageOptions: {
globals: { ...globals.node },
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: import.meta.dirname,
allowDefaultProject: ['*.config.js', '.*.js'],
},
},
// Extend the recommended Node.js configuration.
extends: [configs.node.recommended],
rules: {
// Your rule overrides can be added here.
},
},
// Additional configurations can be added here.
]);
Using the recommended configuration for browser projects:
import { configs, globals } from '@simbo/eslint-config';
import { defineConfig, globalIgnores } from 'eslint/config';
export default defineConfig([
globalIgnores(['**/dist/', '**/coverage/']),
{
// Set up language options for TypeScript with globals for browser.
languageOptions: {
globals: { ...globals.browser },
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: import.meta.dirname,
allowDefaultProject: ['*.config.js', '.*.js'],
},
},
// Extend the recommended browser configuration.
extends: [configs.browser.recommended],
rules: {
// Your rule overrides can be added here.
},
},
// Additional configurations can be added here.
]);
In this example, we create a combined configuration for a browser environment with support for JavaScript, TypeScript, and Prettier.
import { eslintJsConfigs } from '@simbo/eslint-confi^g/eslint-js';
import { typescriptEslintConfigs } from '@simbo/eslint-config/typescript-eslint';
import { prettierConfigs } from '@simbo/eslint-config/prettier';
import { globals } from '@simbo/eslint-config';
import { defineConfig, globalIgnores } from 'eslint/config';
export default defineConfig([
globalIgnores(['**/dist/', '**/coverage/']),
{
// Set up language options for TypeScript with globals for browser.
languageOptions: {
globals: { ...globals.browser },
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: import.meta.dirname,
allowDefaultProject: ['*.config.js', '.*.js'],
},
},
// Extend combinable configuration supersets for browser.
extends: [
eslintJsConfigs.browser.recommended,
typescriptEslintConfigs.browser.recommended,
prettierConfigs.recommended,
],
rules: {
// Your rule overrides can be added here.
},
},
// Additional configurations can be added here.
]);