Skip to content

Unclear how to set style when using the CLI #139

Description

@PaulRBerg

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions