# How to Configure Airbnb ESLint for Node.js Backend Projects

> Configure Airbnb ESLint for Node.js backends. Install eslint-config-airbnb-base and extend it to enforce style rules without React for cleaner code.

- Repository: [Airbnb/javascript](https://github.com/airbnb/javascript)
- Tags: how-to-guide
- Published: 2026-02-24

---

**Install `eslint-config-airbnb-base` and extend it in your `.eslintrc` file to enforce Airbnb's JavaScript style rules in Node.js environments without React dependencies.**

The airbnb/javascript repository provides the industry-standard `eslint-config-airbnb-base` package specifically designed for server-side JavaScript projects. This shareable configuration bundles all of Airbnb's rigorous JavaScript style rules while automatically enabling Node.js globals and excluding frontend-specific plugins. Learning how to configure Airbnb ESLint for Node.js backend development ensures consistent, maintainable code quality across your entire server codebase.

## Installing eslint-config-airbnb-base and Peer Dependencies

The base configuration requires specific peer dependencies including ESLint itself and `eslint-plugin-import`. According to [`packages/eslint-config-airbnb-base/README.md`](https://github.com/airbnb/javascript/blob/main/packages/eslint-config-airbnb-base/README.md), you can install the package and all peer dependencies simultaneously using the `install-peerdeps` CLI tool.

### Automated Installation with install-peerdeps

For npm 5+ or yarn users, execute:

```bash
npx install-peerdeps --dev eslint-config-airbnb-base

```

This command retrieves the exact peer dependency versions declared in the package metadata and installs them as dev dependencies in a single step.

### Manual Installation

Alternatively, inspect the required peer dependencies manually:

```bash
npm info "eslint-config-airbnb-base@latest" peerDependencies

```

Then install each dependency individually using `npm install --save-dev <package>` or `yarn add --dev <package>`.

## Configuring ESLint for Node.js Environments

Once installed, create or update your `.eslintrc` file to extend the base configuration. The entry point at [`packages/eslint-config-airbnb-base/index.js`](https://github.com/airbnb/javascript/blob/main/packages/eslint-config-airbnb-base/index.js) composes multiple rule sets including the Node.js specific rules.

### Minimal Configuration

The only required configuration for a Node.js backend is:

```json
{
  "extends": "airbnb-base"
}

```

This automatically loads the Node.js environment settings defined in [`packages/eslint-config-airbnb-base/rules/node.js`](https://github.com/airbnb/javascript/blob/main/packages/eslint-config-airbnb-base/rules/node.js). This file sets `env: { node: true }` to enable globals like `require`, `__dirname`, and `module` without manual configuration.

### Project Structure Reference

You can reference the template starter file located at `linters/.eslintrc` in the repository for additional configuration patterns and examples.

## Customizing Rules for Backend Development

The base configuration enforces strict style rules that you may need to adjust for backend-specific patterns. Add a `"rules"` section to your `.eslintrc` to override defaults defined in the source files.

For example, to disable the `no-process-env` rule which restricts `process.env` usage by default:

```json
{
  "extends": "airbnb-base",
  "rules": {
    "no-process-env": "off"
  }
}

```

Or to allow `console` statements in development tools while maintaining strict import rules:

```json
{
  "extends": "airbnb-base",
  "rules": {
    "no-console": "off",
    "import/no-extraneous-dependencies": ["error", { "devDependencies": true }]
  }
}

```

All default rule definitions are documented in the config's source files, particularly in [`packages/eslint-config-airbnb-base/rules/node.js`](https://github.com/airbnb/javascript/blob/main/packages/eslint-config-airbnb-base/rules/node.js) for Node-specific settings.

## Running ESLint on Your Node.js Project

Add npm scripts to your [`package.json`](https://github.com/airbnb/javascript/blob/main/package.json) to execute linting commands:

```json
{
  "scripts": {
    "lint": "eslint src/**/*.js",
    "lint:fix": "eslint src/**/*.js --fix"
  }
}

```

Execute `npm run lint` to check for violations or `npm run lint:fix` to automatically correct fixable issues across your Node.js codebase.

## Summary

- **Use `eslint-config-airbnb-base`** for Node.js projects to avoid React dependencies while maintaining strict JavaScript style rules.
- **Install peer dependencies** using `npx install-peerdeps --dev eslint-config-airbnb-base` to ensure version compatibility.
- **Extend "airbnb-base"** in your `.eslintrc` file; the configuration automatically enables Node.js globals via [`packages/eslint-config-airbnb-base/rules/node.js`](https://github.com/airbnb/javascript/blob/main/packages/eslint-config-airbnb-base/rules/node.js).
- **Override specific rules** in the `"rules"` section when backend-specific patterns conflict with default settings.
- **Add lint scripts** to [`package.json`](https://github.com/airbnb/javascript/blob/main/package.json) for consistent code quality checks across your development workflow.

## Frequently Asked Questions

### What is the difference between eslint-config-airbnb and eslint-config-airbnb-base?

The `eslint-config-airbnb` package includes React and JSX specific rules along with the base JavaScript rules, as implemented in the airbnb/javascript repository. The `eslint-config-airbnb-base` package contains only the JavaScript style rules and is optimized for Node.js backend projects where React is not used. Both packages share the same underlying rule definitions but the base variant excludes `eslint-plugin-react` and `eslint-plugin-jsx-a11y`.

### Do I need to manually configure the Node.js environment in my ESLint config?

No. When you extend `airbnb-base`, the configuration automatically sets `env: { node: true }` in [`packages/eslint-config-airbnb-base/rules/node.js`](https://github.com/airbnb/javascript/blob/main/packages/eslint-config-airbnb-base/rules/node.js) (lines 2-4). This enables Node.js global variables such as `require`, `module`, and `__dirname` without requiring additional environment configuration in your local `.eslintrc` file.

### Can I use Airbnb ESLint with TypeScript for Node.js backends?

Yes, but you need additional configuration. Install `@typescript-eslint/parser` and `@typescript-eslint/eslint-plugin`, then extend both `airbnb-base` and the TypeScript recommended rules in your `.eslintrc`. You may need to disable conflicting rules using the `eslint-config-airbnb-typescript` community package or manual overrides to resolve type-aware linting conflicts.

### How should I handle console statements in backend code?

The Airbnb configuration warns against `console` usage by default via the `no-console` rule. For backend applications where logging to stdout is standard practice, override the rule in your `.eslintrc`: `"no-console": "off"`. Alternatively, use a structured logging library like Winston or Pino and configure `no-restricted-syntax` to allow only specific logging methods while maintaining the restriction on raw `console` calls.