# eslint-config-uphold

> Uphold-flavored ESLint config

Latest version **7.1.0** (published 2026-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-config-uphold
pnpm add eslint-config-uphold
yarn add eslint-config-uphold
bun add eslint-config-uphold
```

## Health

**Score 65/100 (B)** — status: active.

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

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 7.1.0 |
| Published | 2026-10-08 |
| First published | 2017-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | ^22.12.0 \|\| >=24 |
| Dependencies | 14 |
| Unpacked size | 62.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 6 |
| Author | Uphold |
| Maintainers | botatuphold, ruimarinho, fixe |
| Keywords | config, eslint, lint, shared |

## Links

- npm: https://www.npmjs.com/package/eslint-config-uphold
- Repository: https://github.com/uphold/eslint-config-uphold
- Homepage: https://github.com/uphold/eslint-config-uphold#readme
- Issues: https://github.com/uphold/eslint-config-uphold/issues
- npm.io page: https://npm.io/package/eslint-config-uphold

## Dependencies (14)

- [dayjs](https://npm.io/package/dayjs.md) ^1.11.21
- [globals](https://npm.io/package/globals.md) ^17.8.0
- [@eslint/js](https://npm.io/package/@eslint/js.md) ^10.0.1
- [@eslint/compat](https://npm.io/package/@eslint/compat.md) ^2.1.0
- [eslint-plugin-n](https://npm.io/package/eslint-plugin-n.md) ^18.2.2
- [eslint-plugin-jsdoc](https://npm.io/package/eslint-plugin-jsdoc.md) ^63.3.1
- [eslint-plugin-promise](https://npm.io/package/eslint-plugin-promise.md) ^7.3.0
- [eslint-config-prettier](https://npm.io/package/eslint-config-prettier.md) ^10.1.8
- [eslint-plugin-prettier](https://npm.io/package/eslint-plugin-prettier.md) ^5.5.6
- [@stylistic/eslint-plugin](https://npm.io/package/@stylistic/eslint-plugin.md) ^5.10.0
- [eslint-plugin-sql-template](https://npm.io/package/eslint-plugin-sql-template.md) ^3.2.0
- [eslint-plugin-sort-keys-fix](https://npm.io/package/eslint-plugin-sort-keys-fix.md) ^1.1.2
- [eslint-plugin-sort-destructure-keys](https://npm.io/package/eslint-plugin-sort-destructure-keys.md) ^3.0.0
- [eslint-plugin-sort-imports-requires](https://npm.io/package/eslint-plugin-sort-imports-requires.md) ^2.1.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 7.1.0 (latest) — 2026-10-08
- 7.0.0 — 2026-07-08
- 6.13.0 — 2026-05-11
- 6.12.0 — 2026-02-04
- 6.11.0 — 2026-02-03
- 6.10.1 — 2026-01-22
- 6.10.0 — 2026-01-19
- 6.9.0 — 2026-01-12
- 6.8.0 — 2026-01-05
- 6.7.2 — 2025-11-07
- 6.7.1 — 2025-07-31
- 6.7.0 — 2025-07-22
- 6.6.2 — 2025-07-07
- 6.6.1 — 2025-06-28
- 6.6.0 — 2025-06-26
- … 28 more at https://npm.io/package/eslint-config-uphold/versions

## README

# eslint-config-uphold

Uphold-flavored [ESLint](https://eslint.org/) config.

The [rules defined here](https://github.com/uphold/eslint-config-uphold/blob/master/src/index.js)
extend the [eslint-recommended](https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js) preset,
as well as the [overrides](https://github.com/prettier/eslint-config-prettier/blob/master/index.js)
that allow the [Prettier](https://prettier.io) pretty-printer to reformat the code without conflicts.

## Status

[![npm version][npm-image]][npm-url]

## Installation

```sh
npm install eslint eslint-config-uphold prettier --save-dev
```

> [!WARNING]
> The minimum Node.js versions are `v22.12.0`, `v24.0.0`, as certain plugins depend on `require('esm')`, while matching the minimum versions supported by ESLint v10.

## Usage

Create an `eslint.config.mjs` file with the following content:

```js
import upholdConfig from 'eslint-config-uphold';

export default upholdConfig;
```

If you'd like to extend the config, or change rules, you can do so like this:

```js
import { defineConfig } from 'eslint/config';
import upholdConfig from 'eslint-config-uphold';
import yourPlugin from 'your-eslint-plugin';

export default defineConfig([
  upholdConfig,
  {
    name: 'project-name/config',
    plugins: {
      'your-plugin': yourPlugin
    },
    rules: {
      'your-plugin/rule-name': 'error'
    }
  }
]);
```

See [Using a Shareable Config](https://eslint.org/docs/latest/extend/shareable-configs#using-a-shareable-config) for more information.

Add a `lint` command to the `scripts` section of your `package.json`, like so:

```json
{
  "scripts": {
    "lint": "eslint"
  }
}
```

and run the linter with:

```sh
npm run lint
```

To automatically fix all lint issues, use the `--fix` option:

```sh
npm run lint --fix
```

The default configuration uses CommonJS with ECMAScript 2024.

The `javascript` and `typescript` named exports also use ECMAScript 2024.

### TypeScript

A TypeScript-specific config using `typescript-eslint` is available.

It can be used like this, on a `eslint.config.mjs` file:

```js
import { defineConfig, globalIgnores } from 'eslint/config';
import { typescript as upholdTypescriptConfig } from 'eslint-config-uphold';
import tseslint from 'typescript-eslint';

export default defineConfig([
  {
    extends: [upholdTypescriptConfig],
    files: ['**/*.{ts,tsx}'],
    name: 'project-name/uphold-typescript',
    rules: {
      'jsdoc/no-types': 'warn'
    }
  },
  globalIgnores(['coverage', 'dist'])
]);
```

It's also possible to use the config without `typescript-eslint`. Minimal setup would look like the following:

```js
import { defineConfig } from 'eslint/config';
import { typescript as upholdTypescriptConfig } from 'eslint-config-uphold';

export default defineConfig([
  {
    extends: [upholdTypescriptConfig],
    files: ['**/*.{ts,tsx}']
  }
]);
```

The TypeScript config assumes ESM by default.
If your project uses CJS, you can create a custom config using the `createTypeScriptConfig` factory.
This can also be used to specify a `ecmaVersion` other than the default `2024`.

```js
import { defineConfig } from 'eslint/config';
import { createTypeScriptConfig } from 'eslint-config-uphold';

export default defineConfig([
  {
    extends: [await createTypeScriptConfig('commonjs', { ecmaVersion: 2025 })], // 'module' for ESM, 'commonjs' for CJS.
    files: ['**/*.{ts,cts,tsx}']
  }
]);
```

### JavaScript

Likewise, a JavaScript-specific config is exported. The usage is similar to TypeScript's config:

```js
import { defineConfig, globalIgnores } from 'eslint/config';
import { javascript as upholdJavascriptConfig } from 'eslint-config-uphold';

export default defineConfig([
  {
    extends: [upholdJavascriptConfig],
    files: ['**/*.{js,jsx}']
  },
  globalIgnores(['coverage'])
]);
```

The JavaScript config assumes CJS by default.
If your project uses ESM, you can create a custom config using the `createJavaScriptConfig` factory.
This can also be used to specify a `ecmaVersion` other than the default `2024`.

```js
import { defineConfig } from 'eslint/config';
import { createJavaScriptConfig } from 'eslint-config-uphold';

export default defineConfig([
  {
    extends: [createJavaScriptConfig('module', { ecmaVersion: 2025 })], // 'module' for ESM, 'commonjs' for CJS.
    files: ['**/*.{js,mjs,jsx}']
  }
]);
```

### Prettier options

The options used by the `prettier/prettier` rule are exported as `prettierOptions`, so a `prettier` config can share them with ESLint.

```js
import { prettierOptions } from 'eslint-config-uphold';

export default prettierOptions;
```

### Custom rules

This config includes custom Uphold-specific rules, under `uphold-plugin`.

| Rule                                                                        | Enabled in default config?       | Fix?  |
| --------------------------------------------------------------------------- | -------------------------------- | ----- |
| [`database-migration-filename-format`](#database-migration-filename-format) | False                            | False |
| [`explicit-sinon-use-fake-timers`](#explicit-sinon-use-fake-timers)         | True (when `sinon` is installed) | False |
| [`no-trailing-period-in-log-messages`](#no-trailing-period-in-log-messages) | True                             | True  |
| [`require-comment-punctuation`](#require-comment-punctuation)               | True                             | True  |

#### `database-migration-filename-format`

Validates that migration file names are in the format `YYYYMMDDHHMMSS-<name>`, where `name` must match the regex `[a-z0-9-]+`, the date/time is UTC and is not in the future.

To enable the `database-migration-filename-format` rule, you can do so as following:

```js
export default defineConfig([
  ...
  {
    files: ['**/database/migrations/*.js'] // glob to include/exclude the migration files to lint
    name: 'project/migrations',
    rules: {
      'uphold-plugin/database-migration-filename-format': 'error'
    }
  },
  ...
]);
```

#### `explicit-sinon-use-fake-timers`

Enforces explicit configuration when using Sinon's `useFakeTimers()` by requiring the `toFake` option to be specified. This ensures that only the intended timer functions are faked, reducing the risk of unintended side effects in tests.

This rule is automatically enabled when `sinon` is detected as an installed dependency. The default export (`upholdConfig`) always enables this rule, while the individual `javascript` and `typescript` configs only enable it conditionally.

**Valid:**

```js
sinon.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
```

**Invalid:**

```js
sinon.useFakeTimers(); // ❌ Missing 'toFake' option.
```

#### `no-trailing-period-in-log-messages`

Disallows trailing periods in log messages, except for `...` (ellipsis). This helps maintain consistency across log messages.

**Valid:**

```js
console.log('Operation complete');
console.info('Processing...');
logger.error('An error occurred');
```

**Invalid:**

```js
console.log('Operation complete.'); // ❌ Remove the trailing period.
console.info('Processing..'); // ❌ Use three dots (...) or none.
logger.error('An error occurred.'); // ❌ Remove the trailing period.
```

**Options:**

- `additionalMethods` - You can configure additional methods to check:

  ```js
  'uphold-plugin/no-trailing-period-in-log-messages': ['error', {
    additionalMethods: ['fatal', 'verbose', 'success']
  }]
  ```

#### `require-comment-punctuation`

Requires `//` comment blocks to end with punctuation on the last line. Valid endings are `.`, `:`, `;`, `?`, `!`, or paired triple backticks (` ``` `). This helps maintain consistency in code comments.

**Valid:**

````js
// This is a comment with a period.
// Is this a question?
// This is important!
// ``` let foo = 1 + 2 ```
````

**Invalid:**

- ❌ Missing punctuation.

  ````js
  // This is a comment without punctuation
  // Comment with unmatched backticks ```
  ````

**Options:**

- `exclusionPrefixes` - An array of strings. Comments starting with these prefixes (after `//`) are excluded from the rule:

  ```js
  'uphold-plugin/require-comment-punctuation': ['error', {
    exclusionPrefixes: ['TODO:', 'FIXME:', 'NOTE:']
  }]
  ```

  With this config, comments like `// TODO: implement this` will not require punctuation.

- `additionalAllowedEndings` - An array of strings to extend the default allowed endings (`.`, `:`, `;`, `?`, `!`, ` ``` `):

  ```js
  'uphold-plugin/require-comment-punctuation': ['error', {
    additionalAllowedEndings: [')']
  }]
  ```

  With this config, comments ending with `)` will also be considered valid.

### Test configs

This package includes individual exported configs for multiple test frameworks:

- [Jest](https://jestjs.io/), depending on `eslint-plugin-jest`.
- [Mocha](https://mochajs.org/), depending on `eslint-plugin-mocha`.
- [Vitest](https://vitest.dev/), depending on `@vitest/eslint-plugin` and `typescript`.

To use them, import the config directly in your `eslint.config.mjs` file:

```js
import { defineConfig } from 'eslint/config';
import { mocha as upholdMochaConfig } from 'eslint-config-uphold';
import upholdConfig from 'eslint-config-uphold';

export default defineConfig([
  upholdConfig,
  {
    extends: [upholdMochaConfig],
    files: ['test/**/*.js'],
    name: 'project-name/tests',
    rules: {
      'mocha/no-identical-title': 'off'
    }
  }
]);
```

All configs can be imported from `eslint-config-uphold`:

```js
import { javascript, jest, mocha, typescript, vitest } from 'eslint-config-uphold';
```

> [!NOTE]
> Test configs use top-level `await` for dynamic module detection and are **ESM-only**. If your project uses CommonJS, your `eslint.config.mjs` still supports `import()` and top-level `await`.

> [!NOTE]
> Missing optional plugin dependencies emit a `process.emitWarning()` notice (type `UpholdEslintWarning`) instead of writing to `console.warn`. These warnings are deduplicated by Node.js and can be suppressed with `--no-warnings` or `NODE_NO_WARNINGS=1`.

### Custom parsers

From [ESLint's docs > Configure a Parser](https://eslint.org/docs/latest/use/configure/parser):

> You can use custom parsers to convert JavaScript code into an abstract syntax tree for ESLint to evaluate. You might want to add a custom parser if your code isn’t compatible with ESLint’s default parser, Espree.
>
> (...)
>
> The following third-party parsers are known to be compatible with ESLint:
>
> - [Esprima](https://www.npmjs.com/package/esprima)
> - [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) - A wrapper around the Babel parser that makes it compatible with ESLint.
> - [@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser) - A parser that converts TypeScript into an ESTree-compatible form so it can be used in ESLint.

## Upgrading ESLint

See the [ESLint repo](https://github.com/eslint/eslint#semantic-versioning-policy) for ESLint's guidelines on semantic versioning.

A [tilde range](https://docs.npmjs.com/cli/v6/using-npm/semver#tilde-ranges-123-12-1) is set for the ESLint dependency to pick up any patch changes by default.

For any minor/major upgrades to ESLint it is recommended to update both `eslint` and `eslint-config-uphold` and keep them in parallel.
This is down to the fact that no guarantee is made that minor upgrades do not cause conflicts or issues with existing or new rules.
The downside here is a package update is required for any security or other bug fixes.
The benefit however is the included rules are always guaranteed to be stable.

## Migration guide

See the [MIGRATIONS.md](MIGRATIONS.md) file for migration guides between versions v5 and v6, v6 and v7.

## Release process

The release of a version is automated via the [release](https://github.com/uphold/eslint-config-uphold/.github/workflows/release.yml) GitHub workflow.
Run it by clicking the "Run workflow" button.

## License

MIT

[npm-image]: https://img.shields.io/npm/v/eslint-config-uphold.svg
[npm-url]: https://www.npmjs.com/package/eslint-config-uphold

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