An opinionated ES6 and TypeScript import sorter.
TODO:
dom
in lib
?write a dev guide how to develop:
yarn install
yarn watch
(will block one terminal tab)
whenever you make a change, it will automatically be picked up by tsc
Quick and dirty way to run cli version: ./node_modules/.bin/ts-node ./bin/index.js
yarn build:prod
for a production build
To test the newest library (not yet published) in another project, do yarn link
. Then, in the other project run yarn link import-sorter
. After this, you will be able to
import { sortImports } from 'import-sorter';
const result = sortImports(...);
After testing, make sure to unlink import-sorter, by navigating to it and yarn unlink
cliSort
function in src/cli/index.ts
with a desired configuration, i.e.:cliSort({
content: '',
dryRun: true,
verbose: true
});
Note - in this way, the configuration binding is being skipped, and it can't be relied on the default value. Thus, all desired configuration value have to be explicitly specified.
launch.json
and launch the Launch Program
configurationfiles
argument, which can be an array of either directories or files. If it's a file, run the lib on it. If it's a directory, run the lib on the files inside it. Optionally, if recursive
flag is up, continue to iterate through directories recursevly