From b511da2011d77f601a228ffa1bad6792c1830749 Mon Sep 17 00:00:00 2001 From: Ivo Stefchev Date: Tue, 6 Aug 2019 00:42:36 +0300 Subject: [PATCH] [Docs] `extensions`: improve `ignorePackages` docs Closes #1248. --- CHANGELOG.md | 5 +++++ docs/rules/extensions.md | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c05d4a045..de4457569 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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]) @@ -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 @@ -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 diff --git a/docs/rules/extensions.md b/docs/rules/extensions.md index 6e1d2b50a..2f6d4a9c7 100644 --- a/docs/rules/extensions.md +++ b/docs/rules/extensions.md @@ -29,13 +29,30 @@ By providing both a string and an object, the string will set the default settin , "never" | "always" | "ignorePackages", { - : "never" | "always" | "ignorePackages" + : "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": [ + , + "never" | "always" | "ignorePackages", + { + ignorePackages: true | false, + pattern: { + : "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.