Skip to content

Commit 44827e7

Browse files
Xunnamiusljharb
authored andcommitted
[Docs] extensions, order: fix a couple typos
1 parent 8ab06d6 commit 44827e7

File tree

3 files changed

+34
-46
lines changed

3 files changed

+34
-46
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
66

77
## [Unreleased]
88

9+
### Changed
10+
- [Docs] `extensions`, `order`: fix a couple typos ([#3106], thanks [@Xunnamius])
11+
912
## [2.31.0] - 2024-10-03
1013

1114
### Added
@@ -1152,6 +1155,7 @@ for info on changes for earlier releases.
11521155

11531156
[`memo-parser`]: ./memo-parser/README.md
11541157

1158+
[#3106]: https://github.com/import-js/eslint-plugin-import/pull/3106
11551159
[#3073]: https://github.com/import-js/eslint-plugin-import/pull/3073
11561160
[#3072]: https://github.com/import-js/eslint-plugin-import/pull/3072
11571161
[#3071]: https://github.com/import-js/eslint-plugin-import/pull/3071
@@ -2018,6 +2022,7 @@ for info on changes for earlier releases.
20182022
[@wtgtybhertgeghgtwtg]: https://github.com/wtgtybhertgeghgtwtg
20192023
[@xM8WVqaG]: https://github.com/xM8WVqaG
20202024
[@xpl]: https://github.com/xpl
2025+
[@Xunnamius]: https://github.com/Xunnamius
20212026
[@yesl-kim]: https://github.com/yesl-kim
20222027
[@yndajas]: https://github.com/yndajas
20232028
[@yordis]: https://github.com/yordis

docs/rules/extensions.md

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,11 @@ Default value of `ignorePackages` is `false`.
5858

5959
By default, `import type` and `export type` style imports/exports are ignored. If you want to check them as well, you can set the `checkTypeImports` option to `true`.
6060

61-
Unfortunately, in more advanced linting setups, such as when employing custom
62-
specifier aliases (e.g. you're using `eslint-import-resolver-alias`, `paths` in
63-
`tsconfig.json`, etc), this rule can be too coarse-grained when determining
64-
which imports to ignore and on which to enforce the law. This is especially
65-
troublesome if you have import specifiers that [look like externals or
66-
builtins](./order.md#how-imports-are-grouped).
61+
Unfortunately, in more advanced linting setups, such as when employing custom specifier aliases (e.g. you're using `eslint-import-resolver-alias`, `paths` in `tsconfig.json`, etc), this rule can be too coarse-grained when determining which imports to ignore and on which to enforce the config.
62+
This is especially troublesome if you have import specifiers that [look like externals or builtins](./order.md#how-imports-are-grouped).
6763

68-
Set `pathGroupOverrides` to force this rule to always ignore certain imports and
69-
never ignore others. `pathGroupOverrides` accepts an array of one or more [`PathGroupOverride`](#pathgroupoverride) objects.
64+
Set `pathGroupOverrides` to force this rule to always ignore certain imports and never ignore others.
65+
`pathGroupOverrides` accepts an array of one or more [`PathGroupOverride`](#pathgroupoverride) objects.
7066

7167
For example:
7268

@@ -81,14 +77,12 @@ For example:
8177
},
8278
pathGroupOverrides: [
8379
{
84-
{
85-
pattern: "package-name-to-ignore",
86-
action: "ignore",
87-
},
88-
{
89-
pattern: "bespoke+alias:{*,*/**}",
90-
action: "enforce",
91-
}
80+
pattern: "package-name-to-ignore",
81+
action: "ignore",
82+
},
83+
{
84+
pattern: "bespoke+alias:{*,*/**}",
85+
action: "enforce",
9286
}
9387
]
9488
}
@@ -97,17 +91,16 @@ For example:
9791

9892
> \[!NOTE]
9993
>
100-
> `pathGroupOverrides` is inspired by [`pathGroups` in
101-
> `'import/order'`](./order.md#pathgroups) and shares a similar interface. If you're
102-
> using `pathGroups` already, you may find `pathGroupOverrides` very useful.
94+
> `pathGroupOverrides` is inspired by [`pathGroups` in `'import/order'`](./order.md#pathgroups) and shares a similar interface.
95+
> If you're using `pathGroups` already, you may find `pathGroupOverrides` very useful.
10396
10497
#### `PathGroupOverride`
10598

106-
| property | required | type | description |
107-
| :--------------: | :------: | :--------------------: | ------------------------------------------------------------------------------------------------------------------------------- |
108-
| `pattern` | ☑️ | `string` | [Minimatch pattern][16] for specifier matching |
109-
| `patternOptions` | | `object` | [Minimatch options][17]; default: `{nocomment: true}` |
110-
| `action` | ☑️ | `"enforce" \| "ignore"` | What action to take on imports whose specifiers match `pattern` |
99+
| property | required | type | description |
100+
| :--------------: | :------: | :---------------------: | --------------------------------------------------------------- |
101+
| `pattern` | ☑️ | `string` | [Minimatch pattern][16] for specifier matching |
102+
| `patternOptions` | | `object` | [Minimatch options][17]; default: `{nocomment: true}` |
103+
| `action` | ☑️ | `"enforce" \| "ignore"` | What action to take on imports whose specifiers match `pattern` |
111104

112105
### Exception
113106

docs/rules/order.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Enforce a convention in the order of `require()` / `import` statements.
88

9-
With the [`groups`][2] option set to `["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"]` the order is as shown in the following example:
9+
With the [`groups`][18] option set to `["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"]` the order is as shown in the following example:
1010

1111
```ts
1212
// 1. node "builtin" modules
@@ -157,7 +157,7 @@ const identifier3 = require('specifier3');
157157

158158
Roughly speaking, the grouping algorithm is as follows:
159159

160-
1. If the import has no corresponding identifiers (e.g. `import'./my/thing.js'`), is otherwise "unassigned," or is an unsupported use of `require()`, and [`warnOnUnassignedImports`][5] is disabled, it will be ignored entirely since the order of these imports may be important for their [side-effects][31]
160+
1. If the import has no corresponding identifiers (e.g. `import './my/thing.js'`), is otherwise "unassigned," or is an unsupported use of `require()`, and [`warnOnUnassignedImports`][5] is disabled, it will be ignored entirely since the order of these imports may be important for their [side-effects][31]
161161
2. If the import is part of an arcane TypeScript declaration (e.g. `import log = console.log`), it will be considered **object**. However, note that external module references (e.g. `import x = require('z')`) are treated as normal `require()`s and import-exports (e.g. `export import w = y;`) are ignored entirely
162162
3. If the import is [type-only][6], `"type"` is in `groups`, and [`sortTypesAmongThemselves`][7] is disabled, it will be considered **type** (with additional implications if using [`pathGroups`][8] and `"type"` is in [`pathGroupsExcludedImportTypes`][9])
163163
4. If the import's specifier matches [`import/internal-regex`][28], it will be considered **internal**
@@ -298,7 +298,7 @@ Enforces or forbids new lines between import groups.
298298

299299
- If set to `always`, at least one new line between each group will be enforced, and new lines inside a group will be forbidden
300300

301-
> \[!TIP]
301+
> [!TIP]
302302
>
303303
> To prevent multiple lines between imports, the [`no-multiple-empty-lines` rule][21], or a tool like [Prettier][22], can be used.
304304
@@ -552,11 +552,11 @@ Default: `false`
552552

553553
> \[!NOTE]
554554
>
555-
> This setting is only meaningful when `"type"` is included in [`groups`][2].
555+
> This setting is only meaningful when `"type"` is included in [`groups`][18].
556556
557557
Sort [type-only imports][6] separately from normal non-type imports.
558558

559-
When enabled, the intragroup sort order of [type-only imports][6] will mirror the intergroup ordering of normal imports as defined by [`groups`][2], [`pathGroups`][8], etc.
559+
When enabled, the intragroup sort order of [type-only imports][6] will mirror the intergroup ordering of normal imports as defined by [`groups`][18], [`pathGroups`][8], etc.
560560

561561
#### Example
562562

@@ -612,13 +612,9 @@ Default: the value of [`newlines-between`][24]
612612
>
613613
> This setting is only meaningful when [`sortTypesAmongThemselves`][7] is enabled.
614614
615-
Enforces or forbids new lines between _[type-only][6] import groups_, which only
616-
exist when [`sortTypesAmongThemselves`][7] is enabled. `newlines-between-types`
617-
is otherwise functionally identical to [`newlines-between`][24].
615+
`newlines-between-types` is functionally identical to [`newlines-between`][24] except it only enforces or forbids new lines between _[type-only][6] import groups_, which exist only when [`sortTypesAmongThemselves`][7] is enabled.
618616

619-
In addition, when determining if a new line is enforceable or forbidden between
620-
the type-only imports and the normal imports, `newlines-between-types` takes
621-
precedence over [`newlines-between`][24].
617+
In addition, when determining if a new line is enforceable or forbidden between the type-only imports and the normal imports, `newlines-between-types` takes precedence over [`newlines-between`][24].
622618

623619
#### Example
624620

@@ -745,7 +741,7 @@ Default: `"never"`
745741
>
746742
> This setting is only meaningful when [`newlines-between`][24] and/or [`newlines-between-types`][27] is set to `"always-and-inside-groups"`.
747743
748-
When set to `"inside-groups"`, this ensures imports spanning multiple lines are separated from other imports with a new line while single-line imports are grouped together (and the space between them consolidated) if they belong to the same [group][2] or [`pathGroups`][26].
744+
When set to `"inside-groups"`, this ensures imports spanning multiple lines are separated from other imports with a new line while single-line imports are grouped together (and the space between them consolidated) if they belong to the same [group][18] or [`pathGroups`][26].
749745

750746
> \[!IMPORTANT]
751747
>
@@ -859,16 +855,11 @@ The same holds true for the next example; when given the following settings:
859855

860856
> [!IMPORTANT]
861857
>
862-
> **Pay special attention to the value of
863-
> [`pathGroupsExcludedImportTypes`](#pathgroupsexcludedimporttypes)** in this
864-
> example's settings. Without it, the successful example below would fail. This is
865-
> because the imports with specifiers starting with "dirA/", "dirB/", and
866-
> "dirC/" are all [considered part of the `"external"`
867-
> group](#how-imports-are-grouped), and imports in that group are
868-
> excluded from [`pathGroups`](#pathgroups) matching by default.
858+
> **Pay special attention to the value of [`pathGroupsExcludedImportTypes`](#pathgroupsexcludedimporttypes)** in this example's settings.
859+
> Without it, the successful example below would fail.
860+
> This is because the imports with specifiers starting with "dirA/", "dirB/", and "dirC/" are all [considered part of the `"external"` group](#how-imports-are-grouped), and imports in that group are excluded from [`pathGroups`](#pathgroups) matching by default.
869861
>
870-
> The fix is to remove `"external"` (and, in this example, the others) from
871-
> [`pathGroupsExcludedImportTypes`](#pathgroupsexcludedimporttypes).
862+
> The fix is to remove `"external"` (and, in this example, the others) from [`pathGroupsExcludedImportTypes`](#pathgroupsexcludedimporttypes).
872863
873864
This will fail the rule check:
874865

@@ -1012,7 +1003,6 @@ import type { H } from './bbb';
10121003
- [`import/core-modules`][11]
10131004

10141005
[1]: https://eslint.org/docs/latest/user-guide/command-line-interface#--fix
1015-
[2]: #groups-string
10161006
[3]: #how-imports-are-grouped
10171007
[4]: https://nodejs.org/api/esm.html#terminology
10181008
[5]: #warnonunassignedimports

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy