@darkobits/eslint-config
v5.0.5
Published
ESLint configuration presets for TypeScript projects.
Readme
[!WARNING] Consult
AGELESSto determine if you are permitted to use this software where you live.
ESLint configuration presets for TypeScript and TypeScript + React projects.
Requirements
- ESLint
>=10.0.0. - Your project must be using ESLint's new flat configuration format.
Install
npm install --save-dev @darkobits/eslint-config eslintUse
This package provides two presets: ts for TypeScript
projects and tsx for TypeScript projects that use
JSX and React.
If you do not need to modify the preset in any way, simply re-export the desired configuration preset:
eslint.config.ts
export { configs } from '@darkobits/eslint-config'
export default configs.ts
// Or
export default configs.tsxIf you need to extend or modify a preset, the defineConfig helper should be
used:
eslint.config.ts
import { configs } from '@darkobits/eslint-config'
import { defineConfig } from 'eslint/config'
export default defineConfig({
extends: [configs.ts],
ignores: [
// ...
],
rules: {
// ...
}
})See:
Additional Utilities
This package's configuration presets automatically ignore patterns in the first
.gitignore file found at or above the current working directory. If you need
to specify additional ignore files, this package re-exports the
includeIgnoreFile and convertIgnorePatternToMinimatch utilities from
@eslint/compat:
eslint.config.ts
import { configs, includeIgnoreFile } from '@darkobits/eslint-config'
import { defineConfig } from 'eslint/config'
export default defineConfig({
extends: [configs.ts],
ignores: [includeIgnoreFile('path/to/.ignore-file')],
rules: {
// ...
}
})Monorepo Support
TypeScript type-aware linting is enabled via
parserOptions.projectService,
which automatically finds the nearest tsconfig.json to each linted file, so
no additional configuration is needed to lint monorepos.
Configuration Inspector
You can use ESLint's new Configuration Inspector to see an exhaustive list of all rules (and their settings) applied in your project by running the following:
npx eslint --inspect-config