[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 2\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\nquote_type = single"
  },
  {
    "path": ".eslintignore",
    "content": "tests/fixtures/**\ndist\nlib\nbuild\n"
  },
  {
    "path": ".eslintrc.js",
    "content": "module.exports = {\n  root: true,\n  parser: '@typescript-eslint/parser',\n  plugins: ['@typescript-eslint', 'eslint-plugin', 'import', 'jest', 'prettier'],\n  env: {\n    es6: true,\n    node: true,\n  },\n  extends: [\n    'eslint:recommended',\n    'plugin:import/errors',\n    'plugin:import/warnings',\n    'plugin:eslint-plugin/all',\n    'plugin:prettier/recommended',\n  ],\n  parserOptions: {\n    ecmaVersion: 10,\n    sourceType: 'module',\n  },\n  rules: {\n    'no-console': 'warn',\n  },\n  overrides: [\n    {\n      files: ['*.ts', '*.tsx'],\n      extends: ['plugin:import/typescript', 'plugin:@typescript-eslint/recommended'],\n\n      rules: {\n        '@typescript-eslint/explicit-function-return-type': 'off',\n        '@typescript-eslint/explicit-module-boundary-types': 'off',\n        '@typescript-eslint/ban-ts-ignore': 'off',\n        '@typescript-eslint/no-explicit-any': 'off',\n      },\n\n      parserOptions: {\n        project: ['./tsconfig.json', './tests/tsconfig.json'],\n      },\n      overrides: [\n        {\n          files: ['tests/**'],\n          env: {\n            jest: true,\n          },\n          rules: {\n            'jest/no-disabled-tests': 'warn',\n            'jest/no-focused-tests': 'error',\n            'jest/no-alias-methods': 'error',\n            'jest/no-identical-title': 'error',\n            'jest/no-jasmine-globals': 'error',\n            'jest/no-test-prefixes': 'error',\n            'jest/no-test-return-statement': 'error',\n            'jest/prefer-to-have-length': 'warn',\n            'jest/prefer-spy-on': 'error',\n            'jest/valid-expect': 'error',\n            'jest/no-test-callback': 'off',\n          },\n        },\n      ],\n    },\n  ],\n  settings: {\n    'import/resolver': {\n      node: {\n        moduleDirectory: ['node_modules', 'src'],\n      },\n    },\n  },\n}\n"
  },
  {
    "path": ".github/workflows/publish.yml",
    "content": "# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created\n# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages\n\nname: Publish\n\non:\n  release:\n    types: [created]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-node@v1\n        with:\n          node-version: 18\n      - run: yarn\n      - run: yarn verify\n\n  publish-npm:\n    needs: build\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-node@v1\n        with:\n          node-version: 18\n          registry-url: https://registry.npmjs.org/\n      - run: yarn\n      - run: npm publish\n        env:\n          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}\n"
  },
  {
    "path": ".github/workflows/tests.yml",
    "content": "# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node\n# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions\n\nname: Tests\n\non:\n  push:\n    branches: [master]\n  pull_request:\n    branches: [master]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    strategy:\n      matrix:\n        node-version: [16.x, 18.x, 20.x]\n\n    steps:\n      - uses: actions/checkout@v2\n      - name: Use Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v1\n        with:\n          node-version: ${{ matrix.node-version }}\n      - run: yarn\n      - run: yarn verify\n        env:\n          CI: true\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# TypeScript v1 declaration files\ntypings/\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n.env.test\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n\n# next.js build output\n.next\n\n# nuxt.js build output\n.nuxt\n\n# vuepress build output\n.vuepress/dist\n\n# Serverless directories\n.serverless/\n\n# FuseBox cache\n.fusebox/\n\n# DynamoDB Local files\n.dynamodb/\n\n# IDE\n.vscode\n\n# Build artifacts\ndist\nbuild\nlib\n"
  },
  {
    "path": ".huskyrc.js",
    "content": "module.exports = {\n  hooks: {\n    'pre-commit': 'lint-staged',\n  },\n}\n"
  },
  {
    "path": ".prettierignore",
    "content": "tests/fixtures/**\nbuild\ndist\nlib\n"
  },
  {
    "path": ".prettierrc.js",
    "content": "module.exports = {\n  printWidth: 90,\n  trailingComma: 'all',\n  arrowParens: 'avoid',\n  semi: false,\n}\n"
  },
  {
    "path": ".yarnrc",
    "content": "save-prefix \"~\"\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [3.3.0] - 2024-10-05\n\n### Changed\n\n- Update @typescript-eslint/parser to >=6\n\n## [3.2.0] - 2024-02-26\n\n### Changed\n\n- Update @typescript-eslint/parser to v7\n\n## [3.1.0] - 2023-10-15\n\n### Changed\n\n- Fix esm export paths in config\n\n## [3.0.0] - 2023-08-30\n\n### Changed\n\n- [BREAKING] Minimal required node.js version is v16\n- [BREAKING] Update @typescript-eslint/parser to v6 🎉\n\n## [2.3.0] - 2023-03-17\n\n### Changed\n\n- Bump deps to fix security vulnerabilities\n\n## [2.2.0] - 2023-03-17\n\n### Changed\n\n- Bump peer dependencies\n\n## [2.1.0] - 2021-11-23\n\n### Changed\n\n- Bump deps to fix security vulnerabilities\n\n## [2.0.0] - 2021-10-15\n\n### Changed\n\n- [BREAKING] Drop support for node v10\n- [BREAKING] Update to eslint v8 🎉\n\n## [1.8.0] - 2021-08-17\n\n### Changed\n\n- Update super old `@typescript-eslint/experimental-utils` dependency\n- Update dev dependencies\n\n## [1.7.0] - 2021-06-18\n\n### Changed\n\n- Update dependencies with security issues\n- Update dev dependencies\n\n## [1.6.0] - 2021-04-02\n\n### Changed\n\n- Update dependencies with security issues\n- Update `package.json` `export` field\n\n## [1.5.0] - 2020-09-22\n\n### Changed\n\n- Use `^` to pin dependencies\n\n## [1.4.0] - 2020-09-22\n\n### Changed\n\n- Support typescript v4 and @typescript-eslint/parser v4 as peer deps\n\n## [1.3.0] - 2020-07-16\n\n### Changed\n\n- Bump @typescript-eslint/parser to v3.5.0\n\n## [1.2.0] - 2020-05-24\n\n### Added\n\n- Explicitly list supported node versions\n\n### Fixed\n\n- Node conditional exports paths\n\n## [1.1.0] - 2020-05-24\n\n### Fixed\n\n- Add explicit dependency of json-schema for @typescript-eslint/experimental-utils\n\n## [1.0.2] - 2020-05-22\n\n### Changed\n\n- Update build artifacts\n\n## [1.0.1] - 2020-05-22\n\n### Fixed\n\n- Fix hanging Publish github action\n\n## [1.0.0] - 2020-05-22\n\n### Changed\n\n- Rewrite to typescript with strong types\n- Leverage helpers and types from @typescript-eslint/experimental-utils\n- Run autofix tests with ESLint Class rather than spawn a child process for eslint runner\n- Heavy refactoring and remove code paths that were never taken\n- Update ESLint config\n- Update to ESLint v7.0.0\n- Update dependencies\n\n### Added\n\n- Follow semver\n- Rollup bundler\n\n## [0.10.0] - 2020-05-21\n\n### Added\n\n- Add ESLint 7 to peerDependencies\n\n## [0.9.0] - 2020-05-19\n\n### Added\n\n- New option to `interface` rule: `requiredFirst` - if `true`, enforce optional properties to come after required ones.\n\n## [0.8.0] - 2020-04-02\n\n### Added\n\n- License\n\n### Fixed\n\n- Fix linter crash on accessing node key name\n\n[3.3.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v3.2.0...v3.3.0\n[3.2.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v3.1.0...v3.2.0\n[3.1.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v3.0.0...v3.1.0\n[3.0.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v2.3.0...v3.0.0\n[2.3.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v2.2.0...v2.3.0\n[2.2.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v2.1.0...v2.2.0\n[2.1.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v2.0.0...v2.1.0\n[2.0.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.8.0...v2.0.0\n[1.8.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.7.0...v1.8.0\n[1.7.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.6.0...v1.7.0\n[1.6.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.5.0...v1.6.0\n[1.5.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.4.0...v1.5.0\n[1.4.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.3.0...v1.4.0\n[1.3.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.2.0...v1.3.0\n[1.2.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.1.0...v1.2.0\n[1.1.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.0.2...v1.1.0\n[1.0.2]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.0.1...v1.0.2\n[1.0.1]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v1.0.0...v1.0.1\n[1.0.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v0.10.0...v1.0.0\n[0.10.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v0.9.0...v0.10.0\n[0.9.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v0.8.0...v0.9.0\n[0.8.0]: https://github.com/infctr/eslint-plugin-typescript-sort-keys/compare/v0.7.0...v0.8.0\n"
  },
  {
    "path": "LICENSE.md",
    "content": "Copyright (c) 2019, infctr\n\nPermission to use, copy, modify, and/or distribute this software for any purpose\nwith or without fee is hereby granted, provided that the above copyright notice\nand this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\nOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\nTORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\nTHIS SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "![Tests](https://github.com/infctr/eslint-plugin-typescript-sort-keys/workflows/Tests/badge.svg?branch=master)\n\n# eslint-plugin-typescript-sort-keys\n\nSort interface and string enum keys\n\nInspired 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))\n\n## Installation\n\nYou'll first need to install\n\n- [eslint](http://eslint.org)\n- [typescript](http://www.typescriptlang.org/)\n- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)\n\n```sh\nyarn add -D eslint typescript @typescript-eslint/parser\n```\n\nNext, install `eslint-plugin-typescript-sort-keys`:\n\n```sh\nyarn add -D eslint-plugin-typescript-sort-keys\n```\n\n**Note:** If you installed ESLint globally then you must also install `eslint-plugin-typescript-sort-keys` globally.\n\n## Usage\n\nSpecify the parser for typescript files in your `.eslintrc` configuration file:\n\n```json\n{\n  \"parser\": \"@typescript-eslint/parser\"\n}\n```\n\nAdd `typescript-sort-keys` to the plugins section. You can omit the `eslint-plugin-` prefix:\n\n```json\n{\n  \"plugins\": [\"typescript-sort-keys\"]\n}\n```\n\nThen configure the rules you want to use under the rules section.\n\n```json\n{\n  \"rules\": {\n    \"typescript-sort-keys/interface\": \"error\",\n    \"typescript-sort-keys/string-enum\": \"error\"\n  }\n}\n```\n\nOr enable all rules with defaults\n\n```json\n{\n  \"extends\": [\"plugin:typescript-sort-keys/recommended\"]\n}\n```\n\n## Supported Rules\n\n<!-- begin rule list -->\n\n**Key**: :heavy_check_mark: = recommended, :wrench: = fixable\n\n<!-- prettier-ignore -->\n| Name | Description | :heavy_check_mark: | :wrench: |\n| ---- | ----------- | ------------------ | -------- |\n| [`typescript-sort-keys/interface`](./docs/rules/interface.md) | require interface keys to be sorted | :heavy_check_mark: | :wrench: |\n| [`typescript-sort-keys/string-enum`](./docs/rules/string-enum.md) | require string enum members to be sorted | :heavy_check_mark: | :wrench: |\n\n<!-- end rule list -->\n"
  },
  {
    "path": "babel.config.js",
    "content": "module.exports = {\n  presets: [\n    ['@babel/preset-env', { targets: { node: 'current' } }],\n    '@babel/preset-typescript',\n  ],\n}\n"
  },
  {
    "path": "docs/rules/interface.md",
    "content": "# require interface keys to be sorted (interface)\n\nWhen declaring multiple properties on an interface, some developers prefer to sort property names alphabetically to be able to find necessary property easier at the later time. Others feel that it adds complexity and becomes burden to maintain.\n\n## Rule Details\n\nThis rule checks all property definitions of an interface declaration and verifies that all keys are sorted alphabetically.\n\nExamples of **incorrect** code for this rule:\n\n```ts\n/* eslint typescript-sort-keys/interface: \"error\" */\n\ninterface U {\n  a: T\n  c: T\n  b: T\n}\ninterface U {\n  a: T\n  c: T\n  b: T\n}\n\n// Case-sensitive by default.\ninterface U {\n  a: T\n  b: T\n  C: T\n}\n\n// Non-natural order by default.\ninterface U {\n  1: T\n  2: T\n  10: T\n}\n\n// Non-required first order by default.\ninterface U {\n  b?: T\n  a: T\n  c: T\n}\n\ninterface U {\n  a: T\n  ['c']: T\n  b: T\n}\n```\n\nExamples of **correct** code for this rule:\n\n```ts\n/* eslint typescript-sort-keys/interface: \"error\" */\n\ninterface U {\n  a: T\n  b: T\n  c: T\n}\ninterface U {\n  a: T\n  b: T\n  c: T\n}\n\n// Case-sensitive by default.\ninterface U {\n  C: T\n  a: T\n  b: T\n}\n\n// Non-natural order by default.\ninterface U {\n  1: T\n  10: T\n  2: T\n}\n\n// Non-required first order by default.\ninterface U {\n  a: T\n  b?: T\n  c: T\n}\n\n// This rule checks computed properties which have a simple name as well.\ninterface U {\n  a: T\n  ['b']: T\n  c: T\n}\n```\n\n## Options\n\n```json\n{\n  \"typescript-sort-keys/interface\": [\n    \"error\",\n    \"asc\",\n    { \"caseSensitive\": true, \"natural\": false, \"requiredFirst\": false }\n  ]\n}\n```\n\nThe 1st option is `\"asc\"` or `\"desc\"`.\n\n- `\"asc\"` (default) - enforce properties to be in ascending order.\n- `\"desc\"` - enforce properties to be in descending order.\n\nThe 2nd option is an object which has 3 properties.\n\n- `caseSensitive` - if `true`, enforce properties to be in case-sensitive order. Default is `true`.\n- `natural` - if `true`, enforce properties to be in natural order. Default is `false`. Natural Order compares strings containing combination of letters and numbers in the way a human being would sort. It basically sorts numerically, instead of sorting alphabetically. So the number 10 comes after the number 3 in Natural Sorting.\n- `requiredFirst` - if `true`, enforce optional properties to come after required ones.\n\nExample for a list:\n\nWith `natural` as true, the ordering would be\n1\n3\n6\n8\n10\n\nWith `natural` as false, the ordering would be\n1\n10\n3\n6\n8\n\n### desc\n\nExamples of **incorrect** code for the `\"desc\"` option:\n\n```ts\n/* eslint typescript-sort-keys/interface: [\"error\", \"desc\"] */\n\ninterface U {\n  b: T\n  c: T\n  a: T\n}\ninterface U {\n  b: T\n  c: T\n  a: T\n}\n\n// Case-sensitive by default.\ninterface U {\n  C: T\n  b: T\n  a: T\n}\n\n// Non-required first order by default.\ninterface U {\n  a: T\n  b?: T\n  c: T\n}\n\n// Non-natural order by default.\ninterface U {\n  10: T\n  2: T\n  1: T\n}\n```\n\nExamples of **correct** code for the `\"desc\"` option:\n\n```ts\n/* eslint typescript-sort-keys/interface: [\"error\", \"desc\"] */\n\ninterface U {\n  c: T\n  b: T\n  a: T\n}\ninterface U {\n  c: T\n  b: T\n  a: T\n}\n\n// Case-sensitive by default.\ninterface U {\n  b: T\n  a: T\n  C: T\n}\n\n// Non-required first order by default.\ninterface U {\n  c: T\n  b?: T\n  a: T\n}\n\n// Non-natural order by default.\ninterface U {\n  2: T\n  10: T\n  1: T\n}\n```\n\n### insensitive\n\nExamples of **incorrect** code for the `{ caseSensitive: false }` option:\n\n```ts\n/* eslint typescript-sort-keys/interface: [\"error\", \"asc\", { caseSensitive: false }] */\n\ninterface U {\n  a: T\n  c: T\n  C: T\n  b: T\n}\ninterface U {\n  a: T\n  C: T\n  c: T\n  b: T\n}\n```\n\nExamples of **correct** code for the `{ caseSensitive: false }` option:\n\n```ts\n/* eslint typescript-sort-keys/interface: [\"error\", \"asc\", { caseSensitive: false }] */\n\ninterface U {\n  a: T\n  b: T\n  c: T\n  C: T\n}\ninterface U {\n  a: T\n  b: T\n  C: T\n  c: T\n}\n```\n\n### natural\n\nExamples of **incorrect** code for the `{natural: true}` option:\n\n```ts\n/* eslint typescript-sort-keys/interface: [\"error\", \"asc\", { natural: true }] */\n\ninterface U {\n  1: T\n  10: T\n  2: T\n}\n```\n\nExamples of **correct** code for the `{natural: true}` option:\n\n```ts\n/* eslint typescript-sort-keys/interface: [\"error\", \"asc\", { natural: true }] */\n\ninterface U {\n  1: T\n  2: T\n  10: T\n}\n```\n\n### required\n\nExamples of **incorrect** code for the `{ requiredFirst: true }` option:\n\n```ts\n/* eslint typescript-sort-keys/interface: [\"error\", \"asc\", { requiredFirst: true }] */\n\ninterface U {\n  d: T\n  c?: T\n  b?: T\n  a: T\n}\n```\n\nExamples of **correct** code for the `{ requiredFirst: true }` option:\n\n```ts\n/* eslint typescript-sort-keys/interface: [\"error\", \"asc\", { requiredFirst: true }] */\n\ninterface U {\n  a: T\n  d: T\n  b?: T\n  c?: T\n}\n```\n\n## When Not To Use It\n\nIf you don't want to notify about properties' order, then it's safe to disable this rule.\n"
  },
  {
    "path": "docs/rules/string-enum.md",
    "content": "# require string enum members to be sorted (string-enum)\n\nWhen declaring multiple members on an string enum, some developers prefer to sort enum member names alphabetically to be able to find necessary members easier at the later time. Others feel that it adds complexity and becomes burden to maintain.\n\n## Rule Details\n\nThis rule checks all members of a string enum declaration and verifies that all keys are sorted alphabetically.\n\nExamples of **incorrect** code for this rule:\n\n```ts\n/* eslint typescript-sort-keys/string-enum: \"error\" */\n\nenum U {\n  a = 'T',\n  c = 'T',\n  b = 'T',\n}\nenum U {\n  a = 'T',\n  c = 'T',\n  b = 'T',\n}\n\n// Case-sensitive by default.\nenum U {\n  a = 'T',\n  b = 'T',\n  C = 'T',\n}\n\nenum U {\n  a = 'T',\n  'c' = 'T',\n  b = 'T',\n}\n```\n\nExamples of **correct** code for this rule:\n\n```ts\n/* eslint typescript-sort-keys/string-enum: \"error\" */\n\nenum U {\n  a = 'T',\n  b = 'T',\n  c = 'T',\n}\nenum U {\n  a = 'T',\n  b = 'T',\n  c = 'T',\n}\n\n// Case-sensitive by default.\nenum U {\n  C = 'T',\n  a = 'T',\n  b = 'T',\n}\n\n// This rule checks computed properties which have a simple name as well.\nenum U {\n  a = 'T',\n  'b' = 'T',\n  c = 'T',\n}\n```\n\n## Options\n\n```json\n{\n  \"typescript-sort-keys/string-enum\": [\"error\", \"asc\", { \"caseSensitive\": true }]\n}\n```\n\nThe 1st option is `\"asc\"` or `\"desc\"`.\n\n- `\"asc\"` (default) - enforce enum members to be in ascending order.\n- `\"desc\"` - enforce enum members to be in descending order.\n\nThe 2nd option is an object which has 2 properties.\n\n- `caseSensitive` - if `true`, enforce enum members to be in case-sensitive order. Default is `true`.\n- `natural` - if `true`, enforce enum members to be in natural order. Default is `false`. Natural Order compares strings containing combination of letters and numbers in the way a human being would sort. It basically sorts numerically, instead of sorting alphabetically. So the number 10 comes after the number 3 in Natural Sorting.\n\n### desc\n\nExamples of **incorrect** code for the `\"desc\"` option:\n\n```ts\n/* eslint typescript-sort-keys/string-enum: [\"error\", \"desc\"] */\n\nenum U {\n  b = 'T',\n  c = 'T',\n  a = 'T',\n}\nenum U {\n  b = 'T',\n  c = 'T',\n  a = 'T',\n}\n\n// Case-sensitive by default.\nenum U {\n  C = 'T',\n  b = 'T',\n  a = 'T',\n}\n```\n\nExamples of **correct** code for the `\"desc\"` option:\n\n```ts\n/* eslint typescript-sort-keys/string-enum: [\"error\", \"desc\"] */\n\nenum U {\n  c = 'T',\n  b = 'T',\n  a = 'T',\n}\nenum U {\n  c = 'T',\n  b = 'T',\n  a = 'T',\n}\n\n// Case-sensitive by default.\nenum U {\n  b = 'T',\n  a = 'T',\n  C = 'T',\n}\n```\n\n### insensitive\n\nExamples of **incorrect** code for the `{ caseSensitive: false }` option:\n\n```ts\n/* eslint typescript-sort-keys/string-enum: [\"error\", \"asc\", { caseSensitive: false }] */\n\nenum U {\n  a = 'T',\n  c = 'T',\n  C = 'T',\n  b = 'T',\n}\nenum U {\n  a = 'T',\n  C = 'T',\n  c = 'T',\n  b = 'T',\n}\n```\n\nExamples of **correct** code for the `{ caseSensitive: false }` option:\n\n```ts\n/* eslint typescript-sort-keys/string-enum: [\"error\", \"asc\", { caseSensitive: false }] */\n\nenum U {\n  a = 'T',\n  b = 'T',\n  c = 'T',\n  C = 'T',\n}\nenum U {\n  a = 'T',\n  b = 'T',\n  C = 'T',\n  c = 'T',\n}\n```\n\n### natural\n\nExamples of **incorrect** code for the `{natural: true}` option:\n\n```ts\n/* eslint typescript-sort-keys/string-enum: [\"error\", \"asc\", { natural: true }] */\n\nenum U {\n  a = 'T',\n  _ = 'T',\n  A = 'T',\n  $ = 'T',\n}\n```\n\nExamples of **correct** code for the `{natural: true}` option:\n\n```ts\n/* eslint typescript-sort-keys/string-enum: [\"error\", \"asc\", { natural: true }] */\n\nenum U {\n  a = 'T',\n  A = 'T',\n  _ = 'T',\n  $ = 'T',\n}\n```\n\n## When Not To Use It\n\nIf you don't want to notify about enum members' order, then it's safe to disable this rule.\n"
  },
  {
    "path": "jest.config.js",
    "content": "module.exports = {\n  testRegex: 'tests/.*\\\\.spec\\\\.(js|ts)$',\n  moduleDirectories: ['node_modules', 'src'],\n}\n"
  },
  {
    "path": "lint-staged.config.js",
    "content": "module.exports = {\n  '*.{js,ts}': ['eslint --fix --ext js,jsx,tsx,ts --max-warnings 0 --no-ignore'],\n  '*.{md,yml,json}': ['prettier --write'],\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"eslint-plugin-typescript-sort-keys\",\n  \"version\": \"3.3.0\",\n  \"description\": \"Sort interface and string enum keys\",\n  \"keywords\": [\n    \"eslint\",\n    \"eslintplugin\",\n    \"eslint-plugin\",\n    \"typescript\"\n  ],\n  \"author\": \"infctr <infctr@gmail.com>\",\n  \"main\": \"./lib/index.cjs.js\",\n  \"repository\": \"git@github.com:infctr/eslint-plugin-typescript-sort-keys.git\",\n  \"url\": \"https://github.com/infctr/eslint-plugin-typescript-sort-keys\",\n  \"files\": [\n    \"/lib\",\n    \"package.json\",\n    \"CHANGELOG.md\",\n    \"LICENSE.md\",\n    \"README.md\"\n  ],\n  \"exports\": {\n    \".\": {\n      \"import\": \"./lib/index.mjs\",\n      \"require\": \"./lib/index.cjs.js\",\n      \"default\": \"./lib/index.cjs.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"scripts\": {\n    \"prepublishOnly\": \"yarn compile\",\n    \"build\": \"yarn rimraf lib && yarn compile\",\n    \"compile\": \"yarn rollup -c\",\n    \"docs\": \"eslint-docs\",\n    \"docs:check\": \"eslint-docs check\",\n    \"lint\": \"eslint --ext .js,.ts src/ tests/\",\n    \"format\": \"prettier --write src/**/*.{js,ts} tests/**/*.{js,ts}\",\n    \"test\": \"yarn jest --watch\",\n    \"coverage\": \"yarn test --coverage --watchAll=false\",\n    \"coverage-preview\": \"http-server -o -p 5000 coverage/lcov-report\",\n    \"typecheck\": \"tsc --noEmit --skipLibCheck\",\n    \"verify\": \"yarn typecheck && yarn lint && yarn build && yarn coverage\"\n  },\n  \"dependencies\": {\n    \"@typescript-eslint/experimental-utils\": \"^5.0.0\",\n    \"json-schema\": \"^0.4.0\",\n    \"natural-compare-lite\": \"^1.4.0\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"~7.14.8\",\n    \"@babel/core\": \"~7.15.0\",\n    \"@babel/preset-env\": \"~7.15.0\",\n    \"@babel/preset-typescript\": \"~7.15.0\",\n    \"@infctr/eslint-docs\": \"~0.4.0\",\n    \"@rollup/plugin-commonjs\": \"~12.0.0\",\n    \"@rollup/plugin-json\": \"~4.0.3\",\n    \"@rollup/plugin-node-resolve\": \"~8.0.0\",\n    \"@rollup/plugin-typescript\": \"~11.1.2\",\n    \"@types/babel__core\": \"~7.1.7\",\n    \"@types/babel__preset-env\": \"~7.9.0\",\n    \"@types/eslint\": \"~7.28.1\",\n    \"@types/jest\": \"~27.0.2\",\n    \"@types/natural-compare-lite\": \"~1.4.0\",\n    \"@types/rimraf\": \"~3.0.1\",\n    \"@types/tmp\": \"~0.2.1\",\n    \"@typescript-eslint/eslint-plugin\": \"~6.4.0\",\n    \"@typescript-eslint/parser\": \"~6.4.0\",\n    \"babel-jest\": \"~26.6.3\",\n    \"babel-plugin-module-resolver\": \"~4.1.0\",\n    \"eslint\": \"~8.0.1\",\n    \"eslint-config-prettier\": \"~9.0.0\",\n    \"eslint-plugin-eslint-plugin\": \"~5.1.1\",\n    \"eslint-plugin-import\": \"~2.28.0\",\n    \"eslint-plugin-jest\": \"~27.2.3\",\n    \"eslint-plugin-prettier\": \"~5.0.0\",\n    \"http-server\": \"~13.0.0\",\n    \"husky\": \"~4.2.5\",\n    \"jest\": \"~29.6.2\",\n    \"lint-staged\": \"~10.5.4\",\n    \"prettier\": \"3.0.1\",\n    \"rimraf\": \"~3.0.2\",\n    \"rollup\": \"~2.10.5\",\n    \"tmp\": \"~0.2.1\",\n    \"tsconfig\": \"~7.0.0\",\n    \"typescript\": \"5.1.6\"\n  },\n  \"peerDependencies\": {\n    \"@typescript-eslint/parser\": \">=6\",\n    \"eslint\": \"^7 || ^8\",\n    \"typescript\": \"^3 || ^4 || ^5\"\n  },\n  \"engines\": {\n    \"node\": \">= 16\"\n  },\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "rollup.config.js",
    "content": "import commonjs from '@rollup/plugin-commonjs'\nimport resolve from '@rollup/plugin-node-resolve'\nimport typescript from '@rollup/plugin-typescript'\nimport json from '@rollup/plugin-json'\nimport tsconfig from 'tsconfig'\nimport fs from 'fs'\nimport assert from 'assert'\n\nconst filePath = tsconfig.resolveSync('.')\n\nassert(filePath)\n\nconst config = tsconfig.readFileSync(filePath)\nconst baseUrl = config.compilerOptions.baseUrl\n\nconst moduleMappings = fs\n  .readdirSync(baseUrl, { withFileTypes: true })\n  .filter(dir => dir.isDirectory())\n  .map(dir => [dir.name, '/'].join(''))\n\nconst external = id =>\n  !id.startsWith('.') &&\n  !id.startsWith('/') &&\n  !id.startsWith('\\0') &&\n  !moduleMappings.some(mapping => id.startsWith(mapping))\n\nexport default [\n  {\n    input: './src/index.ts',\n    external,\n    output: [\n      { dir: 'lib', entryFileNames: '[name].cjs.js', format: 'cjs' },\n      { dir: 'lib', entryFileNames: '[name].mjs', format: 'es' },\n    ],\n    plugins: [commonjs(), resolve(), typescript(), json()],\n  },\n]\n"
  },
  {
    "path": "src/common/options.ts",
    "content": "import { JSONSchema4 } from 'json-schema'\n\nexport enum SortingOrder {\n  Ascending = 'asc',\n  Descending = 'desc',\n}\n\nexport const sortingOrderOptionSchema: JSONSchema4 = {\n  enum: [SortingOrder.Ascending, SortingOrder.Descending],\n}\n\nexport type SortingOrderOption = SortingOrder\n\ninterface CaseSensitiveSortingOption {\n  readonly caseSensitive: boolean\n}\n\ninterface NaturalSortingOption {\n  readonly natural: boolean\n}\n\ninterface RequiredFirstSortingOption {\n  readonly requiredFirst: boolean\n}\n\nexport interface SortingParamsOptions {\n  readonly caseSensitive: CaseSensitiveSortingOption\n  readonly natural: NaturalSortingOption\n  readonly requiredFirst: RequiredFirstSortingOption\n}\n\nexport enum ErrorMessage {\n  InterfaceInvalidOrder = `Expected interface keys to be in {{ requiredFirst }}{{ natural }}{{ insensitive }}{{ order }}ending order. '{{ thisName }}' should be before '{{ prevName }}'.`,\n  StringEnumInvalidOrder = `Expected string enum members to be in {{ natural }}{{ insensitive }}{{ order }}ending order. '{{ thisName }}' should be before '{{ prevName }}'.`,\n}\n"
  },
  {
    "path": "src/config/recommended.ts",
    "content": "export default {\n  plugins: ['typescript-sort-keys'],\n  rules: {\n    'typescript-sort-keys/interface': 'error' as const,\n    'typescript-sort-keys/string-enum': 'error' as const,\n  },\n}\n"
  },
  {
    "path": "src/index.ts",
    "content": "import recommended from './config/recommended'\nimport { rules } from './rules'\n\nconst config = {\n  rules,\n  configs: {\n    recommended,\n  },\n}\n\nexport default config\n"
  },
  {
    "path": "src/rules/index.ts",
    "content": "import { name as interfaceName, rule as interfaceRule } from './interface'\nimport { name as stringEnumName, rule as stringEnumRule } from './string-enum'\n\nexport const rules = {\n  [interfaceName]: interfaceRule,\n  [stringEnumName]: stringEnumRule,\n}\n"
  },
  {
    "path": "src/rules/interface.ts",
    "content": "import { JSONSchema4 } from 'json-schema'\n\nimport { getObjectBody } from 'utils/ast'\nimport { createReporter } from 'utils/plugin'\nimport { createRule, RuleMetaData } from 'utils/rule'\nimport {\n  sortingOrderOptionSchema,\n  SortingOrder,\n  ErrorMessage,\n  SortingOrderOption,\n  SortingParamsOptions,\n} from 'common/options'\n\n/**\n * The name of this rule.\n */\nexport const name = 'interface' as const\n\ntype SortingParams = SortingParamsOptions['caseSensitive'] &\n  SortingParamsOptions['natural'] &\n  SortingParamsOptions['requiredFirst']\n\n/**\n * The options this rule can take.\n */\nexport type Options = [SortingOrderOption] | [SortingOrderOption, Partial<SortingParams>]\n\nconst sortingParamsOptionSchema: JSONSchema4 = {\n  type: 'object',\n  properties: {\n    caseSensitive: {\n      type: 'boolean',\n    },\n    natural: {\n      type: 'boolean',\n    },\n    requiredFirst: {\n      type: 'boolean',\n    },\n  },\n  additionalProperties: false,\n}\n\n/**\n * The schema for the rule options.\n */\nconst schema: JSONSchema4[] = [sortingOrderOptionSchema, sortingParamsOptionSchema]\n\n/**\n * The default options for the rule.\n */\nconst defaultOptions: Options = [\n  SortingOrder.Ascending,\n  { caseSensitive: true, natural: false, requiredFirst: false },\n]\n\n/**\n * The possible error messages.\n */\nconst errorMessages = {\n  invalidOrder: ErrorMessage.InterfaceInvalidOrder,\n} as const\n\n/**\n * The meta data for this rule.\n */\nconst meta: RuleMetaData<keyof typeof errorMessages> = {\n  type: 'suggestion',\n  docs: {\n    description: 'require interface keys to be sorted',\n    recommended: 'warn',\n  },\n  messages: errorMessages,\n  fixable: 'code',\n  schema,\n}\n\n/**\n * Create the rule.\n */\nexport const rule = createRule<keyof typeof errorMessages, Options>({\n  name,\n  meta,\n  defaultOptions,\n\n  create(context) {\n    const compareNodeListAndReport = createReporter(context, ({ loc }) => ({\n      loc,\n      messageId: 'invalidOrder',\n    }))\n\n    return {\n      TSInterfaceDeclaration(node) {\n        const body = getObjectBody(node)\n\n        return compareNodeListAndReport(body)\n      },\n\n      TSTypeLiteral(node) {\n        const body = getObjectBody(node)\n\n        return compareNodeListAndReport(body)\n      },\n    }\n  },\n})\n"
  },
  {
    "path": "src/rules/string-enum.ts",
    "content": "import { JSONSchema4 } from 'json-schema'\nimport { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'\n\nimport { getObjectBody } from 'utils/ast'\nimport { createReporter } from 'utils/plugin'\nimport { createRule, RuleMetaData } from 'utils/rule'\nimport {\n  sortingOrderOptionSchema,\n  SortingOrder,\n  ErrorMessage,\n  SortingOrderOption,\n  SortingParamsOptions,\n} from 'common/options'\n\n/**\n * The name of this rule.\n */\nexport const name = 'string-enum' as const\n\ntype SortingParams = SortingParamsOptions['caseSensitive'] &\n  SortingParamsOptions['natural']\n\n/**\n * The options this rule can take.\n */\nexport type Options = [SortingOrderOption] | [SortingOrderOption, Partial<SortingParams>]\n\nconst sortingParamsOptionSchema: JSONSchema4 = {\n  type: 'object',\n  properties: {\n    caseSensitive: {\n      type: 'boolean',\n    },\n    natural: {\n      type: 'boolean',\n    },\n  },\n  additionalProperties: false,\n}\n\n/**\n * The schema for the rule options.\n */\nconst schema: JSONSchema4[] = [sortingOrderOptionSchema, sortingParamsOptionSchema]\n\n/**\n * The default options for the rule.\n */\nconst defaultOptions: Options = [\n  SortingOrder.Ascending,\n  { caseSensitive: true, natural: false },\n]\n\n/**\n * The possible error messages.\n */\nconst errorMessages = {\n  invalidOrder: ErrorMessage.StringEnumInvalidOrder,\n} as const\n\n/**\n * The meta data for this rule.\n */\nconst meta: RuleMetaData<keyof typeof errorMessages> = {\n  type: 'suggestion',\n  docs: {\n    description: 'require string enum members to be sorted',\n    recommended: 'warn',\n  },\n  messages: errorMessages,\n  fixable: 'code',\n  schema,\n}\n\n/**\n * Create the rule.\n */\nexport const rule = createRule<keyof typeof errorMessages, Options>({\n  name,\n  meta,\n  defaultOptions,\n\n  create(context) {\n    const compareNodeListAndReport = createReporter(context, ({ loc }) => ({\n      loc,\n      messageId: 'invalidOrder',\n    }))\n\n    return {\n      TSEnumDeclaration(node) {\n        const body = getObjectBody(node) as TSESTree.TSEnumMember[]\n        const isStringEnum = body.every(\n          (member: TSESTree.TSEnumMember) =>\n            member.initializer &&\n            member.initializer.type === AST_NODE_TYPES.Literal &&\n            typeof member.initializer.value === 'string',\n        )\n\n        if (isStringEnum) {\n          compareNodeListAndReport(body)\n        }\n      },\n    }\n  },\n})\n"
  },
  {
    "path": "src/utils/ast.ts",
    "content": "import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'\n\nimport { indexSignature } from './common'\n\nexport function getObjectBody(\n  node:\n    | TSESTree.TSEnumDeclaration\n    | TSESTree.TSInterfaceDeclaration\n    | TSESTree.TSTypeLiteral,\n) {\n  switch (node.type) {\n    case AST_NODE_TYPES.TSInterfaceDeclaration:\n      return node.body.body\n    case AST_NODE_TYPES.TSEnumDeclaration:\n    case AST_NODE_TYPES.TSTypeLiteral:\n      return node.members\n  }\n}\n\nfunction getProperty(node: TSESTree.Node) {\n  switch (node.type) {\n    case AST_NODE_TYPES.TSIndexSignature: {\n      const [identifier] = node.parameters\n\n      return {\n        ...identifier,\n        // Override name for error message readability and weight calculation\n        name: indexSignature.create(\n          (identifier as TSESTree.Parameter & { name: string }).name,\n        ),\n      }\n    }\n\n    case AST_NODE_TYPES.TSPropertySignature:\n    case AST_NODE_TYPES.TSMethodSignature:\n      return node.key\n\n    case AST_NODE_TYPES.TSEnumMember:\n      return node.id\n\n    default:\n      return undefined\n  }\n}\n\n/**\n * Gets the property name of the given `Property` node.\n *\n * - If the property's key is an `Identifier` node, this returns the key's name\n *   whether it's a computed property or not.\n * - If the property has a static name, this returns the static name.\n * - Otherwise, this returns undefined.\n *\n *     a.b           // => \"b\"\n *     a[\"b\"]        // => \"b\"\n *     a['b']        // => \"b\"\n *     a[`b`]        // => \"b\"\n *     a[100]        // => \"100\"\n *     a[b]          // => undefined\n *     a[\"a\" + \"b\"]  // => undefined\n *     a[tag`b`]     // => undefined\n *     a[`${b}`]     // => undefined\n *\n *     let a = {b: 1}            // => \"b\"\n *     let a = {[\"b\"]: 1}        // => \"b\"\n *     let a = {['b']: 1}        // => \"b\"\n *     let a = {[`b`]: 1}        // => \"b\"\n *     let a = {[100]: 1}        // => \"100\"\n *     let a = {[b]: 1}          // => undefined\n *     let a = {[\"a\" + \"b\"]: 1}  // => undefined\n *     let a = {[tag`b`]: 1}     // => undefined\n *     let a = {[`${b}`]: 1}     // => undefined\n */\nexport function getPropertyName(node: TSESTree.TypeElement | TSESTree.TSEnumMember) {\n  const property = getProperty(node)\n\n  if (!property) {\n    return undefined\n  }\n\n  switch (property.type) {\n    case AST_NODE_TYPES.Literal:\n      return String(property.value)\n\n    case AST_NODE_TYPES.Identifier:\n      return property.name\n\n    default:\n      return undefined\n  }\n}\n\nexport function getPropertyIsOptional(\n  node: TSESTree.TypeElement | TSESTree.TSEnumMember,\n) {\n  switch (node.type) {\n    case AST_NODE_TYPES.TSMethodSignature:\n    case AST_NODE_TYPES.TSPropertySignature:\n      return Boolean(node.optional)\n  }\n\n  return false\n}\n"
  },
  {
    "path": "src/utils/common.ts",
    "content": "const nameToIndexSignature = (x: string) => `[index: ${x}]`\nconst indexSignatureRegexp = new RegExp(\n  `^${nameToIndexSignature('.+')}`.replace('[', '\\\\[').replace(']', '\\\\]'),\n)\n\nexport const indexSignature = {\n  create: nameToIndexSignature,\n  regex: indexSignatureRegexp,\n}\n"
  },
  {
    "path": "src/utils/compare.ts",
    "content": "import naturalCompare from 'natural-compare-lite'\n\nimport { indexSignature } from './common'\n\nfunction charCompare(a: string, b: string) {\n  if (a < b) {\n    return -1\n  }\n\n  if (b < a) {\n    return 1\n  }\n\n  return 0\n}\n\nfunction getWeight(value: string) {\n  switch (true) {\n    // Custom name for index signature used here\n    case indexSignature.regex.test(value):\n      return 100\n    default:\n      return 0\n  }\n}\n\nfunction weightedCompare(\n  a: string,\n  b: string,\n  compareFn: (a: string, b: string) => number,\n) {\n  return compareFn(a, b) - getWeight(a) + getWeight(b)\n}\n\nconst ascending = (a: string, b: string) => {\n  return weightedCompare(a, b, charCompare)\n}\n\nconst ascendingInsensitive = (a: string, b: string) => {\n  return weightedCompare(a.toLowerCase(), b.toLowerCase(), charCompare)\n}\n\nconst ascendingNatural = (a: string, b: string) => {\n  return weightedCompare(a, b, naturalCompare)\n}\n\nconst ascendingInsensitiveNatural = (a: string, b: string) => {\n  return weightedCompare(a.toLowerCase(), b.toLowerCase(), naturalCompare)\n}\n\n/**\n * Functions which check that the given 2 names are in specific order.\n */\nexport const compareFn =\n  (isAscending: boolean, isInsensitive: boolean, isNatural: boolean) =>\n  (...args: [string?, string?]) => {\n    if (args.filter(Boolean).length !== 2) {\n      return 0\n    }\n\n    const input = (isAscending ? args : args.reverse()) as [string, string]\n\n    if (isInsensitive && isNatural) {\n      return ascendingInsensitiveNatural(...input)\n    }\n\n    if (!isInsensitive && isNatural) {\n      return ascendingNatural(...input)\n    }\n\n    if (isInsensitive && !isNatural) {\n      return ascendingInsensitive(...input)\n    }\n\n    return ascending(...input)\n  }\n"
  },
  {
    "path": "src/utils/plugin.ts",
    "content": "import { TSESTree, AST_TOKEN_TYPES } from '@typescript-eslint/experimental-utils'\nimport {\n  RuleContext as UtilRuleContext,\n  RuleFixer,\n  RuleFix,\n  SourceCode,\n} from '@typescript-eslint/experimental-utils/dist/ts-eslint'\nimport assert from 'assert'\n\nimport { SortingOrder } from 'common/options'\nimport { Options as InterfaceRuleOptions } from 'rules/interface'\nimport { Options as StringEnumRuleOptions } from 'rules/string-enum'\nimport { getPropertyName, getPropertyIsOptional } from './ast'\nimport { compareFn } from './compare'\n\ntype RuleOptions = InterfaceRuleOptions & StringEnumRuleOptions\n\ntype TSType = TSESTree.TypeElement | TSESTree.TSEnumMember\n\nfunction createNodeSwapper(context: UtilRuleContext<string, RuleOptions>) {\n  const sourceCode = context.getSourceCode() as SourceCode & {\n    lineStartIndices: number[]\n  }\n\n  /**\n   * Returns the indent range of a node if it's the first on its line.\n   * Otherwise, returns a range starting immediately after the previous sibling.\n   */\n  function getIndentRange(node: TSESTree.Node | TSESTree.Comment): TSESTree.Range {\n    const prevSibling = sourceCode.getTokenBefore(node)\n    const end = node.range[0]\n    const start =\n      prevSibling && prevSibling.loc.start.line === node.loc.start.line\n        ? prevSibling.range[1] + 1\n        : node.range[0] - node.loc.start.column\n\n    return [start, end]\n  }\n\n  function getRangeWithIndent(node: TSESTree.Comment) {\n    return [getIndentRange(node)[0], node.range[1]]\n  }\n\n  /**\n   * Returns the range for the entire line, including EOL, if node is the only\n   * token on its lines. Otherwise, returns the node range.\n   */\n  function getLineRange(node: TSESTree.Comment): TSESTree.Range {\n    const [start] = getRangeWithIndent(node)\n    const index = sourceCode.lineStartIndices.findIndex(n => start === n)\n\n    if (index < 0) {\n      // Node is not at the beginning of the line\n      return node.range\n    }\n\n    const lines = 1 + node.loc.end.line - node.loc.start.line\n\n    return [\n      sourceCode.lineStartIndices[index],\n      sourceCode.lineStartIndices[index + lines],\n    ]\n  }\n\n  function getIndentText(node: TSESTree.Node) {\n    return sourceCode.text.slice(...getIndentRange(node))\n  }\n\n  function getNodePunctuator(node: TSESTree.Node) {\n    const punctuator = sourceCode.getTokenAfter(node, {\n      filter: n => n.type === AST_TOKEN_TYPES.Punctuator && n.value !== ':',\n      includeComments: false,\n    })\n\n    // Check the punctuator value outside of filter because we\n    // want to stop traversal on any terminating punctuator\n    return punctuator && /^[,;]$/.test(punctuator.value) ? punctuator : undefined\n  }\n\n  return (\n    fixer: RuleFixer,\n    nodePositions: Map<TSType, { initial: number; final: number }>,\n    currentNode: TSType,\n    replaceNode: TSType,\n  ) =>\n    [currentNode, replaceNode].reduce<RuleFix[]>((acc, node) => {\n      const otherNode = node === currentNode ? replaceNode : currentNode\n      const comments = sourceCode.getCommentsBefore(node)\n      const nextSibling = sourceCode.getTokenAfter(node)\n      const isLastReplacingLast =\n        nodePositions.get(node)?.final === nodePositions.size - 1 &&\n        nodePositions.get(node)?.final === nodePositions.get(otherNode)?.initial\n\n      let text = [\n        comments.length ? getIndentText(node) : '',\n        sourceCode.getText(node),\n      ].join('')\n\n      // If nextSibling is the node punctuator, remove it\n      if (nextSibling === getNodePunctuator(node)) {\n        acc.push(fixer.remove(nextSibling))\n      }\n\n      if (!/[,;]$/.test(text)) {\n        // Add a punctuator if the node doesn't already have one\n        text += ','\n      }\n\n      if (isLastReplacingLast) {\n        // If we're moving the last node to its final destination, we can remove the punctuator\n        text = text.replace(/,$/, '')\n      }\n\n      if (comments.length) {\n        // Insert leading comments above the other node\n        acc.push(\n          fixer.insertTextBefore(\n            otherNode,\n            comments\n              .map(comment => sourceCode.getText(comment as any))\n              .concat('')\n              .join('\\n'),\n          ),\n        )\n      }\n\n      acc.push(\n        // Insert the node before the other node\n        fixer.insertTextBefore(otherNode, text),\n        // Remove the original instance of node\n        fixer.remove(node),\n        // Remove the original instances of node comments\n        ...comments.map(n => fixer.removeRange(getLineRange(n))),\n      )\n\n      return acc\n    }, [])\n}\n\nexport function createReporter<MessageIds extends string>(\n  context: UtilRuleContext<MessageIds, RuleOptions>,\n  createReportObject: (node: TSESTree.Node) => {\n    readonly loc: TSESTree.SourceLocation\n    readonly messageId: MessageIds\n  },\n) {\n  // Parse options.\n  const order = context.options[0] || SortingOrder.Ascending\n  const options = context.options[1]\n  const isAscending = order === SortingOrder.Ascending\n  const isInsensitive = (options && options.caseSensitive) === false\n  const isNatural = Boolean(options && options.natural)\n  const isRequiredFirst = (options && options.requiredFirst) === true\n\n  const compare = compareFn(isAscending, isInsensitive, isNatural)\n  const swapNodes = createNodeSwapper(context)\n\n  return (body: TSType[]) => {\n    const sortedBody = isRequiredFirst\n      ? [\n          ...body\n            .slice(0)\n            .filter(node => !getPropertyIsOptional(node))\n            .sort((a, b) => compare(getPropertyName(a), getPropertyName(b))),\n          ...body\n            .slice(0)\n            .filter(node => getPropertyIsOptional(node))\n            .sort((a, b) => compare(getPropertyName(a), getPropertyName(b))),\n        ]\n      : body.slice(0).sort((a, b) => compare(getPropertyName(a), getPropertyName(b)))\n\n    const nodePositions = new Map(\n      body.map(n => [n, { initial: body.indexOf(n), final: sortedBody.indexOf(n) }]),\n    )\n\n    for (let i = 1; i < body.length; i += 1) {\n      const prevNode = body[i - 1]\n      const currentNode = body[i]\n      const prevNodeName = getPropertyName(prevNode)\n      const currentNodeName = getPropertyName(currentNode)\n\n      if (\n        (!isRequiredFirst && compare(prevNodeName, currentNodeName) > 0) ||\n        (isRequiredFirst &&\n          getPropertyIsOptional(prevNode) === getPropertyIsOptional(currentNode) &&\n          compare(prevNodeName, currentNodeName) > 0) ||\n        (isRequiredFirst &&\n          getPropertyIsOptional(prevNode) !== getPropertyIsOptional(currentNode) &&\n          getPropertyIsOptional(prevNode))\n      ) {\n        const targetPosition = sortedBody.indexOf(currentNode)\n        const replaceNode = body[targetPosition]\n        const { loc, messageId } = createReportObject(currentNode)\n\n        // Sanity check\n        assert(loc, 'createReportObject return value must include a node location')\n        assert(\n          messageId,\n          'createReportObject return value must include a problem message',\n        )\n\n        context.report({\n          loc,\n          messageId,\n          node: currentNode,\n          data: {\n            thisName: currentNodeName,\n            prevName: prevNodeName,\n            order,\n            insensitive: isInsensitive ? 'insensitive ' : '',\n            natural: isNatural ? 'natural ' : '',\n            requiredFirst: isRequiredFirst ? 'required first ' : '',\n          },\n\n          fix: fixer => {\n            if (currentNode !== replaceNode) {\n              return swapNodes(fixer, nodePositions, currentNode, replaceNode)\n            }\n\n            return null\n          },\n        })\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "src/utils/rule.ts",
    "content": "import { ESLintUtils } from '@typescript-eslint/experimental-utils'\nimport {\n  ReportDescriptor,\n  RuleContext as UtilRuleContext,\n  RuleListener,\n  RuleMetaData as UtilRuleMetaData,\n  RuleMetaDataDocs as UtilRuleMetaDataDocs,\n  RuleModule,\n} from '@typescript-eslint/experimental-utils/dist/ts-eslint'\n\nexport type BaseOptions = readonly unknown[]\n\n// \"url\" will be set automatically.\nexport type RuleMetaDataDocs = Omit<UtilRuleMetaDataDocs, 'url'>\n\n// \"docs.url\" will be set automatically.\nexport type RuleMetaData<MessageIds extends string> = {\n  readonly docs: RuleMetaDataDocs\n} & Omit<UtilRuleMetaData<MessageIds>, 'docs'>\n\nexport type RuleResult<MessageIds extends string, Options extends BaseOptions> = {\n  readonly context: UtilRuleContext<MessageIds, Options>\n  readonly descriptors: readonly ReportDescriptor<MessageIds>[]\n}\n\ntype Mutable<T> = {\n  -readonly [P in keyof T]: T[P]\n}\n\n/**\n * Create a rule.\n */\nexport function createRule<MessageIds extends string, Options extends BaseOptions>(data: {\n  readonly name: string\n  readonly meta: RuleMetaData<MessageIds>\n  readonly defaultOptions: Options\n  readonly create: (\n    context: UtilRuleContext<MessageIds, Options>,\n    optionsWithDefault: Mutable<Options>,\n  ) => RuleListener\n}): RuleModule<MessageIds, Options, RuleListener> {\n  return ESLintUtils.RuleCreator(\n    name =>\n      `https://github.com/infctr/eslint-plugin-typescript-sort-keys/blob/master/docs/rules/${name}.md`,\n  )(data)\n}\n"
  },
  {
    "path": "tests/autofix.spec.ts",
    "content": "import path from 'path'\nimport fs from 'fs'\nimport tmp from 'tmp'\nimport { ESLint, Linter } from 'eslint'\n\nimport plugin from '../src'\nimport recommended from 'config/recommended'\nimport { SortingOrder } from 'common/options'\nimport { typescript } from './helpers/configs'\n\ndescribe('autofix', () => {\n  beforeEach(() => {\n    tmp.setGracefulCleanup()\n  })\n\n  it.each([\n    [recommended, 'autofix.output.ts'],\n    [\n      {\n        plugins: recommended.plugins,\n        rules: {\n          ...recommended.rules,\n          'typescript-sort-keys/interface': [\n            'error' as const,\n            SortingOrder.Ascending,\n            { caseSensitive: true, natural: true, requiredFirst: true },\n          ] as Linter.RuleEntry,\n        },\n      },\n      'requiredFirst.output.ts',\n    ],\n  ])(\n    'should autofix and properly format comments and indent level',\n    async (config, fileName) => {\n      const { name: tmpDir } = tmp.dirSync({\n        prefix: 'typescript-sort-keys-',\n        unsafeCleanup: true,\n      })\n\n      const testFilePath = path.join(tmpDir, 'autofix.ts')\n      const input = fs.readFileSync('tests/fixtures/autofix.input.ts', 'utf8')\n      const expected = fs.readFileSync(`tests/fixtures/${fileName}`, 'utf8')\n\n      fs.writeFileSync(testFilePath, input)\n\n      const eslint = new ESLint({\n        overrideConfig: {\n          ...config,\n          parser: typescript.parser,\n          parserOptions: { sourceType: 'module' },\n        },\n        plugins: {\n          'typescript-sort-keys': plugin,\n        },\n        useEslintrc: false,\n        fix: true,\n      })\n\n      const results = await eslint.lintFiles(testFilePath)\n      const result = results[0]\n\n      expect(result.messages).toHaveLength(0)\n      expect(result.errorCount).toBe(0)\n      expect(result.warningCount).toBe(0)\n      expect(result.fixableErrorCount).toBe(0)\n      expect(result.fixableWarningCount).toBe(0)\n\n      await ESLint.outputFixes(results)\n\n      const output = fs.readFileSync(testFilePath, 'utf8')\n\n      expect(output).toStrictEqual(expected)\n    },\n  )\n})\n"
  },
  {
    "path": "tests/config.spec.ts",
    "content": "import { readdirSync } from 'fs'\n\nimport plugin from '../src'\n\ndescribe('recommended config', () => {\n  const RULE_NAME_PREFIX = 'typescript-sort-keys/'\n  const {\n    rules,\n    configs: {\n      recommended: { rules: configRules },\n    },\n  } = plugin\n\n  const entriesToObject = <T = unknown>(\n    value: readonly [string, T][],\n  ): Record<string, T> => {\n    return value.reduce<Record<string, T>>((memo, [k, v]) => {\n      memo[k] = v\n      return memo\n    }, {})\n  }\n\n  const ruleConfigs = Object.entries(rules)\n    .filter(([, rule]) => rule.meta.docs && rule.meta.docs.recommended !== false)\n    .map<[string, string]>(([name, rule]) => [\n      `${RULE_NAME_PREFIX}${name}`,\n      rule.meta.docs && rule.meta.docs.recommended ? 'error' : 'off',\n    ])\n\n  it('contains all recommended rules', () => {\n    expect(entriesToObject(ruleConfigs)).toEqual(configRules)\n  })\n})\n\ndescribe('plugin', () => {\n  const ruleFiles: readonly string[] = readdirSync('./src/rules').filter(\n    file => file !== 'index.ts' && file.endsWith('.ts'),\n  )\n\n  const configFiles: readonly string[] = readdirSync('./src/config').filter(\n    file => file !== 'index.ts' && file.endsWith('.ts'),\n  )\n\n  it('should have all the rules', () => {\n    expect(plugin).toHaveProperty('rules')\n    expect(Object.keys(plugin.rules)).toHaveLength(ruleFiles.length)\n  })\n\n  it('should have all the configs', () => {\n    expect(plugin).toHaveProperty('configs')\n    expect(Object.keys(plugin.configs)).toHaveLength(configFiles.length)\n  })\n})\n"
  },
  {
    "path": "tests/fixtures/autofix.input.ts",
    "content": "// So typescript treats this as a module\nexport {};\n\nclass GraphQLExtension<T> {_: T}\n\ninterface GraphQLResponse {}\n\nnamespace Koa {\n  export interface Context {}\n}\n\nconst inlineArrow: (props: {foo: boolean; baz?: boolean; bar: boolean}) => null = ({...props}) => null;\n\nconst inlineArrow2: (props: {foo: boolean; bar?: boolean; baz: boolean}) => null = ({...props}) => null;\n\nconst inlineWeird: (props: {foo?: boolean;baz: boolean,\n          bar: boolean}) => null = ({...props}) => null;\n\nfunction inlineGeneric<T extends { foo: boolean; baz?: boolean; bar: boolean}>({...props}: T | {foo: boolean; bar: boolean; baz?: boolean}) {\n   return null\n}\n\nenum InlineEnum {e=\"T\", c=\"T\", d=\"T\", b=\"T\", a=\"T\"}\n\nenum InlineEnum2 {Foo = 'FOO',Baz = 'BAZ', Bar = 'BAR' }\n\nenum InlineEnum3 {b_=\"T\", c=\"T\", C=\"T\"}\n\nenum WeirdEnum {\n  Foo = 'FOO',Baz = 'BAZ',    Bar = 'BAR',}\n\ninterface InlineInterface {e: \"T\"; c?:\"T\"; d:\"T\"; b:\"T\"; a?:\"T\"}\n\nclass Class extends GraphQLExtension<{\n  graphqlResponse: GraphQLResponse;\n  context?: Koa.Context;\n}> {\n  public method(o: {\n    graphqlResponse: GraphQLResponse;\n    context?: Koa.Context;\n  }): void | { graphqlResponse?: GraphQLResponse; context?: Koa.Context } {\n    //\n  }\n}\n\ninterface Interface {\n  /**\n   * %foo\n   */\n  foo: boolean;\n  /* %baz */\n  baz?: boolean;\n  // %bar\n  bar: boolean;\n}\n\ntype Type1<TKey extends string> = Partial<{\n  // %foo\n  foo?: boolean;\n  /* %baz */ baz: boolean;\n\n  /**\n   * %bar\n   */\n  bar: boolean;\n}> & {/* %foo */\n  foo?: boolean;\n\n// %baz\n  baz: boolean;\n  /**\n   * %bar\n   */\n  bar: boolean;\n} & {\n    [K in keyof TKey]: boolean;\n  };\n\nenum StringEnum {\n  /* %foo */\n  Foo = 'FOO',\n\n  // %baz\n  Baz = 'BAZ',\n\n  /**\n   * %bar\n   */\n  Bar = 'BAR',\n}\n\ntype Type2 = {/* %foo */\n  foo?: boolean;\n\n// %baz\n  baz: boolean;\n  /**\n   * %bar\n   */\n  bar: boolean;\n}\n\ninterface ClockConstructor {\n  new (hour: number, minute: number): ClockInterface;\n  new (hour: number): ClockInterface;\n}\n\ninterface ClockInterface {\n  tick(): void;\n}\n\ninterface Methods {\n  /**\n   * %foo\n   */\n  quux(): any;\n  qux?();\n  quuz?(): any;\n  foo: boolean;\n  /* %baz */\n  baz: boolean;\n  // %bar\n  bar(): boolean;\n  ['grault']?(): void;\n  ['corge']?(): void;\n  ['garply']();\n}\n"
  },
  {
    "path": "tests/fixtures/autofix.output.ts",
    "content": "// So typescript treats this as a module\nexport {};\n\nclass GraphQLExtension<T> {_: T}\n\ninterface GraphQLResponse {}\n\nnamespace Koa {\n  export interface Context {}\n}\n\nconst inlineArrow: (props: {bar: boolean, baz?: boolean; foo: boolean;}) => null = ({...props}) => null;\n\nconst inlineArrow2: (props: {bar?: boolean; baz: boolean, foo: boolean;}) => null = ({...props}) => null;\n\nconst inlineWeird: (props: {bar: boolean,baz: boolean,\n          foo?: boolean;}) => null = ({...props}) => null;\n\nfunction inlineGeneric<T extends { bar: boolean, baz?: boolean; foo: boolean;}>({...props}: T | {bar: boolean; baz?: boolean, foo: boolean;}) {\n   return null\n}\n\nenum InlineEnum {a=\"T\", b=\"T\", c=\"T\", d=\"T\", e=\"T\"}\n\nenum InlineEnum2 {Bar = 'BAR',Baz = 'BAZ', Foo = 'FOO' }\n\nenum InlineEnum3 {C=\"T\", b_=\"T\", c=\"T\"}\n\nenum WeirdEnum {\n  Bar = 'BAR',Baz = 'BAZ',    Foo = 'FOO'}\n\ninterface InlineInterface {a?:\"T\", b:\"T\"; c?:\"T\"; d:\"T\"; e: \"T\";}\n\nclass Class extends GraphQLExtension<{\n  context?: Koa.Context;\n  graphqlResponse: GraphQLResponse;\n}> {\n  public method(o: {\n    context?: Koa.Context;\n    graphqlResponse: GraphQLResponse;\n  }): void | { context?: Koa.Context, graphqlResponse?: GraphQLResponse; } {\n    //\n  }\n}\n\ninterface Interface {\n  // %bar\n  bar: boolean;\n  /* %baz */\n  baz?: boolean;\n  /**\n   * %foo\n   */\n  foo: boolean;\n}\n\ntype Type1<TKey extends string> = Partial<{\n  /**\n   * %bar\n   */\n  bar: boolean;\n  /* %baz */ baz: boolean;\n\n  // %foo\n  foo?: boolean;\n}> & {\n  /**\n   * %bar\n   */\n  bar: boolean;\n\n// %baz\n  baz: boolean;\n  /* %foo */\n  foo?: boolean;\n} & {\n    [K in keyof TKey]: boolean;\n  };\n\nenum StringEnum {\n  /**\n   * %bar\n   */\n  Bar = 'BAR',\n\n  // %baz\n  Baz = 'BAZ',\n\n  /* %foo */\n  Foo = 'FOO'\n}\n\ntype Type2 = {\n  /**\n   * %bar\n   */\n  bar: boolean;\n\n// %baz\n  baz: boolean;\n  /* %foo */\n  foo?: boolean;\n}\n\ninterface ClockConstructor {\n  new (hour: number, minute: number): ClockInterface;\n  new (hour: number): ClockInterface;\n}\n\ninterface ClockInterface {\n  tick(): void;\n}\n\ninterface Methods {\n  // %bar\n  bar(): boolean;\n  /* %baz */\n  baz: boolean;\n  ['corge']?(): void;\n  foo: boolean;\n  ['garply']();\n  ['grault']?(): void;\n  /**\n   * %foo\n   */\n  quux(): any;\n  quuz?(): any;\n  qux?();\n}\n"
  },
  {
    "path": "tests/fixtures/requiredFirst.output.ts",
    "content": "// So typescript treats this as a module\nexport {};\n\nclass GraphQLExtension<T> {_: T}\n\ninterface GraphQLResponse {}\n\nnamespace Koa {\n  export interface Context {}\n}\n\nconst inlineArrow: (props: {bar: boolean, foo: boolean; baz?: boolean;}) => null = ({...props}) => null;\n\nconst inlineArrow2: (props: {baz: boolean, foo: boolean; bar?: boolean;}) => null = ({...props}) => null;\n\nconst inlineWeird: (props: {bar: boolean,baz: boolean,\n          foo?: boolean;}) => null = ({...props}) => null;\n\nfunction inlineGeneric<T extends { bar: boolean, foo: boolean; baz?: boolean;}>({...props}: T | {bar: boolean; foo: boolean; baz?: boolean}) {\n   return null\n}\n\nenum InlineEnum {a=\"T\", b=\"T\", c=\"T\", d=\"T\", e=\"T\"}\n\nenum InlineEnum2 {Bar = 'BAR',Baz = 'BAZ', Foo = 'FOO' }\n\nenum InlineEnum3 {C=\"T\", b_=\"T\", c=\"T\"}\n\nenum WeirdEnum {\n  Bar = 'BAR',Baz = 'BAZ',    Foo = 'FOO'}\n\ninterface InlineInterface {b:\"T\"; d:\"T\"; e: \"T\"; a?:\"T\", c?:\"T\";}\n\nclass Class extends GraphQLExtension<{\n  graphqlResponse: GraphQLResponse;\n  context?: Koa.Context;\n}> {\n  public method(o: {\n    graphqlResponse: GraphQLResponse;\n    context?: Koa.Context;\n  }): void | { context?: Koa.Context, graphqlResponse?: GraphQLResponse; } {\n    //\n  }\n}\n\ninterface Interface {\n  // %bar\n  bar: boolean;\n  /**\n   * %foo\n   */\n  foo: boolean;\n  /* %baz */\n  baz?: boolean;\n}\n\ntype Type1<TKey extends string> = Partial<{\n  /**\n   * %bar\n   */\n  bar: boolean;\n  /* %baz */ baz: boolean;\n\n  // %foo\n  foo?: boolean;\n}> & {\n  /**\n   * %bar\n   */\n  bar: boolean;\n\n// %baz\n  baz: boolean;\n  /* %foo */\n  foo?: boolean;\n} & {\n    [K in keyof TKey]: boolean;\n  };\n\nenum StringEnum {\n  /**\n   * %bar\n   */\n  Bar = 'BAR',\n\n  // %baz\n  Baz = 'BAZ',\n\n  /* %foo */\n  Foo = 'FOO'\n}\n\ntype Type2 = {\n  /**\n   * %bar\n   */\n  bar: boolean;\n\n// %baz\n  baz: boolean;\n  /* %foo */\n  foo?: boolean;\n}\n\ninterface ClockConstructor {\n  new (hour: number, minute: number): ClockInterface;\n  new (hour: number): ClockInterface;\n}\n\ninterface ClockInterface {\n  tick(): void;\n}\n\ninterface Methods {\n  // %bar\n  bar(): boolean;\n  /* %baz */\n  baz: boolean;\n  foo: boolean;\n  ['garply']();\n  /**\n   * %foo\n   */\n  quux(): any;\n  ['corge']?(): void;\n  ['grault']?(): void;\n  quuz?(): any;\n  qux?();\n}\n"
  },
  {
    "path": "tests/helpers/configs.ts",
    "content": "import { Linter } from 'eslint'\nimport * as path from 'path'\n\nexport const filename = path.join(__dirname, 'file.ts')\n\nexport const typescript: Linter.Config = {\n  parser: require.resolve('@typescript-eslint/parser'),\n  parserOptions: {\n    sourceType: 'module',\n    project: path.join(__dirname, './tsconfig.json'),\n  },\n}\n"
  },
  {
    "path": "tests/helpers/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"lib\": [\"es2017\"],\n    \"module\": \"commonjs\",\n    \"moduleResolution\": \"node\",\n    \"skipLibCheck\": true,\n    \"target\": \"es2017\"\n  },\n  \"files\": [\"file.ts\"]\n}\n"
  },
  {
    "path": "tests/helpers/util.ts",
    "content": "import { RuleTester as ESLintRuleTester } from 'eslint'\nimport { filename } from './configs'\n\ntype OptionsSet<Options extends any[]> = {\n  /**\n   * The set of options this test case should pass for.\n   */\n  readonly optionsSet: readonly (Options | [])[]\n}\n\nexport type ValidTestCase<Options extends any[]> = Omit<\n  ESLintRuleTester.ValidTestCase,\n  'options'\n> &\n  OptionsSet<Options>\n\nexport type InvalidTestCase<Options extends any[]> = Omit<\n  ESLintRuleTester.InvalidTestCase,\n  'options'\n> &\n  OptionsSet<Options>\n\n/**\n * Convert our test cases into ones eslint test runner is expecting.\n */\nexport function processInvalidTestCase(\n  testCases: readonly InvalidTestCase<any>[],\n): ESLintRuleTester.InvalidTestCase[] {\n  return testCases.flatMap(testCase =>\n    testCase.optionsSet.map(options => {\n      // eslint-disable-next-line @typescript-eslint/no-unused-vars\n      const { optionsSet, ...eslintTestCase } = testCase\n\n      return { filename, ...eslintTestCase, options }\n    }),\n  )\n}\n\n/**\n * Convert our test cases into ones eslint test runner is expecting.\n */\nexport function processValidTestCase(\n  testCases: readonly ValidTestCase<any>[],\n): ESLintRuleTester.ValidTestCase[] {\n  return processInvalidTestCase(testCases as any)\n}\n"
  },
  {
    "path": "tests/rules/.prettierrc.js",
    "content": "module.exports = {\n  printWidth: 100,\n  trailingComma: 'all',\n  arrowParens: 'avoid',\n  semi: false,\n}\n"
  },
  {
    "path": "tests/rules/interface.spec.ts",
    "content": "import { Rule, RuleTester } from 'eslint'\n\nimport { rule, name, Options } from 'rules/interface'\nimport { SortingOrder } from 'common/options'\nimport { typescript } from '../helpers/configs'\nimport {\n  InvalidTestCase,\n  processInvalidTestCase,\n  processValidTestCase,\n  ValidTestCase,\n} from '../helpers/util'\n\nconst valid: readonly ValidTestCase<Options>[] = [\n  /**\n   * default, asc, caseSensitive\n   */\n  {\n    code: 'interface U {_:T; a:T; b:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; b:T; c:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; b:T; b_:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {C:T; b_:T; c:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {$:T; A:T; _:T; a:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {1:T; '11':T; 2:T; A:T;}\",\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {'#':T; 'Z':T; À:T; è:T;}\",\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * computed\n   */\n  {\n    code: 'interface U {a:T; [\"ab\"]:T; b:T; c:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * nested\n   */\n  {\n    code: 'interface U {a:T; b:{x:T; y:T;}; c:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; b:{x:T; y:T; z:{i:T; j:T;};}; c:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'type U = {a:T; b:{x:T; y:T;}; c:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'type U = {a:T; b:{x:T; y:T; z:{i:T; j:T;};}; c:T;}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * asc, insensitive\n   */\n  {\n    code: 'interface U {_:T; a:T; b:T;}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {a:T; b:T; c:T;}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {a:T; b:T; b_:T;}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; C:T; c:T;}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; c:T; C:T;}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {$:T; _:T; A:T; a:T;}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {1:T; '11':T; 2:T; A:T;}\",\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n\n  {\n    code: \"interface U {'#':T; 'Z':T; À:T; è:T;}\",\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n\n  /**\n   * asc, natural, insensitive\n   */\n  {\n    code: 'interface U {_:T; a:T; b:T;}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {a:T; b:T; c:T;}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {a:T; b:T; b_:T;}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; C:T; c:T;}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; c:T; C:T;}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {$:T; _:T; A:T; a:T;}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {1:T; 2:T; '11':T; A:T;}\",\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {'#':T; 'Z':T; À:T; è:T;}\",\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n\n  /**\n   * asc, natural, insensitive, required\n   */\n  {\n    code: 'interface U {_:T; b:T; a?:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; c:T; b?:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {b:T; b_:T; a?:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {C:T; c:T; b_?:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; C:T; b_?:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {$:T; _:T; A?:T; a?:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: \"interface U {1:T; '11':T; A:T; 2?:T;}\",\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: \"interface U {'Z':T; À:T; è:T; '#'?:T;}\",\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n\n  /**\n   * asc, required\n   */\n  {\n    code: 'interface U {_:T; b:T; a?:T;}',\n    optionsSet: [[SortingOrder.Ascending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {a:T; c:T; b?:T;}',\n    optionsSet: [[SortingOrder.Ascending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {b:T; b_:T; a?:T;}',\n    optionsSet: [[SortingOrder.Ascending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {C:T; c:T; b_?:T;}',\n    optionsSet: [[SortingOrder.Ascending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {1:T; 11:T; 9:T; 111?:T;}',\n    optionsSet: [[SortingOrder.Ascending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {$:T; _:T; A?:T; a?:T;}',\n    optionsSet: [[SortingOrder.Ascending, { requiredFirst: true }]],\n  },\n  {\n    code: \"interface U {10:T; '11':T; 1?:T; 12?:T; 2?:T;}\",\n    optionsSet: [[SortingOrder.Ascending, { requiredFirst: true }]],\n  },\n  {\n    code: \"interface U {'Z':T; À:T; è:T; '#'?:T;}\",\n    optionsSet: [[SortingOrder.Ascending, { requiredFirst: true }]],\n  },\n\n  /**\n   * asc, natural, insensitive, not-required\n   */\n  {\n    code: 'interface U {_:T; a?:T; b:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; b?:T; c:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {a?:T; b:T; b_:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_?:T; C:T; c:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_?:T; c:T; C:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {$:T; _:T; A?:T; a?:T;}',\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {1:T;  2?:T; '11':T; A:T;}\",\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {'#'?:T; 'Z':T; À:T; è:T;}\",\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * desc\n   */\n  {\n    code: 'interface U {b:T; a:T; _:T;}',\n    optionsSet: [\n      [SortingOrder.Descending],\n      [SortingOrder.Descending, { caseSensitive: true }],\n      [SortingOrder.Descending, { natural: false }],\n      [SortingOrder.Descending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; b:T; a:T;}',\n    optionsSet: [\n      [SortingOrder.Descending],\n      [SortingOrder.Descending, { caseSensitive: true }],\n      [SortingOrder.Descending, { natural: false }],\n      [SortingOrder.Descending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_:T; b:T; a:T;}',\n    optionsSet: [\n      [SortingOrder.Descending],\n      [SortingOrder.Descending, { caseSensitive: true }],\n      [SortingOrder.Descending, { natural: false }],\n      [SortingOrder.Descending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; b_:T; C:T;}',\n    optionsSet: [\n      [SortingOrder.Descending],\n      [SortingOrder.Descending, { caseSensitive: true }],\n      [SortingOrder.Descending, { natural: false }],\n      [SortingOrder.Descending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; _:T; A:T; $:T;}',\n    optionsSet: [\n      [SortingOrder.Descending],\n      [SortingOrder.Descending, { caseSensitive: true }],\n      [SortingOrder.Descending, { natural: false }],\n      [SortingOrder.Descending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: \"interface U {A:T; 2:T; '11':T; 1:T;}\",\n    optionsSet: [\n      [SortingOrder.Descending],\n      [SortingOrder.Descending, { caseSensitive: true }],\n      [SortingOrder.Descending, { natural: false }],\n      [SortingOrder.Descending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: \"interface U {è:T; À:T; 'Z':T; '#':T;}\",\n    optionsSet: [\n      [SortingOrder.Descending],\n      [SortingOrder.Descending, { caseSensitive: true }],\n      [SortingOrder.Descending, { natural: false }],\n      [SortingOrder.Descending, { caseSensitive: true, natural: false }],\n    ],\n  },\n\n  /**\n   * desc, insensitive\n   */\n  {\n    code: 'interface U {b:T; a:T; _:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { caseSensitive: false }],\n      [SortingOrder.Descending, { caseSensitive: false, natural: false }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; b:T; a:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { caseSensitive: false }],\n      [SortingOrder.Descending, { caseSensitive: false, natural: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_:T; b:T; a:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { caseSensitive: false }],\n      [SortingOrder.Descending, { caseSensitive: false, natural: false }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; C:T; b_:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { caseSensitive: false }],\n      [SortingOrder.Descending, { caseSensitive: false, natural: false }],\n    ],\n  },\n  {\n    code: 'interface U {C:T; c:T; b_:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { caseSensitive: false }],\n      [SortingOrder.Descending, { caseSensitive: false, natural: false }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; A:T; _:T; $:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { caseSensitive: false }],\n      [SortingOrder.Descending, { caseSensitive: false, natural: false }],\n    ],\n  },\n  {\n    code: \"interface U {A:T; 2:T; '11':T; 1:T;}\",\n    optionsSet: [\n      [SortingOrder.Descending, { caseSensitive: false }],\n      [SortingOrder.Descending, { caseSensitive: false, natural: false }],\n    ],\n  },\n  {\n    code: \"interface U {è:T; À:T; 'Z':T; '#':T;}\",\n    optionsSet: [\n      [SortingOrder.Descending, { caseSensitive: false }],\n      [SortingOrder.Descending, { caseSensitive: false, natural: false }],\n    ],\n  },\n\n  /**\n   * desc, natural\n   */\n  {\n    code: 'interface U {b:T; a:T; _:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true }],\n      [SortingOrder.Descending, { natural: true, caseSensitive: true }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; b:T; a:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true }],\n      [SortingOrder.Descending, { natural: true, caseSensitive: true }],\n    ],\n  },\n  {\n    code: 'interface U {b_:T; b:T; a:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true }],\n      [SortingOrder.Descending, { natural: true, caseSensitive: true }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; b_:T; C:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true }],\n      [SortingOrder.Descending, { natural: true, caseSensitive: true }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; A:T; _:T; $:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true }],\n      [SortingOrder.Descending, { natural: true, caseSensitive: true }],\n    ],\n  },\n  {\n    code: \"interface U {A:T; '11':T; 2:T; 1:T;}\",\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true }],\n      [SortingOrder.Descending, { natural: true, caseSensitive: true }],\n    ],\n  },\n  {\n    code: \"interface U {è:T; À:T; 'Z':T; '#':T;}\",\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true }],\n      [SortingOrder.Descending, { natural: true, caseSensitive: true }],\n    ],\n  },\n\n  /**\n   * desc, natural, insensitive\n   */\n  {\n    code: 'interface U {b:T; a:T; _:T;}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {c:T; b:T; a:T;}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; b:T; a:T;}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {c:T; C:T; b_:T;}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {C:T; c:T; b_:T;}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {a:T; A:T; _:T; $:T;}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {A:T; '11':T; 2:T; 1:T;}\",\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {è:T; À:T; 'Z':T; '#':T;}\",\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n\n  /**\n   * desc, natural, insensitive, required\n   */\n  {\n    code: 'interface U {b:T; _:T; a?:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; a:T; b?:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {b_:T; b:T; a?:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; C:T; b_?:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {C:T; c:T; b_?:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {_:T; $:T; a?:T; A?:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: \"interface U { A:T; '11':T; 1:T; 2?:T;}\",\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: \"interface U {è:T; 'Z':T; À?:T; '#'?:T;}\",\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n\n  /**\n   * desc, required\n   */\n  {\n    code: 'interface U {b:T; _:T; a?:T;}',\n    optionsSet: [[SortingOrder.Descending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {c:T; a:T; b?:T;}',\n    optionsSet: [[SortingOrder.Descending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {b_:T; b:T; a?:T;}',\n    optionsSet: [[SortingOrder.Descending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {c:T; C:T; b_?:T;}',\n    optionsSet: [[SortingOrder.Descending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {9:T; 11:T; 1:T; 111?:T;}',\n    optionsSet: [[SortingOrder.Descending, { requiredFirst: true }]],\n  },\n  {\n    code: 'interface U {_:T; $:T; a?:T; A?:T;}',\n    optionsSet: [[SortingOrder.Descending, { requiredFirst: true }]],\n  },\n  {\n    code: \"interface U {'11':T; 10:T; 2?:T; 12?:T; 1?:T;}\",\n    optionsSet: [[SortingOrder.Descending, { requiredFirst: true }]],\n  },\n  {\n    code: \"interface U {è:T; À:T; 'Z':T; '#'?:T;}\",\n    optionsSet: [[SortingOrder.Descending, { requiredFirst: true }]],\n  },\n\n  /**\n   * desc, natural, insensitive, not-required\n   */\n  {\n    code: 'interface U {b:T; a?:T; _:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; b?:T; a:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_:T; b:T; a?:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; C:T; b_?:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {C:T; c:T; b_?:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {a?:T; A?:T; _:T; $:T;}',\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {A:T; '11':T; 2?:T; 1:T;}\",\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {è:T; À:T; 'Z':T; '#'?:T;}\",\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * index signatures\n   */\n  {\n    code: `interface U<T> { [nkey: number]: T; [skey: string]: T; $: T; A: T; _: T; a: T; }`,\n    optionsSet: [[SortingOrder.Ascending]],\n  },\n  {\n    code: `interface U<T> { a: T; _: T; A: T; $: T; [skey: string]: T; [nkey: number]: T; }`,\n    optionsSet: [[SortingOrder.Descending]],\n  },\n]\n\nconst invalid: readonly InvalidTestCase<Options>[] = [\n  /**\n   * default (asc)\n   */\n  {\n    code: 'interface U {a:T; _:T; b:T;}',\n    output: 'interface U {_:T; a:T; b:T;}',\n    errors: [\"Expected interface keys to be in ascending order. '_' should be before 'a'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; c:T; b:T;}',\n    output: 'interface U {a:T; b:T; c:T;}',\n    errors: [\"Expected interface keys to be in ascending order. 'b' should be before 'c'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_:T; a:T; b:T;}',\n    output: 'interface U {a:T; b_:T; b:T;}',\n    errors: [\"Expected interface keys to be in ascending order. 'a' should be before 'b_'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_:T; c:T; C:T;}',\n    output: 'interface U {C:T; c:T; b_:T;}',\n    errors: [\"Expected interface keys to be in ascending order. 'C' should be before 'c'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {$:T; _:T; A:T; a:T;}',\n    output: 'interface U {$:T; A:T; _:T; a:T;}',\n    errors: [\"Expected interface keys to be in ascending order. 'A' should be before '_'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {1:T; 2:T; A:T; '11':T;}\",\n    output: \"interface U {1:T; '11':T; A:T; 2:T;}\",\n    errors: [\"Expected interface keys to be in ascending order. '11' should be before 'A'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {'#':T; À:T; 'Z':T; è:T;}\",\n    output: \"interface U {'#':T; 'Z':T; À:T; è:T;}\",\n    errors: [\"Expected interface keys to be in ascending order. 'Z' should be before 'À'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * methods\n   */\n  {\n    code: \"interface U {1:T; 2:T; A():T; '11':T;}\",\n    output: \"interface U {1:T; '11':T; A():T; 2:T;}\",\n    errors: [\"Expected interface keys to be in ascending order. '11' should be before 'A'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {'#'():T; À():T; 'Z':T; è:T;}\",\n    output: \"interface U {'#'():T; 'Z':T; À():T; è:T;}\",\n    errors: [\"Expected interface keys to be in ascending order. 'Z' should be before 'À'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * not ignore simple computed properties.\n   */\n  {\n    code: 'interface U {a:T; b:T; [\"a\"]:T; c:T;}',\n    output: 'interface U {a:T; [\"a\"]:T; b:T; c:T;}',\n    errors: [\"Expected interface keys to be in ascending order. 'a' should be before 'b'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * nested\n   */\n  {\n    code: 'interface U {a:T; c:{y:T; x:T;}, b:T;}',\n    output: 'interface U {a:T; b:T; c:{y:T; x:T;}}',\n    errors: [\n      \"Expected interface keys to be in ascending order. 'x' should be before 'y'.\",\n      \"Expected interface keys to be in ascending order. 'b' should be before 'c'.\",\n    ],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'type U = {a:T; c:{y:T; x:T;}, b:T;}',\n    output: 'type U = {a:T; b:T; c:{y:T; x:T;}}',\n    errors: [\n      \"Expected interface keys to be in ascending order. 'x' should be before 'y'.\",\n      \"Expected interface keys to be in ascending order. 'b' should be before 'c'.\",\n    ],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * asc\n   */\n  {\n    code: 'interface U {a:T; _:T; b:T;}',\n    output: 'interface U {_:T; a:T; b:T;}',\n    errors: [\"Expected interface keys to be in ascending order. '_' should be before 'a'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; c:T; b:T;}',\n    output: 'interface U {a:T; b:T; c:T;}',\n    errors: [\"Expected interface keys to be in ascending order. 'b' should be before 'c'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_:T; a:T; b:T;}',\n    output: 'interface U {a:T; b_:T; b:T;}',\n    errors: [\"Expected interface keys to be in ascending order. 'a' should be before 'b_'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_:T; c:T; C:T;}',\n    output: 'interface U {C:T; c:T; b_:T;}',\n    errors: [\"Expected interface keys to be in ascending order. 'C' should be before 'c'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {$:T; _:T; A:T; a:T;}',\n    output: 'interface U {$:T; A:T; _:T; a:T;}',\n    errors: [\"Expected interface keys to be in ascending order. 'A' should be before '_'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {1:T; 2:T; A:T; '11':T;}\",\n    output: \"interface U {1:T; '11':T; A:T; 2:T;}\",\n    errors: [\"Expected interface keys to be in ascending order. '11' should be before 'A'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {'#':T; À:T; 'Z':T; è:T;}\",\n    output: \"interface U {'#':T; 'Z':T; À:T; è:T;}\",\n    errors: [\"Expected interface keys to be in ascending order. 'Z' should be before 'À'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n\n  /**\n   * asc, insensitive\n   */\n  {\n    code: 'interface U {a:T; _:T; b:T;}',\n    output: 'interface U {_:T; a:T; b:T;}',\n    errors: [\n      \"Expected interface keys to be in insensitive ascending order. '_' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {a:T; c:T; b:T;}',\n    output: 'interface U {a:T; b:T; c:T;}',\n    errors: [\n      \"Expected interface keys to be in insensitive ascending order. 'b' should be before 'c'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; a:T; b:T;}',\n    output: 'interface U {a:T; b_:T; b:T;}',\n    errors: [\n      \"Expected interface keys to be in insensitive ascending order. 'a' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {$:T; A:T; _:T; a:T;}',\n    output: 'interface U {$:T; _:T; A:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in insensitive ascending order. '_' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {1:T; 2:T; A:T; '11':T;}\",\n    output: \"interface U {1:T; '11':T; A:T; 2:T;}\",\n    errors: [\n      \"Expected interface keys to be in insensitive ascending order. '11' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {'#':T; À:T; 'Z':T; è:T;}\",\n    output: \"interface U {'#':T; 'Z':T; À:T; è:T;}\",\n    errors: [\n      \"Expected interface keys to be in insensitive ascending order. 'Z' should be before 'À'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n\n  /**\n   * asc, natural\n   */\n  {\n    code: 'interface U {a:T; _:T; b:T;}',\n    output: 'interface U {_:T; a:T; b:T;}',\n    errors: [\"Expected interface keys to be in natural ascending order. '_' should be before 'a'.\"],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: 'interface U {a:T; c:T; b:T;}',\n    output: 'interface U {a:T; b:T; c:T;}',\n    errors: [\"Expected interface keys to be in natural ascending order. 'b' should be before 'c'.\"],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: 'interface U {b_:T; a:T; b:T;}',\n    output: 'interface U {a:T; b_:T; b:T;}',\n    errors: [\n      \"Expected interface keys to be in natural ascending order. 'a' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: 'interface U {b_:T; c:T; C:T;}',\n    output: 'interface U {C:T; c:T; b_:T;}',\n    errors: [\"Expected interface keys to be in natural ascending order. 'C' should be before 'c'.\"],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: 'interface U {$:T; A:T; _:T; a:T;}',\n    output: 'interface U {$:T; _:T; A:T; a:T;}',\n    errors: [\"Expected interface keys to be in natural ascending order. '_' should be before 'A'.\"],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: \"interface U {1:T; 2:T; A:T; '11':T;}\",\n    output: \"interface U {1:T; 2:T; '11':T; A:T;}\",\n    errors: [\n      \"Expected interface keys to be in natural ascending order. '11' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: \"interface U {'#':T; À:T; 'Z':T; è:T;}\",\n    output: \"interface U {'#':T; 'Z':T; À:T; è:T;}\",\n    errors: [\"Expected interface keys to be in natural ascending order. 'Z' should be before 'À'.\"],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n\n  /**\n   * asc, natural, insensitive\n   */\n  {\n    code: 'interface U {a:T; _:T; b:T;}',\n    output: 'interface U {_:T; a:T; b:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. '_' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {a:T; c:T; b:T;}',\n    output: 'interface U {a:T; b:T; c:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. 'b' should be before 'c'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; a:T; b:T;}',\n    output: 'interface U {a:T; b_:T; b:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. 'a' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {$:T; A:T; _:T; a:T;}',\n    output: 'interface U {$:T; _:T; A:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. '_' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {1:T; '11':T; 2:T; A:T;}\",\n    output: \"interface U {1:T; 2:T; '11':T; A:T;}\",\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. '2' should be before '11'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {'#':T; À:T; 'Z':T; è:T;}\",\n    output: \"interface U {'#':T; 'Z':T; À:T; è:T;}\",\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. 'Z' should be before 'À'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n\n  /**\n   * asc, natural, insensitive, required\n   */\n  {\n    code: 'interface U {_:T; a?:T; b:T;}',\n    output: 'interface U {_:T; b:T; a?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive ascending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {a:T; b?:T; c:T;}',\n    output: 'interface U {a:T; c:T; b?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive ascending order. 'c' should be before 'b'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {b:T; a?:T; b_:T;}',\n    output: 'interface U {b:T; b_:T; a?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive ascending order. 'b_' should be before 'a'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {C:T; b_?:T; c:T;}',\n    output: 'interface U {C:T; c:T; b_?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive ascending order. 'c' should be before 'b_'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {C:T; b_?:T; c:T;}',\n    output: 'interface U {C:T; c:T; b_?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive ascending order. 'c' should be before 'b_'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {$:T; A?:T; _:T; a?:T;}',\n    output: 'interface U {$:T; _:T; A?:T; a?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive ascending order. '_' should be before 'A'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: \"interface U {1:T; '11':T; 2?:T; A:T;}\",\n    output: \"interface U {1:T; '11':T; A:T; 2?:T;}\",\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive ascending order. 'A' should be before '2'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: \"interface U {'Z':T; À:T; '#'?:T; è:T;}\",\n    output: \"interface U {'Z':T; À:T; è:T; '#'?:T;}\",\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive ascending order. 'è' should be before '#'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n\n  /**\n   * asc, natural, insensitive, not-required\n   */\n  {\n    code: 'interface U {_:T; b:T; a?:T;}',\n    output: 'interface U {_:T; a?:T; b:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. 'a' should be before 'b'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b?:T; a:T; c:T;}',\n    output: 'interface U {a:T; b?:T; c:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. 'a' should be before 'b'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b:T; a?:T; b_:T;}',\n    output: 'interface U {a?:T; b:T; b_:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. 'a' should be before 'b'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {C:T; c:T; b_?:T;}',\n    output: 'interface U {b_?:T; c:T; C:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. 'b_' should be before 'c'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {C:T; b_?:T; c:T;}',\n    output: 'interface U {b_?:T; C:T; c:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. 'b_' should be before 'C'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {$:T; A?:T; _:T; a?:T;}',\n    output: 'interface U {$:T; _:T; A?:T; a?:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. '_' should be before 'A'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {1:T; '11':T; 2?:T; A:T;}\",\n    output: \"interface U {1:T; 2?:T; '11':T; A:T;}\",\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. '2' should be before '11'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {'Z':T; À:T; '#'?:T; è:T;}\",\n    output: \"interface U {'#'?:T; À:T; 'Z':T; è:T;}\",\n    errors: [\n      \"Expected interface keys to be in natural insensitive ascending order. '#' should be before 'À'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Ascending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * desc\n   */\n  {\n    code: 'interface U {a:T; _:T; b:T;}',\n    output: 'interface U {b:T; _:T; a:T;}',\n    errors: [\"Expected interface keys to be in descending order. 'b' should be before '_'.\"],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: 'interface U {a:T; c:T; b:T;}',\n    output: 'interface U {c:T; a:T; b:T;}',\n    errors: [\"Expected interface keys to be in descending order. 'c' should be before 'a'.\"],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: 'interface U {b_:T; a:T; b:T;}',\n    output: 'interface U {b_:T; b:T; a:T;}',\n    errors: [\"Expected interface keys to be in descending order. 'b' should be before 'a'.\"],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: 'interface U {b_:T; c:T; C:T;}',\n    output: 'interface U {c:T; b_:T; C:T;}',\n    errors: [\"Expected interface keys to be in descending order. 'c' should be before 'b_'.\"],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: 'interface U {$:T; _:T; A:T; a:T;}',\n    output: 'interface U {a:T; _:T; A:T; $:T;}',\n    errors: [\n      \"Expected interface keys to be in descending order. '_' should be before '$'.\",\n      \"Expected interface keys to be in descending order. 'a' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: \"interface U {1:T; 2:T; A:T; '11':T;}\",\n    output: \"interface U {A:T; 2:T; 1:T; '11':T;}\",\n    errors: [\n      \"Expected interface keys to be in descending order. '2' should be before '1'.\",\n      \"Expected interface keys to be in descending order. 'A' should be before '2'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: \"interface U {'#':T; À:T; 'Z':T; è:T;}\",\n    output: \"interface U {è:T; À:T; 'Z':T; '#':T;}\",\n    errors: [\n      \"Expected interface keys to be in descending order. 'À' should be before '#'.\",\n      \"Expected interface keys to be in descending order. 'è' should be before 'Z'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n\n  /**\n   * desc, insensitive\n   */\n  {\n    code: 'interface U {a:T; _:T; b:T;}',\n    output: 'interface U {b:T; _:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in insensitive descending order. 'b' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {a:T; c:T; b:T;}',\n    output: 'interface U {c:T; a:T; b:T;}',\n    errors: [\n      \"Expected interface keys to be in insensitive descending order. 'c' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; a:T; b:T;}',\n    output: 'interface U {b_:T; b:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in insensitive descending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; c:T; C:T;}',\n    output: 'interface U {c:T; b_:T; C:T;}',\n    errors: [\n      \"Expected interface keys to be in insensitive descending order. 'c' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {$:T; _:T; A:T; a:T;}',\n    output: 'interface U {A:T; _:T; $:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in insensitive descending order. '_' should be before '$'.\",\n      \"Expected interface keys to be in insensitive descending order. 'A' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {1:T; 2:T; A:T; '11':T;}\",\n    output: \"interface U {A:T; 2:T; 1:T; '11':T;}\",\n    errors: [\n      \"Expected interface keys to be in insensitive descending order. '2' should be before '1'.\",\n      \"Expected interface keys to be in insensitive descending order. 'A' should be before '2'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {'#':T; À:T; 'Z':T; è:T;}\",\n    output: \"interface U {è:T; À:T; 'Z':T; '#':T;}\",\n    errors: [\n      \"Expected interface keys to be in insensitive descending order. 'À' should be before '#'.\",\n      \"Expected interface keys to be in insensitive descending order. 'è' should be before 'Z'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n\n  /**\n   * desc, natural\n   */\n  {\n    code: 'interface U {a:T; _:T; b:T;}',\n    output: 'interface U {b:T; _:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in natural descending order. 'b' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'interface U {a:T; c:T; b:T;}',\n    output: 'interface U {c:T; a:T; b:T;}',\n    errors: [\n      \"Expected interface keys to be in natural descending order. 'c' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'interface U {b_:T; a:T; b:T;}',\n    output: 'interface U {b_:T; b:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in natural descending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'interface U {b_:T; c:T; C:T;}',\n    output: 'interface U {c:T; b_:T; C:T;}',\n    errors: [\n      \"Expected interface keys to be in natural descending order. 'c' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'interface U {$:T; _:T; A:T; a:T;}',\n    output: 'interface U {a:T; _:T; A:T; $:T;}',\n    errors: [\n      \"Expected interface keys to be in natural descending order. '_' should be before '$'.\",\n      \"Expected interface keys to be in natural descending order. 'A' should be before '_'.\",\n      \"Expected interface keys to be in natural descending order. 'a' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: \"interface U {1:T; 2:T; A:T; '11':T;}\",\n    output: \"interface U {A:T; 2:T; 1:T; '11':T;}\",\n    errors: [\n      \"Expected interface keys to be in natural descending order. '2' should be before '1'.\",\n      \"Expected interface keys to be in natural descending order. 'A' should be before '2'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: \"interface U {'#':T; À:T; 'Z':T; è:T;}\",\n    output: \"interface U {è:T; À:T; 'Z':T; '#':T;}\",\n    errors: [\n      \"Expected interface keys to be in natural descending order. 'À' should be before '#'.\",\n      \"Expected interface keys to be in natural descending order. 'è' should be before 'Z'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n\n  /**\n   * desc, natural, insensitive\n   */\n  {\n    code: 'interface U {a:T; _:T; b:T;}',\n    output: 'interface U {b:T; _:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'b' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {a:T; c:T; b:T;}',\n    output: 'interface U {c:T; a:T; b:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'c' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; a:T; b:T;}',\n    output: 'interface U {b_:T; b:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {b_:T; c:T; C:T;}',\n    output: 'interface U {c:T; b_:T; C:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'c' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'interface U {$:T; _:T; A:T; a:T;}',\n    output: 'interface U {A:T; _:T; $:T; a:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. '_' should be before '$'.\",\n      \"Expected interface keys to be in natural insensitive descending order. 'A' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {1:T; 2:T; '11':T; A:T;}\",\n    output: \"interface U {A:T; 2:T; '11':T; 1:T;}\",\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. '2' should be before '1'.\",\n      \"Expected interface keys to be in natural insensitive descending order. '11' should be before '2'.\",\n      \"Expected interface keys to be in natural insensitive descending order. 'A' should be before '11'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"interface U {'#':T; À:T; 'Z':T; è:T;}\",\n    output: \"interface U {è:T; À:T; 'Z':T; '#':T;}\",\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'À' should be before '#'.\",\n      \"Expected interface keys to be in natural insensitive descending order. 'è' should be before 'Z'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n\n  /**\n   * desc, natural, insensitive, required\n   */\n  {\n    code: 'interface U {_:T; a?:T; b:T;}',\n    output: 'interface U {b:T; a?:T; _:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive descending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {b:T; a?:T; _:T;}',\n    output: 'interface U {b:T; _:T; a?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive descending order. '_' should be before 'a'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {b:T; b_:T; a?:T;}',\n    output: 'interface U {b_:T; b:T; a?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive descending order. 'b_' should be before 'b'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; b_?:T; C:T;}',\n    output: 'interface U {c:T; C:T; b_?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive descending order. 'C' should be before 'b_'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {b_?:T; C:T; c:T;}',\n    output: 'interface U {C:T; b_?:T; c:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive descending order. 'C' should be before 'b_'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: 'interface U {_:T; a?:T; $:T; A?:T;}',\n    output: 'interface U {_:T; $:T; a?:T; A?:T;}',\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive descending order. '$' should be before 'a'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: \"interface U {2?:T; A:T; 1:T; '11':T;}\",\n    output: \"interface U {A:T; 2?:T; 1:T; '11':T;}\",\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive descending order. 'A' should be before '2'.\",\n      \"Expected interface keys to be in required first natural insensitive descending order. '11' should be before '1'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: \"interface U {è:T; 'Z':T; '#'?:T; À?:T;}\",\n    output: \"interface U {è:T; 'Z':T; À?:T; '#'?:T;}\",\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive descending order. 'À' should be before '#'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n  {\n    code: \"interface U {À?:T; 'Z':T; '#'?:T; è:T;}\",\n    output: \"interface U {è:T; 'Z':T; '#'?:T; À?:T;}\",\n    errors: [\n      \"Expected interface keys to be in required first natural insensitive descending order. 'Z' should be before 'À'.\",\n      \"Expected interface keys to be in required first natural insensitive descending order. 'è' should be before '#'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: true }],\n    ],\n  },\n\n  /**\n   * desc, natural, insensitive, not-required\n   */\n  {\n    code: 'interface U {_:T; a?:T; b:T;}',\n    output: 'interface U {b:T; a?:T; _:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'a' should be before '_'.\",\n      \"Expected interface keys to be in natural insensitive descending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {a?:T; b:T; _:T;}',\n    output: 'interface U {b:T; a?:T; _:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b:T; b_:T; a?:T;}',\n    output: 'interface U {b_:T; b:T; a?:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'b_' should be before 'b'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {c:T; b_?:T; C:T;}',\n    output: 'interface U {c:T; C:T; b_?:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'C' should be before 'b_'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {b_?:T; C:T; c:T;}',\n    output: 'interface U {C:T; b_?:T; c:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'C' should be before 'b_'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: 'interface U {_:T; a?:T; $:T; A?:T;}',\n    output: 'interface U {a?:T; _:T; $:T; A?:T;}',\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'a' should be before '_'.\",\n      \"Expected interface keys to be in natural insensitive descending order. 'A' should be before '$'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {2?:T; A:T; 1:T; '11':T;}\",\n    output: \"interface U {A:T; 2?:T; 1:T; '11':T;}\",\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'A' should be before '2'.\",\n      \"Expected interface keys to be in natural insensitive descending order. '11' should be before '1'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {è:T; 'Z':T; '#'?:T; À?:T;}\",\n    output: \"interface U {è:T; À?:T; '#'?:T; 'Z':T;}\",\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'À' should be before '#'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n  {\n    code: \"interface U {À?:T; 'Z':T; '#'?:T; è:T;}\",\n    output: \"interface U {è:T; 'Z':T; '#'?:T; À?:T;}\",\n    errors: [\n      \"Expected interface keys to be in natural insensitive descending order. 'è' should be before '#'.\",\n    ],\n    optionsSet: [\n      [SortingOrder.Descending, { natural: true, caseSensitive: false, requiredFirst: false }],\n    ],\n  },\n\n  /**\n   * index signatures\n   */\n  {\n    code: 'interface U<T> { A: T; [skey: string]: T; _: T; }',\n    output: 'interface U<T> { [skey: string]: T; A: T; _: T; }',\n    errors: [\n      \"Expected interface keys to be in ascending order. '[index: skey]' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending]],\n  },\n  {\n    code: 'interface U<T> { _: T; [skey: string]: T; A: T; }',\n    output: 'interface U<T> { _: T; A: T; [skey: string]: T; }',\n    errors: [\n      \"Expected interface keys to be in descending order. 'A' should be before '[index: skey]'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n]\n\ndescribe('TypeScript', () => {\n  const ruleTester = new RuleTester(typescript)\n\n  ruleTester.run(name, rule as unknown as Rule.RuleModule, {\n    valid: processValidTestCase(valid),\n    invalid: processInvalidTestCase(invalid),\n  })\n})\n"
  },
  {
    "path": "tests/rules/string-enum.spec.ts",
    "content": "import { Rule, RuleTester } from 'eslint'\n\nimport { rule, name, Options } from 'rules/string-enum'\nimport { SortingOrder } from 'common/options'\nimport { typescript } from '../helpers/configs'\nimport {\n  InvalidTestCase,\n  processInvalidTestCase,\n  processValidTestCase,\n  ValidTestCase,\n} from '../helpers/util'\n\nconst valid: readonly ValidTestCase<Options>[] = [\n  /**\n   * ignores\n   */\n  { code: 'enum U {c, b, a}', optionsSet: [[]] },\n  { code: 'enum U {c=a(), b, a}', optionsSet: [[]] },\n  { code: 'enum U {c=0, b, a}', optionsSet: [[]] },\n  { code: 'enum U {c=3, b, a}', optionsSet: [[]] },\n  { code: 'enum U {c=1<<1, b, a}', optionsSet: [[]] },\n  { code: 'enum U {c=M|N, b, a}', optionsSet: [[]] },\n  { code: 'enum U {c=\"123\".length, b, a}', optionsSet: [[]] },\n  { code: 'enum U {c=0, b=\"b\", a}', optionsSet: [[]] },\n  { code: 'const enum U {A=1, B=A*2}', optionsSet: [[]] },\n\n  /**\n   * default (asc)\n   */\n  {\n    code: 'enum U {_=\"a\", a=\"b\", b=\"c\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {a=\"a\", b=\"b\", c=\"c\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {a=\"a\", b=\"b\", b_=\"c\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {C=\"a\", b_=\"b\", c=\"c\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {$=\"a\", A=\"b\", _=\"c\", a=\"d\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: \"enum U {'#'='a', 'Z'='b', À='c', è='d'}\",\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n\n  {\n    code: 'enum U {_=\"T\", a=\"T\", b=\"T\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {a=\"T\", b=\"T\", c=\"T\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {a=\"T\", b=\"T\", b_=\"T\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {C=\"T\", b_=\"T\", c=\"T\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {$=\"T\", A=\"T\", _=\"T\", a=\"T\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: \"enum U {'#'='T', 'Z'='T', À='T', è='T'}\",\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n\n  /**\n   * computed\n   */\n  {\n    code: '{a=\"T\", [\"aa\"]=\"T\", b=\"T\", c=\"T\"}',\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n\n  /**\n   * asc, insensitive\n   */\n  {\n    code: 'enum U {_=\"T\", a=\"T\", b=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", b=\"T\", c=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", b=\"T\", b_=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", C=\"T\", c=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", c=\"T\", C=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: \"enum U {'#'='T', 'Z'='T', À='T', è='T'}\",\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n\n  /**\n   * asc, natural, insensitive\n   */\n  {\n    code: 'enum U {_=\"T\", a=\"T\", b=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", b=\"T\", c=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", b=\"T\", b_=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", C=\"T\", c=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", c=\"T\", C=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"enum U {'#'='T', 'Z'='T', À='T', è='T'}\",\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n\n  /**\n   * desc\n   */\n  { code: 'enum U {b=\"T\", a=\"T\", _=\"T\"}', optionsSet: [[SortingOrder.Descending]] },\n  { code: 'enum U {c=\"T\", b=\"T\", a=\"T\"}', optionsSet: [[SortingOrder.Descending]] },\n  { code: 'enum U {b_=\"T\", b=\"T\", a=\"T\"}', optionsSet: [[SortingOrder.Descending]] },\n  { code: 'enum U {c=\"T\", b_=\"T\", C=\"T\"}', optionsSet: [[SortingOrder.Descending]] },\n  { code: 'enum U {a=\"T\", _=\"T\", A=\"T\", $=\"T\"}', optionsSet: [[SortingOrder.Descending]] },\n  { code: \"enum U {è='T', À='T', 'Z'='T', '#'='T'}\", optionsSet: [[SortingOrder.Descending]] },\n\n  /**\n   * desc, insensitive\n   */\n  {\n    code: 'enum U {b=\"T\", a=\"T\", _=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {c=\"T\", b=\"T\", a=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", b=\"T\", a=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {c=\"T\", C=\"T\", b_=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {C=\"T\", c=\"T\", b_=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", A=\"T\", _=\"T\", $=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: \"enum U {è='T', À='T', 'Z'='T', '#'='T'}\",\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n\n  /**\n   * desc, natural\n   */\n  {\n    code: 'enum U {b=\"T\", a=\"T\", _=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'enum U {c=\"T\", b=\"T\", a=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", b=\"T\", a=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'enum U {c=\"T\", b_=\"T\", C=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'enum U {a=\"T\", A=\"T\", _=\"T\", $=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: \"enum U {è='T', À='T', 'Z'='T', '#'='T'}\",\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n\n  /**\n   * desc, natural, insensitive\n   */\n  {\n    code: 'enum U {b=\"T\", a=\"T\", _=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {c=\"T\", b=\"T\", a=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", b=\"T\", a=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {c=\"T\", C=\"T\", b_=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {C=\"T\", c=\"T\", b_=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", A=\"T\", _=\"T\", $=\"T\"}',\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"enum U {è='T', À='T', 'Z'='T', '#'='T'}\",\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n]\n\nconst invalid: readonly InvalidTestCase<Options>[] = [\n  /**\n   * default (asc)\n   */\n  {\n    code: 'enum U {a=\"a\", _=\"b\", b=\"c\"}',\n    output: 'enum U {_=\"b\", a=\"a\", b=\"c\"}',\n    errors: [\"Expected string enum members to be in ascending order. '_' should be before 'a'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {a=\"T\", c=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b=\"T\", c=\"T\"}',\n    errors: [\"Expected string enum members to be in ascending order. 'b' should be before 'c'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {b_=\"T\", a=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b_=\"T\", b=\"T\"}',\n    errors: [\"Expected string enum members to be in ascending order. 'a' should be before 'b_'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {b_=\"T\", c=\"T\", C=\"T\"}',\n    output: 'enum U {C=\"T\", c=\"T\", b_=\"T\",}',\n    errors: [\"Expected string enum members to be in ascending order. 'C' should be before 'c'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    output: 'enum U {$=\"T\", A=\"T\", _=\"T\", a=\"T\"}',\n    errors: [\"Expected string enum members to be in ascending order. 'A' should be before '_'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: \"enum U {'#'='T', À='T', 'Z'='T', è='T'}\",\n    output: \"enum U {'#'='T', 'Z'='T', À='T', è='T'}\",\n    errors: [\"Expected string enum members to be in ascending order. 'Z' should be before 'À'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n\n  /**\n   * not ignore simple computed properties.\n   */\n  {\n    code: 'enum U {a=\"T\", b=\"T\", [\"aa\"]=\"T\", c=\"T\"}',\n    output: 'enum U {a=\"T\", [\"aa\"]=\"T\", b=\"T\", c=\"T\"}',\n    errors: [\"Expected string enum members to be in ascending order. 'aa' should be before 'b'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n\n  /**\n   * asc\n   */\n  {\n    code: 'enum U {a=\"T\", _=\"T\", b=\"T\"}',\n    output: 'enum U {_=\"T\", a=\"T\", b=\"T\"}',\n    errors: [\"Expected string enum members to be in ascending order. '_' should be before 'a'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {a=\"T\", c=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b=\"T\", c=\"T\"}',\n    errors: [\"Expected string enum members to be in ascending order. 'b' should be before 'c'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {b_=\"T\", a=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b_=\"T\", b=\"T\"}',\n    errors: [\"Expected string enum members to be in ascending order. 'a' should be before 'b_'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {b_=\"T\", c=\"T\", C=\"T\"}',\n    output: 'enum U {C=\"T\", c=\"T\", b_=\"T\",}',\n    errors: [\"Expected string enum members to be in ascending order. 'C' should be before 'c'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    output: 'enum U {$=\"T\", A=\"T\", _=\"T\", a=\"T\"}',\n    errors: [\"Expected string enum members to be in ascending order. 'A' should be before '_'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n  {\n    code: \"enum U {'#'='T', À='T', 'Z'='T', è='T'}\",\n    output: \"enum U {'#'='T', 'Z'='T', À='T', è='T'}\",\n    errors: [\"Expected string enum members to be in ascending order. 'Z' should be before 'À'.\"],\n    optionsSet: [\n      [],\n      [SortingOrder.Ascending],\n      [SortingOrder.Ascending, { caseSensitive: true }],\n      [SortingOrder.Ascending, { natural: false }],\n      [SortingOrder.Ascending, { caseSensitive: true, natural: false }],\n    ],\n  },\n\n  /**\n   * asc, insensitive\n   */\n  {\n    code: 'enum U {a=\"T\", _=\"T\", b=\"T\"}',\n    output: 'enum U {_=\"T\", a=\"T\", b=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in insensitive ascending order. '_' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", c=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b=\"T\", c=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in insensitive ascending order. 'b' should be before 'c'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", a=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b_=\"T\", b=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in insensitive ascending order. 'a' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {$=\"T\", A=\"T\", _=\"T\", a=\"T\"}',\n    output: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in insensitive ascending order. '_' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n  {\n    code: \"enum U {'#'='T', À='T', 'Z'='T', è='T'}\",\n    output: \"enum U {'#'='T', 'Z'='T', À='T', è='T'}\",\n    errors: [\n      \"Expected string enum members to be in insensitive ascending order. 'Z' should be before 'À'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { caseSensitive: false }]],\n  },\n\n  /**\n   * asc, natural\n   */\n  {\n    code: 'enum U {a=\"T\", _=\"T\", b=\"T\"}',\n    output: 'enum U {_=\"T\", a=\"T\", b=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural ascending order. '_' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: 'enum U {a=\"T\", c=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b=\"T\", c=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural ascending order. 'b' should be before 'c'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", a=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b_=\"T\", b=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural ascending order. 'a' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", c=\"T\", C=\"T\"}',\n    output: 'enum U {C=\"T\", c=\"T\", b_=\"T\",}',\n    errors: [\n      \"Expected string enum members to be in natural ascending order. 'C' should be before 'c'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: 'enum U {$=\"T\", A=\"T\", _=\"T\", a=\"T\"}',\n    output: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural ascending order. '_' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n  {\n    code: \"enum U {'#'='T', À='T', 'Z'='T', è='T'}\",\n    output: \"enum U {'#'='T', 'Z'='T', À='T', è='T'}\",\n    errors: [\n      \"Expected string enum members to be in natural ascending order. 'Z' should be before 'À'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true }]],\n  },\n\n  /**\n   * asc, natural, insensitive\n   */\n  {\n    code: 'enum U {a=\"T\", _=\"T\", b=\"T\"}',\n    output: 'enum U {_=\"T\", a=\"T\", b=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural insensitive ascending order. '_' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", c=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b=\"T\", c=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural insensitive ascending order. 'b' should be before 'c'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", a=\"T\", b=\"T\"}',\n    output: 'enum U {a=\"T\", b_=\"T\", b=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural insensitive ascending order. 'a' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {$=\"T\", A=\"T\", _=\"T\", a=\"T\"}',\n    output: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural insensitive ascending order. '_' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"enum U {'#'='T', À='T', 'Z'='T', è='T'}\",\n    output: \"enum U {'#'='T', 'Z'='T', À='T', è='T'}\",\n    errors: [\n      \"Expected string enum members to be in natural insensitive ascending order. 'Z' should be before 'À'.\",\n    ],\n    optionsSet: [[SortingOrder.Ascending, { natural: true, caseSensitive: false }]],\n  },\n\n  /**\n   * desc\n   */\n  {\n    code: 'enum U {a=\"T\", _=\"T\", b=\"T\"}',\n    output: 'enum U {b=\"T\", _=\"T\", a=\"T\",}',\n    errors: [\"Expected string enum members to be in descending order. 'b' should be before '_'.\"],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: 'enum U {a=\"T\", c=\"T\", b=\"T\"}',\n    output: 'enum U {c=\"T\", a=\"T\", b=\"T\"}',\n    errors: [\"Expected string enum members to be in descending order. 'c' should be before 'a'.\"],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: 'enum U {b_=\"T\", a=\"T\", b=\"T\"}',\n    output: 'enum U {b_=\"T\", b=\"T\", a=\"T\"}',\n    errors: [\"Expected string enum members to be in descending order. 'b' should be before 'a'.\"],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: 'enum U {b_=\"T\", c=\"T\", C=\"T\"}',\n    output: 'enum U {c=\"T\", b_=\"T\", C=\"T\"}',\n    errors: [\"Expected string enum members to be in descending order. 'c' should be before 'b_'.\"],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    output: 'enum U {a=\"T\", _=\"T\", A=\"T\", $=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in descending order. '_' should be before '$'.\",\n      \"Expected string enum members to be in descending order. 'a' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n  {\n    code: \"enum U {'#'='T', À='T', 'Z'='T', è='T'}\",\n    output: \"enum U {è='T', À='T', 'Z'='T', '#'='T'}\",\n    errors: [\n      \"Expected string enum members to be in descending order. 'À' should be before '#'.\",\n      \"Expected string enum members to be in descending order. 'è' should be before 'Z'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending]],\n  },\n\n  /**\n   * desc, insensitive\n   */\n  {\n    code: 'enum U {a=\"T\", _=\"T\", b=\"T\"}',\n    output: 'enum U {b=\"T\", _=\"T\", a=\"T\",}',\n    errors: [\n      \"Expected string enum members to be in insensitive descending order. 'b' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", c=\"T\", b=\"T\"}',\n    output: 'enum U {c=\"T\", a=\"T\", b=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in insensitive descending order. 'c' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", a=\"T\", b=\"T\"}',\n    output: 'enum U {b_=\"T\", b=\"T\", a=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in insensitive descending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", c=\"T\", C=\"T\"}',\n    output: 'enum U {c=\"T\", b_=\"T\", C=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in insensitive descending order. 'c' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    output: 'enum U {A=\"T\", _=\"T\", $=\"T\", a=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in insensitive descending order. '_' should be before '$'.\",\n      \"Expected string enum members to be in insensitive descending order. 'A' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n  {\n    code: \"enum U {'#'='T', À='T', 'Z'='T', è='T'}\",\n    output: \"enum U {è='T', À='T', 'Z'='T', '#'='T'}\",\n    errors: [\n      \"Expected string enum members to be in insensitive descending order. 'À' should be before '#'.\",\n      \"Expected string enum members to be in insensitive descending order. 'è' should be before 'Z'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { caseSensitive: false }]],\n  },\n\n  /**\n   * desc, natural\n   */\n  {\n    code: 'enum U {a=\"T\", _=\"T\", b=\"T\"}',\n    output: 'enum U {b=\"T\", _=\"T\", a=\"T\",}',\n    errors: [\n      \"Expected string enum members to be in natural descending order. 'b' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'enum U {a=\"T\", c=\"T\", b=\"T\"}',\n    output: 'enum U {c=\"T\", a=\"T\", b=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural descending order. 'c' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", a=\"T\", b=\"T\"}',\n    output: 'enum U {b_=\"T\", b=\"T\", a=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural descending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", c=\"T\", C=\"T\"}',\n    output: 'enum U {c=\"T\", b_=\"T\", C=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural descending order. 'c' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    output: 'enum U {a=\"T\", _=\"T\", A=\"T\", $=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural descending order. '_' should be before '$'.\",\n      \"Expected string enum members to be in natural descending order. 'A' should be before '_'.\",\n      \"Expected string enum members to be in natural descending order. 'a' should be before 'A'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n  {\n    code: \"enum U {'#'='T', À='T', 'Z'='T', è='T'}\",\n    output: \"enum U {è='T', À='T', 'Z'='T', '#'='T'}\",\n    errors: [\n      \"Expected string enum members to be in natural descending order. 'À' should be before '#'.\",\n      \"Expected string enum members to be in natural descending order. 'è' should be before 'Z'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true }]],\n  },\n\n  /**\n   * desc, natural, insensitive\n   */\n  {\n    code: 'enum U {a=\"T\", _=\"T\", b=\"T\"}',\n    output: 'enum U {b=\"T\", _=\"T\", a=\"T\",}',\n    errors: [\n      \"Expected string enum members to be in natural insensitive descending order. 'b' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {a=\"T\", c=\"T\", b=\"T\"}',\n    output: 'enum U {c=\"T\", a=\"T\", b=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural insensitive descending order. 'c' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", a=\"T\", b=\"T\"}',\n    output: 'enum U {b_=\"T\", b=\"T\", a=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural insensitive descending order. 'b' should be before 'a'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {b_=\"T\", c=\"T\", C=\"T\"}',\n    output: 'enum U {c=\"T\", b_=\"T\", C=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural insensitive descending order. 'c' should be before 'b_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: 'enum U {$=\"T\", _=\"T\", A=\"T\", a=\"T\"}',\n    output: 'enum U {A=\"T\", _=\"T\", $=\"T\", a=\"T\"}',\n    errors: [\n      \"Expected string enum members to be in natural insensitive descending order. '_' should be before '$'.\",\n      \"Expected string enum members to be in natural insensitive descending order. 'A' should be before '_'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n  {\n    code: \"enum U {'#'='T', À='T', 'Z'='T', è='T'}\",\n    output: \"enum U {è='T', À='T', 'Z'='T', '#'='T'}\",\n    errors: [\n      \"Expected string enum members to be in natural insensitive descending order. 'À' should be before '#'.\",\n      \"Expected string enum members to be in natural insensitive descending order. 'è' should be before 'Z'.\",\n    ],\n    optionsSet: [[SortingOrder.Descending, { natural: true, caseSensitive: false }]],\n  },\n]\n\ndescribe('TypeScript', () => {\n  const ruleTester = new RuleTester(typescript)\n\n  ruleTester.run(name, rule as unknown as Rule.RuleModule, {\n    valid: processValidTestCase(valid),\n    invalid: processInvalidTestCase(invalid),\n  })\n})\n"
  },
  {
    "path": "tests/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"module\": \"commonjs\",\n    \"outDir\": \"../build\",\n    // Turn off checks to make debugging nicer.\n    \"noFallthroughCasesInSwitch\": false,\n    \"noImplicitAny\": false,\n    \"noImplicitReturns\": false,\n    \"noImplicitThis\": false,\n    \"noUnusedLocals\": false,\n    \"noUnusedParameters\": false,\n    \"strictNullChecks\": false\n  },\n  \"include\": [\"**/*.ts\"],\n  \"exclude\": [\"fixtures\"]\n}\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    /* Basic Options */\n    // \"incremental\": true,                   /* Enable incremental compilation */\n    \"target\": \"ES6\" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,\n    \"module\": \"esnext\" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,\n    \"lib\": [\"ESNext\"] /* Specify library files to be included in the compilation. */,\n    \"allowJs\": true /* Allow javascript files to be compiled. */,\n    \"checkJs\": false /* Report errors in .js files. */,\n    // \"jsx\": \"preserve\",                     /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */\n    // \"declaration\": true /* Generates corresponding '.d.ts' file. */,\n    // \"declarationMap\": true,                /* Generates a sourcemap for each corresponding '.d.ts' file. */\n    \"sourceMap\": false /* Generates corresponding '.map' file. */,\n    // \"outFile\": \"./\",                       /* Concatenate and emit output to single file. */\n    \"outDir\": \"lib\" /* Redirect output structure to the directory. */,\n    // \"rootDir\": \"src\" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,\n    // \"composite\": true,                     /* Enable project compilation */\n    // \"tsBuildInfoFile\": \"./\",               /* Specify file to store incremental compilation information */\n    // \"removeComments\": true,                /* Do not emit comments to output. */\n    // \"noEmit\": true,                        /* Do not emit outputs. */\n    // \"importHelpers\": true,                 /* Import emit helpers from 'tslib'. */\n    // \"downlevelIteration\": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */\n    // \"isolatedModules\": true,               /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */\n\n    /* Strict Type-Checking Options */\n    \"strict\": true /* Enable all strict type-checking options. */,\n    // \"noImplicitAny\": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */\n    // \"strictNullChecks\": true,              /* Enable strict null checks. */\n    // \"strictFunctionTypes\": true,           /* Enable strict checking of function types. */\n    // \"strictBindCallApply\": true,           /* Enable strict 'bind', 'call', and 'apply' methods on functions. */\n    // \"strictPropertyInitialization\": true,  /* Enable strict checking of property initialization in classes. */\n    // \"noImplicitThis\": true,                /* Raise error on 'this' expressions with an implied 'any' type. */\n    // \"alwaysStrict\": true,                  /* Parse in strict mode and emit \"use strict\" for each source file. */\n\n    /* Additional Checks */\n    \"noUnusedLocals\": true /* Report errors on unused locals. */,\n    \"noUnusedParameters\": true /* Report errors on unused parameters. */,\n    \"noImplicitReturns\": true /* Report error when not all code paths in function return a value. */,\n    \"noFallthroughCasesInSwitch\": true /* Report errors for fallthrough cases in switch statement. */,\n\n    /* Module Resolution Options */\n    \"moduleResolution\": \"node\" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,\n    \"baseUrl\": \"src\" /* Base directory to resolve non-absolute module names. */,\n    // \"paths\": {},                           /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */\n    // \"rootDirs\": [],                        /* List of root folders whose combined content represents the structure of the project at runtime. */\n    // \"typeRoots\": [],                       /* List of folders to include type definitions from. */\n    // \"types\": [],                           /* Type declaration files to be included in compilation. */\n    // \"allowSyntheticDefaultImports\": true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */\n    \"esModuleInterop\": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,\n    // \"preserveSymlinks\": true,              /* Do not resolve the real path of symlinks. */\n    // \"allowUmdGlobalAccess\": true,          /* Allow accessing UMD globals from modules. */\n\n    /* Source Map Options */\n    // \"sourceRoot\": \"\",                      /* Specify the location where debugger should locate TypeScript files instead of source locations. */\n    // \"mapRoot\": \"\",                         /* Specify the location where debugger should locate map files instead of generated locations. */\n    // \"inlineSourceMap\": true,               /* Emit a single file with source maps instead of having a separate file. */\n    // \"inlineSources\": true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */\n\n    /* Experimental Options */\n    // \"experimentalDecorators\": true,        /* Enables experimental support for ES7 decorators. */\n    // \"emitDecoratorMetadata\": true,         /* Enables experimental support for emitting type metadata for decorators. */\n\n    /* Advanced Options */\n    \"forceConsistentCasingInFileNames\": true /* Disallow inconsistently-cased references to the same file. */\n  },\n  \"exclude\": [\"./node_modules\", \"tests/fixtures\", \"dist\", \"lib\"]\n}\n"
  }
]