# @landbot/eslint-config-typescript-react

> ESLint and Prettier configuration

Latest version **4.1.0** (published 2026-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @landbot/eslint-config-typescript-react
pnpm add @landbot/eslint-config-typescript-react
yarn add @landbot/eslint-config-typescript-react
bun add @landbot/eslint-config-typescript-react
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 4.1.0 |
| Published | 2026-05-27 |
| First published | 2024-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 10 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Maintainers | eduardo.ruiz, osama.nehme, david.gomz, landbot-dev |

## Links

- npm: https://www.npmjs.com/package/@landbot/eslint-config-typescript-react
- Repository: https://github.com/landbot-org/eslint-config
- Homepage: https://github.com/landbot-org/eslint-config#readme
- Issues: https://github.com/landbot-org/eslint-config/issues
- npm.io page: https://npm.io/package/@landbot/eslint-config-typescript-react

## Dependencies (10)

- [globals](https://npm.io/package/globals.md) ^16.5.0
- [@eslint/compat](https://npm.io/package/@eslint/compat.md) ^2.0.0
- [eslint-plugin-jest](https://npm.io/package/eslint-plugin-jest.md) ^29.2.1
- [eslint-plugin-react](https://npm.io/package/eslint-plugin-react.md) ^7.37.5
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.32.0
- [eslint-config-prettier](https://npm.io/package/eslint-config-prettier.md) ^10.1.8
- [@typescript-eslint/parser](https://npm.io/package/@typescript-eslint/parser.md) ^8.48.0
- [eslint-plugin-react-hooks](https://npm.io/package/eslint-plugin-react-hooks.md) ^7.0.1
- [@typescript-eslint/eslint-plugin](https://npm.io/package/@typescript-eslint/eslint-plugin.md) ^8.48.0
- [@trivago/prettier-plugin-sort-imports](https://npm.io/package/@trivago/prettier-plugin-sort-imports.md) ^6.0.0

## Recent versions

- 4.1.0 (latest) — 2026-05-27
- 4.0.0 — 2025-11-25
- 3.3.1 — 2025-11-24
- 3.3.0 — 2025-07-18
- 3.2.0 — 2024-09-06
- 3.1.0 — 2024-09-05
- 3.0.0 — 2024-09-03
- 2.2.1 — 2024-09-03
- 2.2.0 — 2024-09-02
- 2.1.2 — 2024-01-19
- 2.1.1 — 2024-01-18
- 2.1.0 — 2024-01-18
- 2.0.3 — 2024-01-02
- 2.0.2 — 2024-01-02
- 2.0.1 — 2024-01-02
- … 1 more at https://npm.io/package/@landbot/eslint-config-typescript-react/versions

## README

# ESLint and Prettier Configuration

Shareable ESLint and Prettier configuration for TypeScript React projects.

## Features

- ✅ TypeScript support with type-aware linting
- ⚛️ React and React Hooks rules
- 🧪 Jest testing configuration
- 📦 Import sorting and organization
- 🎨 Prettier integration
- 🔧 Flexible and extensible

## Installation

```shell
npm i -D @landbot/eslint-config-typescript-react
```

### Peer Dependencies

This package requires the following peer dependencies:

```shell
npm install --save-dev eslint prettier typescript react react-dom
```

## Usage

### ESLint Configuration

#### For ESLint 9+ (Flat Config)

Create an `eslint.config.js` file in the root of your project:

```js
const landbotConfig = require("@landbot/eslint-config-typescript-react");

module.exports = [
  ...landbotConfig,
  // Add your custom rules here
  {
    rules: {
      // Override or add rules
      "no-console": "off",
    },
  },
];
```

### Prettier Configuration

Create a `.prettierrc.js` file in the root of your project:

```js
module.exports = require("@landbot/eslint-config-typescript-react/prettier-config");
```

Or extend it with your own settings:

```js
const prettierConfig = require("@landbot/eslint-config-typescript-react/prettier-config");

module.exports = {
  ...prettierConfig,
  // Add your custom settings
  semi: false,
};
```

## TypeScript Project Configuration

This configuration works out of the box for most TypeScript projects. However, some advanced TypeScript ESLint rules
require type information from your `tsconfig.json`. These rules can catch issues like unhandled promises or incorrect
async/await usage.

**Important:** If you already run `tsc --noEmit` for type checking (recommended), enabling type-aware linting provides
minimal additional value and significantly slows down ESLint. Most teams don't need this.

If you still want to enable these type-aware rules, configure the TypeScript parser in your `eslint.config.js`:

```js
const landbotConfig = require("@landbot/eslint-config-typescript-react");

module.exports = [
  ...landbotConfig,
  {
    files: ["**/*.{ts,tsx}"],
    languageOptions: {
      parserOptions: {
        project: "./tsconfig.json",
      },
    },
  },
];
```

**Note:** Enabling `project` makes linting significantly slower. Only enable if you have specific type-aware rules you
need and aren't already using TypeScript's compiler for type checking.

## What's Included

### Plugins

- `@typescript-eslint/eslint-plugin` - TypeScript-specific linting rules
- `eslint-plugin-react` - React-specific linting rules
- `eslint-plugin-react-hooks` - Rules for React Hooks
- `eslint-plugin-import` - Import/export syntax validation
- `eslint-plugin-jest` - Jest testing rules
- `eslint-config-prettier` - Disables ESLint rules that conflict with Prettier

### Key Rules

- Unused variables with `_` prefix are allowed (args, caught errors, vars, destructured arrays)
- Console statements are **errors** (not allowed by default)
- Import statements are automatically organized by `@trivago/prettier-plugin-sort-imports`
- **ESLint and Prettier work together seamlessly** - formatting rules are handled by Prettier, linting rules by ESLint
- TypeScript `any`, non-null assertions, and `@ts-` comments are allowed (rules disabled)
- Empty interfaces are errors unless they extend a single interface
- Modern ES6+ syntax is encouraged (`prefer-const`, `no-var`, `prefer-template`)
- Import restrictions: `@faker-js/faker` must use locale-specific imports

## Customization

You can override any rule by adding it to your configuration:

```js
const landbotConfig = require("@landbot/eslint-config-typescript-react");

module.exports = [
  ...landbotConfig,
  {
    rules: {
      "@typescript-eslint/no-explicit-any": "error", // Make it stricter
      "no-console": "off", // Allow console statements
    },
  },
];
```

## Project-Specific Patterns

### Extending Restricted Imports

This config includes a pre-configured list of restricted imports that you can extend. To add your own restrictions
while preserving the base ones:

```js
const landbotConfig = require("@landbot/eslint-config-typescript-react/eslint-config");

module.exports = [
  ...landbotConfig,
  {
    rules: {
      "no-restricted-imports": [
        "error",
        {
          paths: [
            ...landbotConfig.restrictedImportsPaths, // Keep base restrictions
            {
              name: "lodash",
              message: "Please use lodash-es instead for better tree-shaking",
            },
            {
              name: "moment",
              message: "Please use date-fns or dayjs instead",
            },
          ],
        },
      ],
    },
  },
];
```

### Custom Globals

If you need to add project-specific globals:

```js
const landbotConfig = require("@landbot/eslint-config-typescript-react");

module.exports = [
  ...landbotConfig,
  {
    languageOptions: {
      globals: {
        MyCustomGlobal: "readonly",
      },
    },
  },
];
```

## Scripts

Add these scripts to your `package.json`:

```json
{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix",
    "prettier:check": "prettier . --check",
    "prettier:write": "prettier . --write"
  }
}
```

## Contributing

Contributions are welcome! Please read our [CONTRIBUTING.md](CONTRIBUTING.md) for details.

---
_Source: https://npm.io/package/@landbot/eslint-config-typescript-react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
