Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(ui): automatically sort imports #13813

Merged
merged 2 commits into from
Oct 25, 2024

Commits on Oct 24, 2024

  1. build(ui): automatically sort imports

    - like Python's `isort` but in JS/TS using https://github.com/IanVS/prettier-plugin-sort-imports
      - with [default config](https://github.com/IanVS/prettier-plugin-sort-imports/blob/e28fa0e92832a011a923fc5e3bc5a20705102406/README.md?plain=1#L198) plus [a newline](https://github.com/IanVS/prettier-plugin-sort-imports/blob/e28fa0e92832a011a923fc5e3bc5a20705102406/README.md?plain=1#L250) before relative imports and [CSS handling](https://github.com/IanVS/prettier-plugin-sort-imports/blob/e28fa0e92832a011a923fc5e3bc5a20705102406/README.md?plain=1#L234)
        - tried to get it as close to the existing style as possible with the smallest diff and least config
      - plus specify TS version according to [`yarn.lock`](https://github.com/argoproj/argo-workflows/blob/49ff7a44ba307416282a1f5cd3b844d19bce7f88/ui/yarn.lock#L9723)
    
    - decided to use a `prettier` plugin instead of an `eslint` plugin as there was less configuration
      - and I generally jive with letting a tool decide consistent style, although `prettier` is not quite zero config, but "low" config
      - https://github.com/import-js/eslint-plugin-import / https://github.com/un-ts/eslint-plugin-import-x would be the alternative
        - and potentially still has useful options in terms of static analysis
    
    Signed-off-by: Anton Gilgur <[email protected]>
    agilgur5 committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    9e72923 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ccf9faa View commit details
    Browse the repository at this point in the history