base
> Strict ESLint flat config for TypeScript projects. Extends @jmlweb/eslint-config-base-js with strict type-checked rules.
> ๐ง Maintenance mode: only dependency and security updates, no new rules. For new projects use @jmlweb/oxlint-config-base. To move an existing project, see the migration guide.
โจ Features
Section titled โโจ Featuresโ- ๐ Strict type checking:
strictTypeCheckedandstylisticTypeCheckedfrom typescript-eslint, withprojectService - ๐ก๏ธ No
any:no-explicit-anyis an error - ๐ฆ Type-only imports: inline
typestyle, plus automatic import and export sorting - ๐ฏ Opinionated: no enums (use const maps), no default exports, no parameter mutation
- ๐จ Prettier compatible: disables rules that conflict with Prettier
๐ฆ Installation
Section titled โ๐ฆ Installationโnpm install --save-dev @jmlweb/eslint-config-base eslint @eslint/js typescript-eslint eslint-config-prettier eslint-plugin-simple-import-sort@jmlweb/eslint-config-base-js is a regular dependency and installs automatically.
> ๐ก Upgrading? See the Migration Guide.
๐ Quick Start
Section titled โ๐ Quick Startโimport baseConfig from '@jmlweb/eslint-config-base';
export default [ ...baseConfig, // Project-specific overrides];๐ก Examples
Section titled โ๐ก ExamplesโTest overrides and ignores
Section titled โTest overrides and ignoresโimport baseConfig from '@jmlweb/eslint-config-base';
export default [ ...baseConfig, { files: ['**/*.test.ts', '**/*.test.tsx'], rules: { '@typescript-eslint/no-explicit-any': 'off', 'no-console': 'off', }, }, { ignores: ['dist/', 'build/', 'node_modules/'], },];Allow default exports in config files
Section titled โAllow default exports in config filesโimport baseConfig from '@jmlweb/eslint-config-base';
export default [ ...baseConfig, { files: ['*.config.ts', '*.config.js'], rules: { 'no-restricted-exports': 'off', }, },];Less strict
Section titled โLess strictโimport baseConfig from '@jmlweb/eslint-config-base';
export default [ ...baseConfig, { files: ['**/*.ts', '**/*.tsx'], rules: { '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/consistent-type-imports': 'off', }, },];๐ Configuration Details
Section titled โ๐ Configuration DetailsโApplied to **/*.ts and **/*.tsx (plus the JavaScript rules from base-js for .js, .mjs and .cjs).
Included
Section titled โIncludedโ- โ
typescript-eslint
recommended,strictTypeCheckedandstylisticTypeChecked - โ
parserOptions.projectService: true(requires atsconfig.json) - โ Import and export sorting, Prettier conflict resolution
- โ
All rules from
@jmlweb/eslint-config-base-js
Key rules
Section titled โKey rulesโ| Rule | Setting |
|---|---|
@typescript-eslint/no-explicit-any |
error |
@typescript-eslint/explicit-function-return-type |
off (return types are inferred) |
@typescript-eslint/no-unused-vars |
error, _-prefixed args and variables ignored |
@typescript-eslint/consistent-type-imports |
error, type-imports with inline fix |
@typescript-eslint/consistent-type-definitions |
error, prefer type |
@typescript-eslint/no-require-imports |
error |
@typescript-eslint/naming-convention |
error, see below |
no-restricted-syntax (TSEnumDeclaration) |
error, use const maps |
no-restricted-exports |
error, no default exports |
no-param-reassign |
error, including properties |
Naming: types PascalCase; variables camelCase or UPPER_CASE (exported consts may also be PascalCase); functions camelCase.
๐ Import Sorting
Section titled โ๐ Import SortingโImports are sorted and type-only imports are enforced.
Before:
import { Component } from './component';import React, { useState } from 'react';import { User } from './types';import fs from 'fs';After eslint --fix:
import fs from 'fs';import React, { useState } from 'react';import { type User } from './types';import { Component } from './component';๐ฏ When to Use
Section titled โ๐ฏ When to Useโ- โ TypeScript projects that want strict, type-aware linting
- โ Teams that want one consistent style (named exports, const maps, immutability)
- โ A base for the React, Node.js and Astro configs
For JavaScript-only projects use @jmlweb/eslint-config-base-js. For React, Node.js or Astro use -react, -node or -astro. For new projects prefer @jmlweb/oxlint-config-base.
๐ง Extending the Configuration
Section titled โ๐ง Extending the ConfigurationโSpread the config, then add objects after it. Later entries win.
import baseConfig from '@jmlweb/eslint-config-base';
export default [ ...baseConfig, { files: ['**/*.ts'], rules: { '@typescript-eslint/explicit-function-return-type': 'error', }, },];๐ Usage with Scripts
Section titled โ๐ Usage with Scriptsโ{ "scripts": { "lint": "eslint .", "lint:fix": "eslint . --fix" }}npm run lint๐ Requirements
Section titled โ๐ Requirementsโ- Node.js >= 22.12.0
- ESLint ^9.0.0 || ^10.0.0 (flat config)
- TypeScript project with a
tsconfig.json(versions supported by typescript-eslint 8)
๐ฆ Peer Dependencies
Section titled โ๐ฆ Peer Dependenciesโeslint(^9.0.0 || ^10.0.0)@eslint/js(^9.0.0 || ^10.0.0)typescript-eslint(^8.0.0)eslint-config-prettier(^9.1.0 || ^10.0.0)eslint-plugin-simple-import-sort(^12.0.0 || ^13.0.0 || ^14.0.0)
๐ Related Packages
Section titled โ๐ Related Packagesโ@jmlweb/eslint-config-base-js: JavaScript foundation (extended by this package)@jmlweb/eslint-config-react: React config that extends this one@jmlweb/eslint-config-node: Node.js config that extends this one@jmlweb/eslint-config-astro: Astro config that extends this one@jmlweb/oxlint-config-base: Oxlint equivalent, recommended for new projects@jmlweb/tsconfig-base: TypeScript config@jmlweb/prettier-config-base: Prettier config (maintenance mode)
๐ Migration Guide
Section titled โ๐ Migration Guideโ2.x to 3.0
Section titled โ2.x to 3.0โNode.js 18 and 20 are end-of-life. Node.js >= 22.12.0 is now required: it is the first Node.js 22 release that can require() ES modules without a flag, which the CommonJS build needs to load ESM-only plugins. Peer ranges were also widened (eslint-plugin-simple-import-sort 13 and 14).
- Upgrade Node.js to 22.12.0 or later.
- Update the package:
npm install --save-dev @jmlweb/eslint-config-base@latest.
See the Changelog.
๐ License
Section titled โ๐ LicenseโMIT