Skip to content

Commit

Permalink
[Docs] extensions: improve ignorePackages docs
Browse files Browse the repository at this point in the history
Closes #1248.
  • Loading branch information
ivo-stefchev authored and ljharb committed Aug 5, 2019
1 parent fb0cbeb commit b511da2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
- [`no-extraneous-dependencies`]: ensure `node.source` is truthy ([#1589], thanks [@ljharb])
- [`extensions`]: Ignore query strings when checking for extensions ([#1572], thanks [@pcorpet])

### Docs
- [`extensions`]: improve `ignorePackages` docs ([#1248], thanks [@ivo-stefchev])

### Added
- [`order`]: add option pathGroupsExcludedImportTypes to allow ordering of external import types ([#1565], thanks [@Mairu])

Expand Down Expand Up @@ -693,6 +696,7 @@ for info on changes for earlier releases.
[#1277]: https://github.com/benmosher/eslint-plugin-import/pull/1277
[#1257]: https://github.com/benmosher/eslint-plugin-import/pull/1257
[#1253]: https://github.com/benmosher/eslint-plugin-import/pull/1253
[#1248]: https://github.com/benmosher/eslint-plugin-import/pull/1248
[#1238]: https://github.com/benmosher/eslint-plugin-import/pull/1238
[#1235]: https://github.com/benmosher/eslint-plugin-import/pull/1235
[#1234]: https://github.com/benmosher/eslint-plugin-import/pull/1234
Expand Down Expand Up @@ -1063,3 +1067,4 @@ for info on changes for earlier releases.
[@dbrewer5]: https://github.com/dbrewer5
[@rsolomon]: https://github.com/rsolomon
[@joaovieira]: https://github.com/joaovieira
[@ivo-stefchev]: https://github.com/ivo-stefchev
19 changes: 18 additions & 1 deletion docs/rules/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,30 @@ By providing both a string and an object, the string will set the default settin
<severity>,
"never" | "always" | "ignorePackages",
{
<extension>: "never" | "always" | "ignorePackages"
<extension>: "never" | "always" | "ignorePackages"
}
]
```

For example, `["error", "never", { "svg": "always" }]` would require that all extensions are omitted, except for "svg".

`ignorePackages` can be set as a separate boolean option like this:
```
"import/extensions": [
<severity>,
"never" | "always" | "ignorePackages",
{
ignorePackages: true | false,
pattern: {
<extension>: "never" | "always" | "ignorePackages"
}
}
]
```
In that case, if you still want to specify extensions, you can do so inside the **pattern** property.
Default value of `ignorePackages` is `false`.


### Exception

When disallowing the use of certain extensions this rule makes an exception and allows the use of extension when the file would not be resolvable without extension.
Expand Down

0 comments on commit b511da2

Please sign in to comment.