Skip to content

Commit

Permalink
feat: adds possibility to trim / remove special characters before sor…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
hugop95 authored Oct 8, 2024
1 parent dc0a789 commit 96f8b10
Show file tree
Hide file tree
Showing 63 changed files with 1,432 additions and 10 deletions.
12 changes: 12 additions & 0 deletions docs/content/rules/sort-array-includes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).


### groupKind

Expand Down Expand Up @@ -229,6 +239,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
groupKind: 'literals-first',
partitionByNewLine: false,
matcher: 'minimatch',
Expand All @@ -255,6 +266,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
groupKind: 'literals-first',
partitionByNewLine: false,
matcher: 'minimatch',
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-astro-attributes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### groups

<sub>
Expand Down Expand Up @@ -310,6 +320,7 @@ In order to start using this rule, you need to install additional dependency:
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
matcher: 'minimatch',
groups: [],
customGroups: {},
Expand Down Expand Up @@ -342,6 +353,7 @@ In order to start using this rule, you need to install additional dependency:
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
matcher: 'minimatch',
groups: [],
customGroups: {},
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-classes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### partitionByComment

<sub>default: `false`</sub>
Expand Down Expand Up @@ -604,6 +614,7 @@ Determines the matcher used for patterns in the `partitionByComment` and `custom
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
matcher: 'minimatch',
groups: [
Expand Down Expand Up @@ -645,6 +656,7 @@ Determines the matcher used for patterns in the `partitionByComment` and `custom
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
matcher: 'minimatch',
groups: [
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-enums.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### sortByValue

<sub>default: `false`</sub>
Expand Down Expand Up @@ -196,6 +206,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
partitionByNewLine: false,
sortByValue: false,
Expand Down Expand Up @@ -223,6 +234,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
partitionByNewLine: false,
sortByValue: false,
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-exports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### partitionByComment

<sub>default: `false`</sub>
Expand Down Expand Up @@ -176,6 +186,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
partitionByNewLine: false,
groupKind: 'mixed',
Expand Down Expand Up @@ -203,6 +214,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
partitionByNewLine: false,
groupKind: 'mixed',
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-imports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### internalPattern

<sub>default: `['~/**']` for `minimatch` matcher, `['^~/.*']` for `regex` matcher</sub>
Expand Down Expand Up @@ -349,6 +359,7 @@ Specifies which environment’s built-in modules should be recognized. If you ar
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
matcher: 'minimatch',
internalPattern: ['~/**'],
newlinesBetween: 'always',
Expand Down Expand Up @@ -389,6 +400,7 @@ Specifies which environment’s built-in modules should be recognized. If you ar
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
matcher: 'minimatch',
internalPattern: ['~/**'],
newlinesBetween: 'always',
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-interfaces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### ignorePattern

<sub>default: `[]`</sub>
Expand Down Expand Up @@ -348,6 +358,7 @@ Determines the matcher used for patterns in the `partitionByComment`, `ignorePat
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
partitionByNewLine: false,
optionalityOrder: 'ignore',
Expand Down Expand Up @@ -377,6 +388,7 @@ Determines the matcher used for patterns in the `partitionByComment`, `ignorePat
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
partitionByNewLine: false,
optionalityOrder: 'ignore',
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-intersection-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### partitionByComment

<sub>default: `false`</sub>
Expand Down Expand Up @@ -283,6 +293,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByNewLine: false,
partitionByNewLine: false,
matcher: 'minimatch',
Expand Down Expand Up @@ -310,6 +321,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByNewLine: false,
partitionByComment: false,
matcher: 'minimatch',
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-jsx-props.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### ignorePattern

<sub>default: `[]`</sub>
Expand Down Expand Up @@ -259,6 +269,7 @@ Determines the matcher used for patterns in the `ignorePattern` and `customGroup
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
matcher: 'minimatch',
groups: [],
Expand Down Expand Up @@ -286,6 +297,7 @@ Determines the matcher used for patterns in the `ignorePattern` and `customGroup
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
matcher: 'minimatch',
groups: [],
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-maps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### partitionByComment

<sub>default: `false`</sub>
Expand Down Expand Up @@ -177,6 +187,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByNewLine: false,
partitionByComment: false,
matcher: 'minimatch',
Expand All @@ -203,6 +214,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
partitionByNewLine: false,
partitionByComment: false,
matcher: 'minimatch',
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-named-exports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### groupKind

<sub>default: `'mixed'`</sub>
Expand Down Expand Up @@ -204,6 +214,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
groupKind: 'mixed',
matcher: 'minimatch',
},
Expand All @@ -229,6 +240,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
specialCharacters: 'keep',
groupKind: 'mixed',
matcher: 'minimatch',
},
Expand Down
12 changes: 12 additions & 0 deletions docs/content/rules/sort-named-imports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ Controls whether sorting should be case-sensitive or not.
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “A” comes before “a”).

### specialCharacters

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).

### ignoreAlias

<sub>default: `false`</sub>
Expand Down Expand Up @@ -205,6 +215,7 @@ import {
order: 'asc',
ignoreAlias: false,
ignoreCase: true,
specialCharacters: 'keep',
groupKind: 'mixed',
partitionByNewLine: false,
partitionByComment: false,
Expand Down Expand Up @@ -233,6 +244,7 @@ import {
order: 'asc',
ignoreAlias: false,
ignoreCase: true,
specialCharacters: 'keep',
groupKind: 'mixed',
partitionByNewLine: false,
partitionByComment: false,
Expand Down
Loading

0 comments on commit 96f8b10

Please sign in to comment.