Use case
Run import-sort on an entire code base to programatically sort imports in all files according to a non-default import style.
Current Workaround
Temporarily modify the root package.json by adding the following field:
"importSort": {
".js, .jsx, .ts, .tsx": {
"parser": "MY_PARSER",
"style": "MY_STYLE"
}
}
Optionally install the style if not already present in node_modules.
Then run the import sort CLI:
npx import-sort-cli ./path/to/my-files
Then delete the importSort field in package.json because it's no longer needed.
Question
Is this the recommended way to run the CLI? I couldn't find any documentation in the README for how to set the style when running the CLI. The command-line options listed in the README don't include a style option.
Use case
Run
import-sorton an entire code base to programatically sort imports in all files according to a non-default import style.Current Workaround
Temporarily modify the root
package.jsonby adding the following field:Optionally install the style if not already present in node_modules.
Then run the import sort CLI:
Then delete the
importSortfield inpackage.jsonbecause it's no longer needed.Question
Is this the recommended way to run the CLI? I couldn't find any documentation in the README for how to set the style when running the CLI. The command-line options listed in the README don't include a
styleoption.