Forget about eslint-configs hell. All you need is here. One package, one config, one minute to start development.
yarn add -D eslint@8.57.x eslint-config-the-only-perfect
module.exports = {
extends: ["the-only-perfect"],
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
sourceType: "module",
ecmaVersion: 2021,
}
}
{
"extends": ["the-only-perfect"]
}
This configuration includes a comprehensive setup to ensure clean, maintainable, and readable TypeScript code:
-
Parser:
@typescript-eslint/parser
: Parses TypeScript code for ESLint.
-
Base Configurations:
eslint:recommended
: Enables a set of recommended ESLint rules.plugin:@typescript-eslint/recommended
: Adds recommended rules for TypeScript.plugin:prettier/recommended
: Integrates Prettier for code formatting.plugin:import/recommended
: Adds rules for managing import statements.
-
Plugins:
@typescript-eslint
: Provides TypeScript-specific linting rules.
-
Custom Rules:
import/no-unresolved
: Disabled to avoid false positives in TypeScript projects.import/named
: Disabled as TypeScript handles named imports.no-async-promise-executor
: Disabled for flexibility in promise handling.import/order
: Enforces a consistent import order:- Groups:
external
,builtin
,internal
,sibling
,parent
,index
. newlines-between
: Ensures newlines between groups.- Alphabetizes imports within groups in ascending order.
- Groups:
-
Environment Settings:
browser
: Enables browser global variables.es2017
: Supports ES2017 features.node
: Enables Node.js global variables.
-
Root Setting:
root: true
: Ensures this is the root ESLint configuration for the project.