# eslint-plugin-typescript-sort-keys

> Sort interface and string enum keys

Latest version **3.3.0** (published 2024-10-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-typescript-sort-keys
pnpm add eslint-plugin-typescript-sort-keys
yarn add eslint-plugin-typescript-sort-keys
bun add eslint-plugin-typescript-sort-keys
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.3.0 |
| Published | 2024-10-05 |
| First published | 2019-01-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 16 |
| Dependencies | 3 |
| Unpacked size | 42.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 158 |
| Author | infctr |
| Maintainers | infctr |
| Keywords | eslint, eslintplugin, eslint-plugin, typescript |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-typescript-sort-keys
- Repository: https://github.com/infctr/eslint-plugin-typescript-sort-keys
- Homepage: https://github.com/infctr/eslint-plugin-typescript-sort-keys#readme
- Issues: https://github.com/infctr/eslint-plugin-typescript-sort-keys/issues
- npm.io page: https://npm.io/package/eslint-plugin-typescript-sort-keys

## Dependencies (3)

- [json-schema](https://npm.io/package/json-schema.md) ^0.4.0
- [natural-compare-lite](https://npm.io/package/natural-compare-lite.md) ^1.4.0
- [@typescript-eslint/experimental-utils](https://npm.io/package/@typescript-eslint/experimental-utils.md) ^5.0.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
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 3.3.0 (latest) — 2024-10-05
- 1.1.0-rc1 (next) — 2020-05-24
- 3.2.0 — 2024-02-26
- 3.1.0 — 2023-10-15
- 3.0.0 — 2023-08-30
- 2.3.0 — 2023-03-17
- 2.2.0 — 2023-03-17
- 2.1.0 — 2021-11-23
- 2.0.0 — 2021-10-15
- 1.8.0 — 2021-08-16
- 1.7.0 — 2021-06-18
- 1.6.0 — 2021-04-02
- 1.5.0 — 2020-09-22
- 1.4.0 — 2020-09-22
- 1.3.0 — 2020-07-16
- … 17 more at https://npm.io/package/eslint-plugin-typescript-sort-keys/versions

## README

![Tests](https://github.com/infctr/eslint-plugin-typescript-sort-keys/workflows/Tests/badge.svg?branch=master)

# eslint-plugin-typescript-sort-keys

Sort interface and string enum keys

Inspired by and sourced from [eslint/sort-keys]([https://github.com/eslint/eslint/blob/master/docs/rules/sort-keys.md](https://github.com/eslint/eslint/blob/main/docs/src/rules/sort-keys.md))

## Installation

You'll first need to install

- [eslint](http://eslint.org)
- [typescript](http://www.typescriptlang.org/)
- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)

```sh
yarn add -D eslint typescript @typescript-eslint/parser
```

Next, install `eslint-plugin-typescript-sort-keys`:

```sh
yarn add -D eslint-plugin-typescript-sort-keys
```

**Note:** If you installed ESLint globally then you must also install `eslint-plugin-typescript-sort-keys` globally.

## Usage

Specify the parser for typescript files in your `.eslintrc` configuration file:

```json
{
  "parser": "@typescript-eslint/parser"
}
```

Add `typescript-sort-keys` to the plugins section. You can omit the `eslint-plugin-` prefix:

```json
{
  "plugins": ["typescript-sort-keys"]
}
```

Then configure the rules you want to use under the rules section.

```json
{
  "rules": {
    "typescript-sort-keys/interface": "error",
    "typescript-sort-keys/string-enum": "error"
  }
}
```

Or enable all rules with defaults

```json
{
  "extends": ["plugin:typescript-sort-keys/recommended"]
}
```

## Supported Rules

<!-- begin rule list -->

**Key**: :heavy_check_mark: = recommended, :wrench: = fixable

<!-- prettier-ignore -->
| Name | Description | :heavy_check_mark: | :wrench: |
| ---- | ----------- | ------------------ | -------- |
| [`typescript-sort-keys/interface`](./docs/rules/interface.md) | require interface keys to be sorted | :heavy_check_mark: | :wrench: |
| [`typescript-sort-keys/string-enum`](./docs/rules/string-enum.md) | require string enum members to be sorted | :heavy_check_mark: | :wrench: |

<!-- end rule list -->

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