{"_id":"@binayabaral/prettier-plugin-imports-sorter","_rev":"1-cd9f96afa52abdea04a1e6103a7b53da","name":"@binayabaral/prettier-plugin-imports-sorter","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@binayabaral/prettier-plugin-imports-sorter","version":"1.0.0","description":"A prettier plugin to sort import declarations by provided Regular Expression order. A fork of @trivago/prettier-plugin-sort-imports","main":"lib/src/index.js","repository":{"url":"git+https://github.com/binayabaral/prettier-plugin-sort-imports.git","type":"git"},"homepage":"https://github.com/binayabaral/prettier-plugin-sort-imports#readme","scripts":{"prepare":"yarn run compile","compile":"tsc","preexample":"yarn run compile","example":"prettier --config ./examples/.prettierrc --plugin lib/src/index.js","test":"jest -i","type-check":"tsc --noEmit","prepublishOnly":"npm run compile"},"keywords":["prettier","plugin","sort","import","typescript","javascript"],"author":{"name":"Binaya Baral","email":"binaya.baral5@gmail.com","url":"https://github.com/binayabaral"},"license":"Apache-2.0","dependencies":{"@babel/core":"7.17.8","@babel/generator":"7.17.7","@babel/parser":"7.17.8","@babel/traverse":"7.17.3","@babel/types":"7.17.0","javascript-natural-sort":"0.7.1","lodash":"4.17.21"},"devDependencies":{"@types/chai":"4.2.15","@types/jest":"26.0.20","@types/node":"14.14.34","@types/lodash":"4.14.168","jest":"26.6.3","prettier":"2.3.1","ts-jest":"26.5.3","typescript":"4.2.3"},"peerDependencies":{"prettier":"2.x"},"gitHead":"2014c23d5a38f4766f94842e91f4ebac07f745d8","bugs":{"url":"https://github.com/binayabaral/prettier-plugin-sort-imports/issues"},"_id":"@binayabaral/prettier-plugin-imports-sorter@1.0.0","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-dlO5y0pAPB5jJFhlGS7ylJzx7KOt6lCNpygJwV+3dR9wTKGbs/Fez9OTtAIpqUvgv0mzDo3QRUj6M8mRbkkM8g==","shasum":"3669d6439077bd41d6e6873f70b69b71c6f10cbc","tarball":"https://registry.npmjs.org/@binayabaral/prettier-plugin-imports-sorter/-/prettier-plugin-imports-sorter-1.0.0.tgz","fileCount":27,"unpackedSize":64144,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwhWffojBKLHNZloHBWkaedge2uVEefASsNI74jyVlEgIgUMWe//NnwBQb4k+98hFWzAZQAOe28fTPUo2nMAQ1WTg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi+NPxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqeYg/9GMqZ95u3YiAvqYIXN4pXo4S5KB68+cT9F9m/euk9sj3caygz\r\nD5HL5OrsDTgBMlKYiH6No9zLHfS5MHe0ogcAP3AiKP8J0pSxs6poiasoaBv3\r\nrTTwIreF0FvsyzjevcOLZfHHLHmr/rpQfBQaSmSm8n4oyVgsy7qhJ2Nim3dM\r\n/cShShlETSp9yUx4sn5YpurN6HgwwChoWdvoVISjzhcTFnX2bklzcw9g14Hv\r\nnSDQs+sFRrWtvlKFxV7Epo/8KEEPwJJguPyKDyjeMcfqePrRU8eHhN6+2GEl\r\njuEoI8stnA/LD7tV0TBkIACxMGPlnZFaszk0yMwhSqf9OxnzbbKXSb4U8Hly\r\n44SWrmQCZBVjBxBvqcxIJrYOM3PYuZTcUBMXKwKKcbizBoPJhX/2knFRrwAh\r\nbQZKWxu75UIKBjo5Ps3VsAd5Rc7/+8g++WehXic0K4m9zCkP2b4bGCTJ2ARI\r\nuVfbLaefAEtt6tBIGbGVmymP+i8WlGUMc/2hZ7orwS4OullXf2v8fHBi2d37\r\nAx7rAPc3thrSAVR2SA6NjaKPk1S85s74AiYvd8zq4qI8nnbw4R/3U1w2BubU\r\nWfDrfp6iJR43ZdbkJHz2HdS0QwgeC8edptb8Uz9Ikt9NSiqbFQqJuLELDO76\r\n1AxG6Y8lftfi22bju4t95gL7dBRxa/Aojn0=\r\n=shXz\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"binayabaral","email":"binaya.baral5@gmail.com"},"directories":{},"maintainers":[{"name":"binayabaral","email":"binaya.baral5@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prettier-plugin-imports-sorter_1.0.0_1660474352808_0.1724285505632639"},"_hasShrinkwrap":false},"1.0.1":{"name":"@binayabaral/prettier-plugin-imports-sorter","version":"1.0.1","description":"A prettier plugin to sort import declarations by provided Regular Expression order. A fork of @trivago/prettier-plugin-sort-imports","main":"lib/src/index.js","repository":{"url":"git+https://github.com/binayabaral/prettier-plugin-sort-imports.git","type":"git"},"homepage":"https://github.com/binayabaral/prettier-plugin-sort-imports#readme","scripts":{"prepare":"yarn run compile","compile":"tsc","preexample":"yarn run compile","example":"prettier --config ./examples/.prettierrc --plugin lib/src/index.js","test":"jest -i","type-check":"tsc --noEmit","prepublishOnly":"npm run compile"},"keywords":["prettier","plugin","sort","import","typescript","javascript"],"author":{"name":"Binaya Baral","email":"binaya.baral5@gmail.com","url":"https://github.com/binayabaral"},"license":"Apache-2.0","dependencies":{"@babel/core":"7.17.8","@babel/generator":"7.17.7","@babel/parser":"7.17.8","@babel/traverse":"7.17.3","@babel/types":"7.17.0","javascript-natural-sort":"0.7.1","lodash":"4.17.21"},"devDependencies":{"@types/chai":"4.2.15","@types/jest":"26.0.20","@types/node":"14.14.34","@types/lodash":"4.14.168","jest":"26.6.3","prettier":"2.3.1","ts-jest":"26.5.3","typescript":"4.2.3"},"peerDependencies":{"prettier":"2.x"},"gitHead":"1501d52ce816a1f24dd14a2255cf772911fb9511","bugs":{"url":"https://github.com/binayabaral/prettier-plugin-sort-imports/issues"},"_id":"@binayabaral/prettier-plugin-imports-sorter@1.0.1","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-XSsIaou95p6aaieCsB4wesHKVWYzviR9+epBM0B9uzR0CY47xRonlyYTKz9mohfAagxssp0yyYCbTsegt/2wvw==","shasum":"87553ff2a96149ed47f8fa8539c754533c389045","tarball":"https://registry.npmjs.org/@binayabaral/prettier-plugin-imports-sorter/-/prettier-plugin-imports-sorter-1.0.1.tgz","fileCount":27,"unpackedSize":64148,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQtMCdnEWyIMr96iTPiRR9H+vlg18mp+yZ8aBQGLXdMgIhAMfhjdrBDbvRc7nInNGDE2nCtlGMHmGhbZyLCQGffm9v"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi+0yuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrvJA/9FzrzF12uNRZ4jytmEMz6U3PHKEs7dRQmteJpjdtH6QCMSEtq\r\n4/l9qfh3BfCwU/l3WwuO81u/ff1z/28e5MhTjl2FXNeMsPziQbyJg/dlZtGR\r\nPpciA1inLS1Ccy9daDAcTG9n2Eu9ijuKlWruVCU4ZbpR9Vogaeabo98POG0x\r\nFirLna5iutxeII697mV0sRJC9TsxAe7Jx1cX+ocPsnx26AmTLs5U8t2kZSH4\r\nBqb4aDomVJlhTEgYTXS5zySmOnN/S4vThMntX1XoSPR7I7KVH3JIVHgwzlrn\r\nEsymMlWHKcqMujv+VRZduBk1Kx+M2EZbQY9+RXJ+xbCJVRTg8eWVPhiyStVU\r\nWtU3+7VrD3CU8E2+cvpmhKI6WdC1VsKvYXwQx45K+WNe3AZZxRzXaJc7PWu8\r\npED4CIf2wIPBEuIrx0D97INseADJQ2KwwKkOKc+nUXkxUE1s1DyE/T/SBYWl\r\nTZ2qMCNFuX1fZMKDvnBBgm2eMleMAo1NCkUQshXuD6eTo6BK2kJdf/UUhRwI\r\nr+eg4LJ2anHuY1GOxQ1jSjMjqd2H2jFMu7vfycJkNf/D8tVfE7/4ltl5suPF\r\nhInDLNahXhHuuEGM16/mq6pNvrrdJI2INSXkb1RXUs8WrNqjhBkwnZXqtf5+\r\n/SkyDy95UjY/TgdSKXodyaZYjgu4gt3XwW0=\r\n=5gQ5\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"binayabaral","email":"binaya.baral5@gmail.com"},"directories":{},"maintainers":[{"name":"binayabaral","email":"binaya.baral5@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prettier-plugin-imports-sorter_1.0.1_1660636333808_0.15291540619424793"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-14T10:52:32.756Z","1.0.0":"2022-08-14T10:52:33.021Z","modified":"2022-08-16T07:52:14.112Z","1.0.1":"2022-08-16T07:52:14.037Z"},"maintainers":[{"name":"binayabaral","email":"binaya.baral5@gmail.com"}],"description":"A prettier plugin to sort import declarations by provided Regular Expression order. A fork of @trivago/prettier-plugin-sort-imports","homepage":"https://github.com/binayabaral/prettier-plugin-sort-imports#readme","keywords":["prettier","plugin","sort","import","typescript","javascript"],"repository":{"url":"git+https://github.com/binayabaral/prettier-plugin-sort-imports.git","type":"git"},"author":{"name":"Binaya Baral","email":"binaya.baral5@gmail.com","url":"https://github.com/binayabaral"},"bugs":{"url":"https://github.com/binayabaral/prettier-plugin-sort-imports/issues"},"license":"Apache-2.0","readme":"# Prettier plugin sort imports\n\nA prettier plugin to sort import declarations by provided Regular Expression order.\n\n**Note: If you are migrating from v2.x.x to v3.x.x, [Please Read Migration Guidelines](./docs/MIGRATION.md)**\n\n### Input\n\n```javascript\nimport { initializeApp } from '@core/app';\nimport { logger } from '@core/logger';\nimport { createConnection } from '@server/database';\nimport { createServer } from '@server/node';\nimport { Alert } from '@ui/Alert';\nimport { Popup } from '@ui/Popup';\nimport { debounce, reduce } from 'lodash';\nimport React, {\n    ChangeEvent,\n    FC,\n    KeyboardEvent,\n    useEffect,\n    useRef,\n} from 'react';\nimport { Message } from '../Message';\nimport { add, filter, repeat } from '../utils';\n```\n\n### Output\n\n```javascript\nimport { initializeApp } from '@core/app';\nimport { logger } from '@core/logger';\nimport { createConnection } from '@server/database';\nimport { createServer } from '@server/node';\nimport { Alert } from '@ui/Alert';\nimport { Popup } from '@ui/Popup';\nimport { debounce, reduce } from 'lodash';\nimport React, {\n    ChangeEvent,\n    FC,\n    KeyboardEvent,\n    useEffect,\n    useRef,\n} from 'react';\nimport { Message } from '../Message';\nimport { add, filter, repeat } from '../utils';\n```\n\n### Install\n\nnpm\n\n```shell script\nnpm install --save-dev @binayabaral/prettier-plugin-imports-sorter\n```\n\nor, using yarn\n\n```shell script\nyarn add --dev @binayabaral/prettier-plugin-imports-sorter\n```\n\n**Note: If you are migrating from v2.x.x to v3.x.x, [Please Read Migration Guidelines](./docs/MIGRATION.md)**\n\n### Usage\n\nAdd an order in prettier config file.\n\n```javascript\nmodule.exports = {\n  \"printWidth\": 80,\n  \"tabWidth\": 4,\n  \"trailingComma\": \"all\",\n  \"singleQuote\": true,\n  \"semi\": true,\n  \"importOrder\": [\"^@core/(.*)$\", \"^@server/(.*)$\", \"^@ui/(.*)$\", \"^[./]\"],\n  \"importOrderSeparation\": true,\n  \"importOrderSortSpecifiers\": true,\n  \"importOrderSortByPrintWidth\": true,\n}\n```\n\n### APIs\n\n#### **`importOrder`**\n\n**type**: `Array<string>`\n\nA collection of Regular expressions in string format.\n\n```\n\"importOrder\": [\"^@core/(.*)$\", \"^@server/(.*)$\", \"^@ui/(.*)$\", \"^[./]\"],\n```\n\n_Default behavior:_ The plugin moves the third party imports to the top which are not part of the `importOrder` list.\nTo move the third party imports at desired place, you can use `<THIRD_PARTY_MODULES>` to assign third party imports to the appropriate position:\n\n```\n\"importOrder\": [\"^@core/(.*)$\", \"<THIRD_PARTY_MODULES>\", \"^@server/(.*)$\", \"^@ui/(.*)$\", \"^[./]\"],\n```\n\n#### `importOrderSeparation`\n\n**type**: `boolean`\n\n**default value**: `false`\n\nA boolean value to enable or disable the new line separation\nbetween sorted import declarations group. The separation takes place according to the `importOrder`.\n\n```\n\"importOrderSeparation\": true,\n```\n\n#### `importOrderSortSpecifiers`\n\n**type**: `boolean`\n\n**default value:** `false`\n\nA boolean value to enable or disable sorting of the specifiers in an import declarations.\n\n#### `importOrderGroupNamespaceSpecifiers`\n\n**type**: `boolean`\n\n**default value:** `false`\n\nA boolean value to enable or disable sorting the namespace specifiers to the top of the import group.\n\n#### `importOrderCaseInsensitive`\n\n**type**: `boolean`\n\n**default value**: `false`\n\nA boolean value to enable case-insensitivity in the sorting algorithm\nused to order imports within each match group.\n\nFor example, when false (or not specified):\n\n```javascript\nimport ExampleView from './ExampleView';\nimport ExamplesList from './ExamplesList';\n```\n\ncompared with `\"importOrderCaseInsensitive\": true`:\n\n```javascript\nimport ExamplesList from './ExamplesList';\nimport ExampleView from './ExampleView';\n```\n\n#### `importOrderParserPlugins`\n\n**type**: `Array<string>`\n\n**default value**: `[\"typescript\", \"jsx\"]`\n\nPreviously known as `experimentalBabelParserPluginsList`.\n\nA collection of plugins for babel parser. The plugin passes this list to babel parser, so it can understand the syntaxes\nused in the file being formatted. The plugin uses prettier itself to figure out the parser it needs to use but if that fails,\nyou can use this field to enforce the usage of the plugins' babel parser needs.\n\n**To pass the plugins to babel parser**:\n\n```\n  \"importOrderParserPlugins\" : [\"classProperties\", \"decorators-legacy\"]\n```\n\n**To pass the options to the babel parser plugins**: Since prettier options are limited to string, you can pass plugins\nwith options as a JSON string of the plugin array:\n`\"[\\\"plugin-name\\\", { \\\"pluginOption\\\": true }]\"`.\n\n```\n  \"importOrderParserPlugins\" : [\"classProperties\", \"[\\\"decorators\\\", { \\\"decoratorsBeforeExport\\\": true }]\"]\n```\n\n**To disable default plugins for babel parser, pass an empty array**:\n\n```\nimportOrderParserPlugins: []\n```\n\n#### `importOrderSortByPrintWidth`\n\n**type**: `boolean`\n\n**default value**: `false`\n\nA boolean to enable sorting by print width instead of alphabetical sorting.\n\nFor example, when false (or not specified):\n\n```javascript\nimport * as React from 'react';\nimport { connect } from 'react-redux';\nimport { compose } from 'recompose';\nimport { FormattedMessage } from 'react-intl';\nimport { useForm } from 'react-hook-form';\nimport Modal from 'react-bootstrap/lib/Modal';\n```\n\ncompared with `\"importOrderSortByPrintWidth\": true`:\n\n```javascript\nimport * as React from 'react';\nimport { compose } from 'recompose';\nimport { connect } from 'react-redux';\nimport { useForm } from 'react-hook-form';\nimport { FormattedMessage } from 'react-intl';\nimport Modal from 'react-bootstrap/lib/Modal';\n```\n\n### How does import sort work ?\n\nThe plugin extracts the imports which are defined in `importOrder`. These imports are considered as _local imports_.\nThe imports which are not part of the `importOrder` is considered as _third party imports_.\n\nAfter, the plugin sorts the _local imports_ and _third party imports_ using [natural sort algorithm](https://en.wikipedia.org/wiki/Natural_sort_order).\n\nIn the end, the plugin returns final imports with _third party imports_ on top and _local imports_ at the end.\n\nThe _third party imports_ position (it's top by default) can be overridden using the `<THIRD_PARTY_MODULES>` special word in the `importOrder`.\n\n### FAQ / Troubleshooting\n\nHaving some trouble or an issue ? You can check [FAQ / Troubleshooting section](./docs/TROUBLESHOOTING.md).\n\n### Compatibility\n\n| Framework              | Supported     | Note                                             |\n| ---------------------- | ------------- | ------------------------------------------------ |\n| JS with ES Modules     | ✅ Everything | -                                                |\n| NodeJS with ES Modules | ✅ Everything | -                                                |\n| React                  | ✅ Everything | -                                                |\n| Angular                | ✅ Everything | Supported through `importOrderParserPlugins` API |\n\n### Contribution\n\nFor more information regarding contribution, please check the [Contributing Guidelines](./CONTRIBUTING.md). If you are trying to\ndebug some code in the plugin, check [Debugging Guidelines](./docs/DEBUG.md)\n\n### Disclaimer\n\nThis plugin modifies the AST which is against the rules of prettier.\n```\n","readmeFilename":"README.md"}