{"_id":"@bigtaddy/eslint-plugin-simple-import-sort","_rev":"1-64cc41edc13d344f4901c77cfc1fcc4e","name":"@bigtaddy/eslint-plugin-simple-import-sort","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bigtaddy/eslint-plugin-simple-import-sort","version":"1.0.0","license":"MIT","author":{"name":"Simon Lydell"},"repository":{"type":"git","url":"git+https://github.com/bigtaddy/eslint-plugin-simple-import-sort.git"},"description":"autofixable import sorting","main":"src/index.js","keywords":["eslint","eslint-plugin","eslintplugin","import","imports","order","sort","sorter","sorting"],"scripts":{"eslint":"eslint .","eslint:fix":"npm run eslint -- --fix","eslint:examples":"eslint --rulesdir src --no-ignore --fix-dry-run --format json --report-unused-disable-directives examples --ext .js,.ts,.vue","prettier":"prettier --write \"*.md\"","doctoc":"doctoc README.md","jest":"jest","coverage":"jest --coverage","test":"npm run eslint && npm run coverage","prepublishOnly":"npm run doctoc"},"dependencies":{"validate-npm-package-name":"^3.0.0"},"devDependencies":{"@typescript-eslint/parser":"1.10.2","babel-eslint":"10.0.1","cross-spawn":"6.0.5","doctoc":"1.4.0","eslint":"5.16.0","eslint-config-lydell":"14.0.0","eslint-plugin-import":"2.17.3","eslint-plugin-jest":"22.6.4","eslint-plugin-prettier":"3.1.0","eslint-plugin-vue":"5.2.2","jest":"24.8.0","prettier":"1.18.2","typescript":"3.5.2"},"peerDependencies":{"eslint":">=5.0.0"},"gitHead":"61e6b87faf761152b4ed5d0d4093fc714e8c3d85","bugs":{"url":"https://github.com/bigtaddy/eslint-plugin-simple-import-sort/issues"},"homepage":"https://github.com/bigtaddy/eslint-plugin-simple-import-sort#readme","_id":"@bigtaddy/eslint-plugin-simple-import-sort@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.15.1","_npmUser":{"name":"bigtaddy","email":"bigtaddy@yandex.ru"},"dist":{"integrity":"sha512-QID5aFEiqJPSXntb648g9aV12gefxfzH2M1bpTsBWSN7xoM0RzTVzFolMGeRUQbnPtb4hi/hGGi+O3Uv117d4Q==","shasum":"8f5a8bd20e0de8e9c9888f69334c1efac2dd872a","tarball":"https://registry.npmjs.org/@bigtaddy/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-1.0.0.tgz","fileCount":6,"unpackedSize":56704,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdLFVDCRA9TVsSAnZWagAAMJwQAJXQdQO9T5jWL1AlsY4w\nuaYdx31ulF5jf1fVAHve67Yz/Df7q9TV93U253p4dsyl7fKdj8boTBPTFuVi\nZJGuU03Nnn+Oqt+g/KufkbB65+Q4XBlOoCtB4mB1MnwYN6g33LCoelKatqOI\n5tA7rtSU3hrCdIX+1G+QjmlROgHbF/W3j7bNfV9vWLeMk8TDsvhLQnnCFfR0\nCmZuonewUYe2tMloV9lrHay2/4UEvgeS/adRrzarqMRmxyzFPmPAcVW2qNa5\n9GO2XT7s4o87uC0jUY0vk0d7JZXskULLX+K33TEyZl+35GvFuYn2IGmxFQbQ\nQqQuT5RZDt49EbF2tk5P2OjcXZUSzFkemVcHEF3LaiS6ZaV9+hxRrKlRGNic\nE3bCKJrjlYDfDsfWQ2ISLeLsYJcfdXT0mLDNY9Bx3At8WWF0keUvtj2LHPzs\n+4h5D54y6NAbq6goD8uWjty4yaLc7DOv8FiYZzT9hGfSrbk/w2vfUWUqu5DA\n0hS/IQAJvhMHFd3fLAch8NhEJ3LwDM2kSuqnMl/XUMxCHDQJno06hC6xTS0P\nqbn2YiUYw4yNKCYGurRppdHjj/eNkVWyXJ8hyUGyy57CzVdeCES9fZhxymCQ\nvS1NNMwaN7QMdjjZOssr5T0Ynq6G6tKXjkXP1DlJPgFfUYuFJM8oPmCl3uG3\ncw9k\r\n=HlAW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmydXQ+qiz4q6mstjd2Xd4vD8mymk6Mb6ecj9dp83/rQIgZyHBC75WraSwvgxcDqXAlt2Ri/DxO7ypZC6b9orNWts="}]},"maintainers":[{"name":"bigtaddy","email":"bigtaddy@yandex.ru"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-plugin-simple-import-sort_1.0.0_1563186498511_0.32420062536295147"},"_hasShrinkwrap":false}},"time":{"created":"2019-07-15T10:28:18.177Z","1.0.0":"2019-07-15T10:28:18.706Z","modified":"2022-04-04T18:46:59.386Z"},"maintainers":[{"name":"bigtaddy","email":"bigtaddy@yandex.ru"}],"description":"autofixable import sorting","homepage":"https://github.com/bigtaddy/eslint-plugin-simple-import-sort#readme","keywords":["eslint","eslint-plugin","eslintplugin","import","imports","order","sort","sorter","sorting"],"repository":{"type":"git","url":"git+https://github.com/bigtaddy/eslint-plugin-simple-import-sort.git"},"author":{"name":"Simon Lydell"},"bugs":{"url":"https://github.com/bigtaddy/eslint-plugin-simple-import-sort/issues"},"license":"MIT","readme":"# eslint-plugin-simple-import-sort [![Build Status][travis-badge]][travis-link]\r\n\r\nEasy autofixable import sorting.\r\n\r\n- ✔️ Runs via `eslint --fix` – no new tooling\r\n- ✔️ Handles comments\r\n- ✔️ Handles [Flow type imports] \\(via [babel-eslint])\r\n- ✔️ Handles [webpack loader syntax]\r\n- ✔️ [TypeScript] friendly \\(via [@typescript-eslint/parser])\r\n- ✔️ [Prettier] friendly\r\n- ✔️ [eslint-plugin-import] friendly\r\n- ✔️ `git diff` friendly\r\n- ✔️ 100% code coverage\r\n- ☯️ No configuration\r\n- ❌ [Does not support `require`][no-require]\r\n\r\nThis is for those who use `eslint --fix` (autofix) a lot and want to completely\r\nforget about sorting imports!\r\n\r\n## Contents\r\n\r\n<!-- prettier-ignore-start -->\r\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n\r\n\n- [Example](#example)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Example configuration](#example-configuration)\n- [Sort order](#sort-order)\n- [Comment and whitespace handling](#comment-and-whitespace-handling)\n- [FAQ](#faq)\n  - [Does it support `require`?](#does-it-support-require)\n  - [Why sort on `from`?](#why-sort-on-from)\n  - [Is sorting imports safe?](#is-sorting-imports-safe)\n  - [The sorting autofix causes some odd whitespace!](#the-sorting-autofix-causes-some-odd-whitespace)\n  - [Can I use this without autofix?](#can-i-use-this-without-autofix)\n- [Development](#development)\n  - [npm scripts](#npm-scripts)\n  - [Directories](#directories)\n- [License](#license)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n<!-- prettier-ignore-end -->\r\n\r\n## Example\r\n\r\n<!-- prettier-ignore -->\r\n```js\r\nimport React from \"react\";\r\nimport Button from \"../Button\";\r\n\r\nimport styles from \"./styles.css\";\r\nimport type { User } from \"../../types\";\r\nimport { getUser } from \"../../api\";\r\n\r\nimport PropTypes from \"prop-types\";\r\nimport classnames from \"classnames\";\r\nimport { truncate, formatNumber } from \"../../utils\";\r\n```\r\n\r\n⬇️\r\n\r\n<!-- prettier-ignore -->\r\n```js\r\nimport classnames from \"classnames\";\r\nimport PropTypes from \"prop-types\";\r\nimport React from \"react\";\r\n\r\nimport { getUser } from \"../../api\";\r\nimport type { User } from \"../../types\";\r\nimport { formatNumber, truncate } from \"../../utils\";\r\nimport Button from \"../Button\";\r\nimport styles from \"./styles.css\";\r\n```\r\n\r\n[More examples][examples]\r\n\r\n## Installation\r\n\r\nFirst you need to install [ESLint]:\r\n\r\n```\r\nnpm install --save-dev eslint\r\n```\r\n\r\nNext, install `eslint-plugin-simple-import-sort`:\r\n\r\n```\r\nnpm install --save-dev eslint-plugin-simple-import-sort\r\n```\r\n\r\n## Usage\r\n\r\nAdd `simple-import-sort` to the plugins section of your `.eslintrc`\r\nconfiguration file. You can omit the `eslint-plugin-` prefix:\r\n\r\n```json\r\n{\r\n  \"plugins\": [\"simple-import-sort\"]\r\n}\r\n```\r\n\r\nThen add the import sort rule:\r\n\r\n```json\r\n{\r\n  \"rules\": {\r\n    \"simple-import-sort/sort\": \"error\"\r\n  }\r\n}\r\n```\r\n\r\nMake sure to remove or disable other sorting rules, such as [sort-imports] and\r\n[import/order].\r\n\r\n```json\r\n{\r\n  \"rules\": {\r\n    \"sort-imports\": \"off\",\r\n    \"import/order\": \"off\"\r\n  }\r\n}\r\n```\r\n\r\nSince this plugin does not support [sorting `require`][no-require], you might\r\nwant to enable some other sorting rule only for files that use `require`:\r\n\r\n```json\r\n{\r\n  \"overrides\": [\r\n    {\r\n      \"files\": \"server/**/*.js\",\r\n      \"rules\": {\r\n        \"simple-import-sort/sort\": \"off\",\r\n        \"import/order\": [\"error\", { \"newlines-between\": \"always\" }]\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\n## Example configuration\r\n\r\nThis example uses the following extra (optional) plugins:\r\n\r\n- [eslint-plugin-prettier]\r\n- [eslint-plugin-import]\r\n\r\n```json\r\n{\r\n  \"parserOptions\": {\r\n    \"sourceType\": \"module\"\r\n  },\r\n  \"env\": { \"es6\": true },\r\n  \"plugins\": [\"simple-import-sort\", \"prettier\", \"import\"],\r\n  \"rules\": {\r\n    \"simple-import-sort/sort\": \"error\",\r\n    \"sort-imports\": \"off\",\r\n    \"prettier/prettier\": \"error\",\r\n    \"import/first\": \"error\",\r\n    \"import/newline-after-import\": \"error\",\r\n    \"import/no-duplicates\": \"error\"\r\n  },\r\n  \"overrides\": [\r\n    {\r\n      \"files\": \"server/**/*.js\",\r\n      \"env\": { \"node\": true },\r\n      \"rules\": {\r\n        \"simple-import-sort/sort\": \"off\",\r\n        \"import/order\": [\"error\", { \"newlines-between\": \"always\" }]\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\n- `simple-import-sort/sort` is turned on by default.\r\n- The standard [sort-imports] rule is turned off, in case you extend a config\r\n  that includes it.\r\n- [prettier/prettier] runs [Prettier] inside ESLint and helps formatting your\r\n  imports (and all other code) nicely. (autofixable)\r\n- [import/first] makes sure all imports are at the top of the file.\r\n  (autofixable)\r\n- [import/newline-after-import] makes sure there’s a newline after the imports.\r\n  (autofixable)\r\n- [import/no-duplicates] merges import statements of the same file.\r\n  (autofixable, mostly)\r\n- For Node.js code, `simple-import-sort/sort` is turned off and replaced with\r\n  [import/order] for sorting of `require` calls.\r\n\r\nWith the above configuration, you don’t need to scroll to the top of the file to\r\nadd another import. Just put it above your function! ESLint will then snap it\r\ninto place (at the top of the file, in order, and without duplicates).\r\n\r\n## Sort order\r\n\r\nThis plugin is supposed to be used with autofix, ideally directly in your editor\r\nvia an ESLint extension, or with [`eslint --fix`][eslint-fix] otherwise.\r\n\r\nThis section is for learning how the sorting works, not for how to manually fix\r\nerrors. Use autofix!\r\n\r\n**TL;DR:** First group, then sort alphabetically.\r\n\r\nFirst, the plugin finds all _chunks_ of imports. A “chunk” is a sequence of\r\nimport statements with only comments and whitespace between. Each chunk is\r\nsorted separately. Use [import/first] if you want to make sure that all imports\r\nend up in the same chunk.\r\n\r\nThen, each chunk is _grouped_ into sections with a blank line between each.\r\n\r\n1. `import react from \"react\"`: Packages (npm packages and Node.js builtins).\r\n2. `import a from \"/a\"`: Absolute imports, full URLs and other imports (such as\r\n   Vue-style `@/foo` ones).\r\n3. `import a from \"./a\"`: Relative imports.\r\n4. `import \"./setup\"`: Side effect imports. (These are not sorted internally.)\r\n\r\nWithin each section, the imports are sorted alphabetically on the `from` string\r\n(see also [“Why sort on `from`?”][sort-from]). Keep it simple! It helps looking\r\nat the code here:\r\n\r\n```js\r\nconst collator = new Intl.Collator(\"en\", {\r\n  sensitivity: \"base\",\r\n  numeric: true,\r\n});\r\n\r\nfunction compare(a, b) {\r\n  return collator.compare(a, b) || (a < b ? -1 : a > b ? 1 : 0);\r\n}\r\n```\r\n\r\nIn other words, the imports within groups are sorted alphabetically,\r\ncase-insensitively and treating numbers like a human would, falling back to good\r\nold character code sorting in case of ties. See [Intl.Collator] for more\r\ninformation.\r\n\r\nSince “.” sorts before “/”, relative imports of files higher up in the directory\r\nstructure come before closer ones – `\"../../utils\"` comes before `\"../utils\"`.\r\nPerhaps surprisingly though, `\"..\"` would come before `\"../../utils\"` (since\r\nshorter substrings sort before longer strings). For that reason there’s one\r\naddition to the alphabetical rule: `\".\"` and `\"..\"` are treated as `\"./\"` and\r\n`\"../\"`. Also, within the absolute imports group, imports starting with an ASCII\r\nletter or digit come first, separating them from those starting with symbols.\r\n\r\n[webpack loader syntax] is stripped before sorting, so `\"loader!a\"` sorts before\r\n`\"b\"`. If two sources are equal after stripping the loader syntax, the one with\r\nloader syntax comes last. Similarly, if both `import type` _and_ regular imports\r\nare used for the same source, the [Flow type imports] come first.\r\n\r\nExample:\r\n\r\n<!-- prettier-ignore -->\r\n```js\r\n// Side effect imports. (These are not sorted internally.)\r\nimport \"./setup\";\r\nimport \"some-polyfill\";\r\nimport \"./global.css\";\r\n\r\n// Packages.\r\nimport type A from \"an-npm-package\";\r\nimport a from \"an-npm-package\";\r\nimport fs from \"fs\";\r\n\r\n// Absolute imports, full URLs and other imports.\r\nimport b from \"https://example.com/script.js\";\r\nimport Error from \"@/components/error.vue\";\r\nimport c from \"/\";\r\nimport d from \"/home/user/foo\";\r\n\r\n// Relative imports.\r\nimport e from \"../..\";\r\nimport f from \"../../Utils\"; // Case insensitive.\r\nimport type { B } from \"../types\";\r\nimport typeof C from \"../types\";\r\nimport g from \".\";\r\nimport h from \"./constants\";\r\nimport i from \"./styles\";\r\nimport j from \"html-loader!./text.html\";\r\n\r\n// Regardless of group, imported items are sorted like this:\r\nimport {\r\n  // First, Flow type imports.\r\n  type x,\r\n  typeof y,\r\n  // Numbers are sorted by their numeric value:\r\n  img1,\r\n  img2,\r\n  img10,\r\n  // Then everything else, alphabetically:\r\n  k,\r\n  L, // Case insensitive.\r\n  m as anotherName, // Sorted by the original name “m”, not “anotherName”.\r\n  m as tie, // But do use the \\`as\\` name in case of a tie.\r\n  n,\r\n} from \"./x\";\r\n```\r\n\r\n<!--\r\nWorkaround to make the next section to appear in the table of contents.\r\n```js\r\n```\r\n-->\r\n\r\n## Comment and whitespace handling\r\n\r\nWhen an import is moved through sorting, it’s comments are moved with it.\r\nComments can be placed above an import (except the first one – more on that\r\nlater), or at the start or end of its line.\r\n\r\nExample:\r\n\r\n<!-- prettier-ignore -->\r\n```js\r\n// comment before import chunk\r\n/* c1 */ import c from \"c\"; // c2\r\n// b1\r\nimport b from \"b\"; // b2\r\n// a1\r\n\r\n/* a2\r\n */ import a /* a3 */ from \"a\"; /* a4 */ /* not-a\r\n*/ // comment after import chunk\r\n```\r\n\r\n⬇️\r\n\r\n<!-- prettier-ignore -->\r\n```js\r\n// comment before import chunk\r\n// a1\r\n/* a2\r\n */ import a /* a3 */ from \"a\"; /* a4 */\r\n// b1\r\nimport b from \"b\"; // b2\r\n/* c1 */ import c from \"c\"; // c2\r\n /* not-a\r\n*/ // comment after import chunk\r\n```\r\n\r\nNow compare these two examples:\r\n\r\n```js\r\n// @flow\r\nimport b from \"b\";\r\n// a\r\nimport a from \"a\";\r\n```\r\n\r\n```js\r\n// eslint-disable-next-line import/no-extraneous-dependencies\r\nimport b from \"b\";\r\n// a\r\nimport a from \"a\";\r\n```\r\n\r\nThe `// @flow` comment is supposed to be at the top of the file (it enables\r\n[Flow] type checking for the file), and isn’t related to the `\"b\"` import. On\r\nthe other hand, the `// eslint-disable-next-line` comment _is_ related to the\r\n`\"b\"` import. Even a documentation comment could be either for the whole file,\r\nor the first import. So this plugin can’t know if it should move comments above\r\nthe first import or not (but it knows that the `//a` comment belongs to the\r\n`\"a\"` import).\r\n\r\nFor this reason, comments above and below chunks of imports are never moved. You\r\nneed to do so yourself, if needed.\r\n\r\nComments around imported items follow similar rules – they can be placed above\r\nan item, or at the start or end of its line. Comments before the first item or\r\nnewline stay at the start, and comments after the last item stay at the end.\r\n\r\n<!-- prettier-ignore -->\r\n```js\r\nimport { // comment at start\r\n  /* c1 */ c /* c2 */, // c3\r\n  // b1\r\n\r\n  b as /* b2 */ renamed\r\n  , /* b3 */ /* a1\r\n  */ a /* not-a\r\n  */ // comment at end\r\n} from \"wherever\";\r\nimport {\r\n  e,\r\n  d, /* d */ /* not-d\r\n  */ // comment at end after trailing comma\r\n} from \"wherever2\";\r\nimport {/* comment at start */ g, /* g */ f /* f */} from \"wherever3\";\r\n```\r\n\r\n⬇️\r\n\r\n<!-- prettier-ignore -->\r\n```js\r\nimport { // comment at start\r\n/* a1\r\n  */ a, \r\n  // b1\r\n  b as /* b2 */ renamed\r\n  , /* b3 */ \r\n  /* c1 */ c /* c2 */// c3\r\n/* not-a\r\n  */ // comment at end\r\n} from \"wherever\";\r\nimport {\r\n  d, /* d */   e,\r\n/* not-d\r\n  */ // comment at end after trailing comma\r\n} from \"wherever2\";\r\nimport {/* comment at start */ f, /* f */g/* g */ } from \"wherever3\";\r\n```\r\n\r\nIf you wonder what’s up with the strange whitespace – see [“The sorting autofix\r\ncauses some odd whitespace!”][odd-whitespace]\r\n\r\nSpeaking of whitespace – what about blank lines? Just like comments, it’s\r\ndifficult to know where blank lines should go after sorting. This plugin went\r\nwith a simple approach – all blank lines in chunks of imports are removed,\r\nexcept in `/**/` comments and the blank lines added between the groups mentioned\r\nin [Sort order].\r\n\r\n(Since blank lines are removed, you might get slight incompatibilities with the\r\n[lines-around-comment] and [padding-line-between-statements] rules – I don’t use\r\nthose myself, but I think there should be workarounds.)\r\n\r\nThe final whitespace rule is that this plugin puts one import per line, with no\r\nindentation. I’ve never seen imports written any other way.\r\n\r\n## FAQ\r\n\r\n### Does it support `require`?\r\n\r\nNo. This is intentional to keep things simple. Use some other sorting rule, such\r\nas [import/order], for sorting `require`.\r\n\r\n### Why sort on `from`?\r\n\r\nSome other import sorting rules sort based on the first name after `import`,\r\nrather than the string after `from`. This plugin intentionally sorts on the\r\n`from` string to be `git diff` friendly.\r\n\r\nHave a look at this example:\r\n\r\n```js\r\nimport { productType } from \"./constants\";\r\nimport { truncate } from \"./utils\";\r\n```\r\n\r\nNow let’s say you need the `arraySplit` util as well:\r\n\r\n```js\r\nimport { productType } from \"./constants\";\r\nimport { arraySplit, truncate } from \"./utils\";\r\n```\r\n\r\nIf the imports were sorted based on the first name after `import` (“productType”\r\nand “arraySplit” in this case), the two imports would now swap order:\r\n\r\n```js\r\nimport { arraySplit, truncate } from \"./utils\";\r\nimport { productType } from \"./constants\";\r\n```\r\n\r\nOn the other hand, if sorting based on the `from` string (like this plugin\r\ndoes), the imports stay in the same order. This prevents the imports from\r\njumping around as you add and remove things, keeping your git history clean and\r\nreducing the risk of merge conflicts.\r\n\r\n### Is sorting imports safe?\r\n\r\nMostly.\r\n\r\nImports can have side effects in JavaScript, so changing the order of the\r\nimports can change the order that those side effects execute in. It is best\r\npractice to _either_ import a module for its side effects _or_ for the things it\r\nexports.\r\n\r\n```js\r\n// An `import` that runs side effects:\r\nimport \"some-polyfill\";\r\n\r\n// An `import` that gets `someUtil`:\r\nimport { someUtil } from \"some-library\";\r\n```\r\n\r\nImports that are only used for side effects stay in the input order. These won’t\r\nbe sorted:\r\n\r\n```js\r\nimport \"b\";\r\nimport \"a\";\r\n```\r\n\r\nImports that _both_ export stuff _and_ run side effects are rare. If you run\r\ninto such a situation – try to fix it, since it will confuse everyone working\r\nwith the code. If that’s not possible, it’s possible to **[ignore (parts of)\r\nsorting][example-ignore].**\r\n\r\nAnother small caveat is that you sometimes need to move comments manually – see\r\n[Comment and whitespace handling][comment-handling].\r\n\r\nFor completeness, sorting the imported _items_ of an import is always safe:\r\n\r\n```js\r\nimport { c, b, a } from \"wherever\";\r\n// Equivalent to:\r\nimport { a, b, c } from \"wherever\";\r\n```\r\n\r\nNote: `import {} from \"wherever\"` is _not_ treated as a side effect import.\r\n\r\n### The sorting autofix causes some odd whitespace!\r\n\r\nYou might end up with slightly weird spacing, for example a missing space after\r\na comma:\r\n\r\n<!-- prettier-ignore -->\r\n```js\r\nimport {bar, baz,foo} from \"example\";\r\n```\r\n\r\nSorting is the easy part of this plugin. Handling whitespace and comments is the\r\nhard part. The autofix might end up with a little odd spacing around an import\r\nsometimes. Rather than fixing those spaces by hand, I recommend using [Prettier]\r\nor enabling other autofixable ESLint whitespace rules. See [examples] for more\r\ninformation.\r\n\r\nThe reason the whitespace can end up weird is because this plugin re-uses and\r\nmoves around already existing whitespace rather than removing and adding new\r\nwhitespace. This is to stay compatible with other ESLint rules that deal with\r\nwhitespace.\r\n\r\n### Can I use this without autofix?\r\n\r\nNot really. The error message for this rule is literally “Run autofix to sort\r\nthese imports!” Why? To actively encourage you to use autofix, and not waste\r\ntime on manually doing something that the computer does a lot better. I’ve seen\r\npeople painstakingly fixing cryptic (and annoying!) sorting errors from other\r\nrules one by one, not realizing they could have been autofixed. Finally, not\r\ntrying to make more detailed messages makes the code of this plugin _much_\r\neasier to work with.\r\n\r\n## Development\r\n\r\nYou can need [Node.js] 10 and npm 6.\r\n\r\n### npm scripts\r\n\r\n- `npm run eslint`: Run [ESLint] \\(including [Prettier]).\r\n- `npm run eslint:fix`: Autofix [ESLint] errors.\r\n- `npm run eslint:examples`: Used by `test/examples.test.js`.\r\n- `npm run prettier`: Run [Prettier] for files other than JS.\r\n- `npm run doctoc`: Run [doctoc] on README.md.\r\n- `npm run jest`: Run unit tests. During development, `npm run jest -- --watch`\r\n  is nice.\r\n- `npm run coverage`: Run unit tests with code coverage.\r\n- `npm test`: Check that everything works.\r\n- `npm publish`: Publish to [npm], but only if `npm test` passes.\r\n\r\n### Directories\r\n\r\n- `src/`: Source code.\r\n- `examples/`: Examples, tested in `test/examples.test.js`.\r\n- `test/`: [Jest] tests.\r\n\r\n## License\r\n\r\n[MIT](LICENSE)\r\n\r\n<!-- prettier-ignore-start -->\r\n[@typescript-eslint/parser]: https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser\r\n[babel-eslint]: https://github.com/babel/babel-eslint\r\n[comment-handling]: #comment-and-whitespace-handling\r\n[doctoc]: https://github.com/thlorenz/doctoc/\r\n[eslint-fix]: https://eslint.org/docs/user-guide/command-line-interface#--fix\r\n[eslint-plugin-import]: https://github.com/benmosher/eslint-plugin-import/\r\n[eslint-plugin-prettier]: https://github.com/prettier/eslint-plugin-prettier\r\n[eslint]: https://eslint.org/\r\n[example-ignore]: https://github.com/lydell/eslint-plugin-simple-import-sort/blob/master/examples/ignore.js\r\n[examples]: https://github.com/lydell/eslint-plugin-simple-import-sort/blob/master/examples/.eslintrc.js\r\n[flow type imports]: https://flow.org/en/docs/types/modules/\r\n[flow]: https://flow.org/\r\n[import/first]: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md\r\n[import/first]: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md\r\n[import/newline-after-import]: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md\r\n[import/no-duplicates]: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md\r\n[import/order]: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md\r\n[intl.collator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator\r\n[jest]: https://jestjs.io/\r\n[lines-around-comment]: https://eslint.org/docs/rules/lines-around-comment\r\n[no-require]: #does-it-support-require\r\n[node.js]: https://nodejs.org/en/\r\n[npm]: https://www.npmjs.com/\r\n[odd-whitespace]: #the-sorting-autofix-causes-some-odd-whitespace\r\n[padding-line-between-statements]: https://eslint.org/docs/rules/padding-line-between-statements\r\n[prettier]: https://prettier.io/\r\n[prettier/prettier]: https://github.com/prettier/eslint-plugin-prettier\r\n[sort order]: #sort-order\r\n[sort-from]: #why-sort-on-from\r\n[sort-imports]: https://eslint.org/docs/rules/sort-imports\r\n[travis-badge]: https://travis-ci.com/lydell/eslint-plugin-simple-import-sort.svg?branch=master\r\n[travis-link]: https://travis-ci.com/lydell/eslint-plugin-simple-import-sort\r\n[typescript]: https://www.typescriptlang.org/\r\n[webpack loader syntax]: https://webpack.js.org/concepts/loaders/#inline\r\n<!-- prettier-ignore-end -->\r\n","readmeFilename":"README.md"}