# eslint-config-lob

[Shareable ESLint configuration](http://eslint.org/docs/developer-guide/shareable-configs) for Lob repositories

## Usage

**Requirements:** Node.js >= 24.15.0, npm >= 11.12.1, ESLint >= 10.0.0

This package uses ESLint [flat config](https://eslint.org/docs/latest/use/configure/configuration-files) format (array-based). ESLint 10+ is required.

1. Install `eslint` and this module:
  ```bash
  npm i eslint eslint-config-lob --save-dev
  ```

2. Create an `eslint.config.js` file in the root of your project:
  ```js
  const lob = require('eslint-config-lob');

  module.exports = [...lob];
  ```

  For the migrations ruleset:
  ```js
  const migrations = require('eslint-config-lob/migrations');

  module.exports = [...migrations];
  ```

  For the browser ruleset:
  ```js
  const browser = require('eslint-config-lob/browser');

  module.exports = [...browser];
  ```

  For the ES5 ruleset:
  ```js
  const es5 = require('eslint-config-lob/es5');

  module.exports = [...es5];
  ```

3. Add an `ignores` entry in your flat config to exclude files or directories:
  ```js
  module.exports = [
    ...lob,
    { ignores: ['node_modules/**', 'dist/**'] }
  ];
  ```

4. Modify or create the npm `lint` script in `package.json`:
  ```json
  {
    "scripts": {
      "lint": "eslint ."
    }
  }
  ```

5. Clean up any legacy `.eslintrc*` or `.eslintignore` files from your project — flat config replaces them.

## Verification

```bash
npm install
npm run lint
npm audit
```

Target: zero lint errors, zero lint warnings, zero `npm audit` moderate/high findings.


## Contributing

Modifying or adding [rules](http://eslint.org/docs/rules/).
  * To add to the main rules, modify the [`index.js`](https://github.com/lob/eslint-config-lob/blob/master/index.js) file.
  * To use most of the main rules but override some of them, create a new file in the root of this module, spread from [`index.js`](https://github.com/lob/eslint-config-lob/blob/master/index.js) and add your overrides. See [`migrations.js`](https://github.com/lob/eslint-config-lob/blob/master/migrations.js) for an example. If you're creating a file like this, its rules should be reusable and not a one-off. For example, you could create a file for angular rules. To make a one-off change, do so in your project's `eslint.config.js`.

