From 528b9abe7940ba1862620510b89fb317fdd2df2a Mon Sep 17 00:00:00 2001 From: Azat S Date: Thu, 20 Jul 2023 22:41:37 +0300 Subject: [PATCH] feat!: rename sort-map-elements rule to sort-maps --- docs/rules/index.md | 2 +- docs/rules/{sort-map-elements.md => sort-maps.md} | 12 ++++++------ index.ts | 14 +++++++------- readme.md | 2 +- rules/{sort-map-elements.ts => sort-maps.ts} | 2 +- ...sort-map-elements.test.ts => sort-maps.test.ts} | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) rename docs/rules/{sort-map-elements.md => sort-maps.md} (93%) rename rules/{sort-map-elements.ts => sort-maps.ts} (98%) rename test/{sort-map-elements.test.ts => sort-maps.test.ts} (99%) diff --git a/docs/rules/index.md b/docs/rules/index.md index 9ce4cbab..1d7c806e 100644 --- a/docs/rules/index.md +++ b/docs/rules/index.md @@ -18,7 +18,7 @@ description: ESLint Plugin Perfectionist list of rules | [sort-imports](/rules/sort-imports) | enforce sorted imports | 🔧 | | [sort-interfaces](/rules/sort-interfaces) | enforce sorted interface properties | 🔧 | | [sort-jsx-props](/rules/sort-jsx-props) | enforce sorted JSX props | 🔧 | -| [sort-map-elements](/rules/sort-map-elements) | enforce sorted Map elements | 🔧 | +| [sort-maps](/rules/sort-maps) | enforce sorted Map elements | 🔧 | | [sort-named-exports](/rules/sort-named-exports) | enforce sorted named exports | 🔧 | | [sort-named-imports](/rules/sort-named-imports) | enforce sorted named imports | 🔧 | | [sort-object-types](/rules/sort-object-types) | enforce sorted object types | 🔧 | diff --git a/docs/rules/sort-map-elements.md b/docs/rules/sort-maps.md similarity index 93% rename from docs/rules/sort-map-elements.md rename to docs/rules/sort-maps.md index b2ee4920..ac8d4dc4 100644 --- a/docs/rules/sort-map-elements.md +++ b/docs/rules/sort-maps.md @@ -1,9 +1,9 @@ --- -title: sort-map-elements +title: sort-maps description: ESLint Plugin Perfectionist rule which enforce sorted element within JavaScript Map object --- -# sort-map-elements +# sort-maps 💼 This rule is enabled in the following [configs](/configs/): `recommended-alphabetical`, `recommended-line-length`, `recommended-natural`. @@ -112,7 +112,7 @@ Only affects alphabetical and natural sorting. When `true` the rule ignores the { "plugins": ["perfectionist"], "rules": { - "perfectionist/sort-map-elements": [ + "perfectionist/sort-maps": [ "error", { "type": "natural", @@ -133,7 +133,7 @@ export default [ perfectionist, }, rules: { - 'perfectionist/sort-map-elements': [ + 'perfectionist/sort-maps': [ 'error', { type: 'natural', @@ -153,5 +153,5 @@ This rule was introduced in v0.5.0. ## 📚 Resources -- [Rule source](https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/rules/sort-map-elements.ts) -- [Test source](https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/test/sort-map-elements.test.ts) +- [Rule source](https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/rules/sort-maps.ts) +- [Test source](https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/test/sort-maps.test.ts) diff --git a/index.ts b/index.ts index b80ea9e4..f10a4354 100644 --- a/index.ts +++ b/index.ts @@ -1,16 +1,16 @@ import sortArrayIncludes, { RULE_NAME as sortArrayIncludesName } from './rules/sort-array-includes' -import sortNamedExports, { RULE_NAME as sortNamedExportsName } from './rules/sort-named-exports' import sortNamedImports, { RULE_NAME as sortNamedImportsName } from './rules/sort-named-imports' +import sortNamedExports, { RULE_NAME as sortNamedExportsName } from './rules/sort-named-exports' import sortObjectTypes, { RULE_NAME as sortObjectTypesName } from './rules/sort-object-types' -import sortMapElements, { RULE_NAME as sortMapElementsName } from './rules/sort-map-elements' import sortUnionTypes, { RULE_NAME as sortUnionTypesName } from './rules/sort-union-types' import sortInterfaces, { RULE_NAME as sortInterfacesName } from './rules/sort-interfaces' import sortJsxProps, { RULE_NAME as sortJsxPropsName } from './rules/sort-jsx-props' +import sortObjects, { RULE_NAME as sortObjectsName } from './rules/sort-objects' import sortImports, { RULE_NAME as sortImportsName } from './rules/sort-imports' import sortClasses, { RULE_NAME as sortClassesName } from './rules/sort-classes' -import sortObjects, { RULE_NAME as sortObjectsName } from './rules/sort-objects' import sortExports, { RULE_NAME as sortExportsName } from './rules/sort-exports' import sortEnums, { RULE_NAME as sortEnumsName } from './rules/sort-enums' +import sortMaps, { RULE_NAME as sortMapsName } from './rules/sort-maps' import { SortOrder, SortType } from './typings' import { name } from './package.json' @@ -90,14 +90,14 @@ let createConfigWithOptions = (options: { 'spread-last': true, }, ], - [sortNamedExportsName]: ['error'], [sortNamedImportsName]: ['error'], - [sortMapElementsName]: ['error'], + [sortNamedExportsName]: ['error'], [sortObjectTypesName]: ['error'], - [sortInterfacesName]: ['error'], [sortUnionTypesName]: ['error'], + [sortInterfacesName]: ['error'], [sortExportsName]: ['error'], [sortEnumsName]: ['error'], + [sortMapsName]: ['error'], } return { rules: Object.fromEntries( @@ -120,7 +120,7 @@ export default { [sortImportsName]: sortImports, [sortInterfacesName]: sortInterfaces, [sortJsxPropsName]: sortJsxProps, - [sortMapElementsName]: sortMapElements, + [sortMapsName]: sortMaps, [sortNamedExportsName]: sortNamedExports, [sortNamedImportsName]: sortNamedImports, [sortObjectTypesName]: sortObjectTypes, diff --git a/readme.md b/readme.md index f79c804f..346a5349 100644 --- a/readme.md +++ b/readme.md @@ -147,7 +147,7 @@ export default [ | [sort-imports](https://eslint-plugin-perfectionist.azat.io/rules/sort-imports) | enforce sorted imports | 🔧 | | [sort-interfaces](https://eslint-plugin-perfectionist.azat.io/rules/sort-interfaces) | enforce sorted interface properties | 🔧 | | [sort-jsx-props](https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props) | enforce sorted JSX props | 🔧 | -| [sort-map-elements](https://eslint-plugin-perfectionist.azat.io/rules/sort-map-elements) | enforce sorted Map elements | 🔧 | +| [sort-maps](https://eslint-plugin-perfectionist.azat.io/rules/sort-maps) | enforce sorted Map elements | 🔧 | | [sort-named-exports](https://eslint-plugin-perfectionist.azat.io/rules/sort-named-exports) | enforce sorted named exports | 🔧 | | [sort-named-imports](https://eslint-plugin-perfectionist.azat.io/rules/sort-named-imports) | enforce sorted named imports | 🔧 | | [sort-object-types](https://eslint-plugin-perfectionist.azat.io/rules/sort-object-types) | enforce sorted object types | 🔧 | diff --git a/rules/sort-map-elements.ts b/rules/sort-maps.ts similarity index 98% rename from rules/sort-map-elements.ts rename to rules/sort-maps.ts index 694823bb..e089f53d 100644 --- a/rules/sort-map-elements.ts +++ b/rules/sort-maps.ts @@ -24,7 +24,7 @@ type Options = [ }>, ] -export const RULE_NAME = 'sort-map-elements' +export const RULE_NAME = 'sort-maps' export default createEslintRule({ name: RULE_NAME, diff --git a/test/sort-map-elements.test.ts b/test/sort-maps.test.ts similarity index 99% rename from test/sort-map-elements.test.ts rename to test/sort-maps.test.ts index 99ab68b0..18a55e1c 100644 --- a/test/sort-map-elements.test.ts +++ b/test/sort-maps.test.ts @@ -2,7 +2,7 @@ import { ESLintUtils } from '@typescript-eslint/utils' import { describe, it } from 'vitest' import { dedent } from 'ts-dedent' -import rule, { RULE_NAME } from '../rules/sort-map-elements' +import rule, { RULE_NAME } from '../rules/sort-maps' import { SortOrder, SortType } from '../typings' describe(RULE_NAME, () => {