- Notifications
You must be signed in to change notification settings - Fork0
⚙️ ESLint configuration presets for TypeScript and TypeScript + React projects.
License
darkobits/eslint-config
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ESLint configuration presets for TypeScript and TypeScript + React projects.
- ESLint
>=9.0.0
. - Your project must be using ESLint's newflat configuration format.
npm install --save-dev @darkobits/eslint-config
This package provides two presets:presetTs
for TypeScriptprojects andpresetTsx
for TypeScript projects that useJSX and React.
In your project'seslint.config.js
file, import the desired preset and re-export it as the defaultexport:
export{presetTsasdefault}from'@darkobits/eslint-config'
or
export{presetTsxasdefault}from'@darkobits/eslint-config'
If you need to define any additional configuration specific to your project, use the spread operator toadd the preset to a new array:
import{airBnb}from'@airbnb/eslint-config-airbnb-is-still-a-thing-right'import{presetTs}from'@darkobits/eslint-config'exportdefault[// Exempt this directory from linting. Do this early to prevent ESLint from// processing these files any further.{ignores:['rainbows/**']},// Then, apply one or more configuration presets. ...airBnb, ...presetTs,// If we then wanted to disable a rule used by any of the above:{rules:{'unicorn/catch-error-name':'off'}}]
Tip
Order matters here! Configuration for files that you want to have globally ignored occur first,followed by one or more configuration presets, then overrides.
For more on this topic, refer to the ESLintdocumentation.
For added type safety, use thedefineFlatConfig
helper:
import{defineFlatConfig,presetTs}from'@darkobits/eslint-config'exportdefaultdefineFlatConfig([{ignores:['rainbows/**']}, ...presetTs,{rules:{'unicorn/catch-error-name':'off'}}])
You can use ESLint's newConfiguration Inspector tosee an exhaustive list of all rules (and their settings) applied in your project by running thefollowing:
npx eslint --inspect-config
Example:

About
⚙️ ESLint configuration presets for TypeScript and TypeScript + React projects.