From 5694891c502d11d13d4f748844309062e1b012f9 Mon Sep 17 00:00:00 2001 From: Lorenzo <30781484+lorenzodejong@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:57:39 +0200 Subject: [PATCH] chore: describe the sort-imports-ignore comment in the README --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 76ed32fb..9cb907ae 100644 --- a/README.md +++ b/README.md @@ -198,6 +198,17 @@ with options as a JSON string of the plugin array: importOrderParserPlugins: [] ``` +### Ignoring import ordering + +In some cases it's desired to ignore import ordering, specifically if you require to instantiate a common service or polyfill in your application logic before all the other imports. The plugin supports the `// sort-imports-ignore` comment, which will exclude the file from ordering the imports. + +```javascript +// sort-imports-ignore +import './polyfills'; + +import foo from 'foo' +``` + ### How does import sort work ? The plugin extracts the imports which are defined in `importOrder`. These imports are considered as _local imports_.