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

📝 $lib/ Imports sorted incorrectly #5261

Closed
1 task done
floriandotorg opened this issue Mar 3, 2025 · 4 comments
Closed
1 task done

📝 $lib/ Imports sorted incorrectly #5261

floriandotorg opened this issue Mar 3, 2025 · 4 comments
Labels
S-Needs response Status: await response from OP S-Needs triage Status: this issue needs to be triaged

Comments

@floriandotorg
Copy link

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Formatter:
  Format with errors:           false
  Indent style:                 Tab
  Indent width:                 2
  Line ending:                  Lf
  Line width:                   320
  Attribute position:           Auto
  Bracket spacing:              BracketSpacing(true)
  Ignore:                       []
  Include:                      []

JavaScript Formatter:
  Enabled:                      false
  JSX quote style:              Double
  Quote properties:             AsNeeded
  Trailing commas:              All
  Semicolons:                   AsNeeded
  Arrow parentheses:            AsNeeded
  Bracket spacing:              unset
  Bracket same line:            false
  Quote style:                  Single
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Attribute position:           unset

JSON Formatter:
  Enabled:                      true
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Trailing Commas:              unset

CSS Formatter:
  Enabled:                      true
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Quote style:                  Double

GraphQL Formatter:
  Enabled:                      false
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Bracket spacing:              unset
  Quote style:                  unset

Workspace:
  Open Documents:               0

Configuration

{
  "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
  "vcs": {
    "enabled": true,
    "clientKind": "git",
    "useIgnoreFile": true
  },
  "files": {
    "ignoreUnknown": false,
    "ignore": []
  },
  "formatter": {
    "enabled": true,
    "lineWidth": 320,
    "useEditorconfig": true
  },
  "linter": {
    "enabled": true,
    "rules": {
      "nursery": {
        "noDuplicateElseIf": "error",
        "noDuplicateProperties": "error",
        "noIrregularWhitespace": "error",
        "noUselessEscapeInRegex": "error",
        "useCollapsedIf": "error",
        "useSortedClasses": "error",
        "useTrimStartEnd": "error",
        "useValidAutocomplete": "error"
      }
    }
  },
  "javascript": {
    "formatter": {
      "semicolons": "asNeeded",
      "quoteStyle": "single",
      "arrowParentheses": "asNeeded"
    }
  }
}

Playground link

https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIABmAG8AbwBiAGEAcgAgAGYAcgBvAG0AIAAnAC4ALwBmAG8AbwBiAGEAcgAuAHQAcwAnAAoAaQBtAHAAbwByAHQAIAB0AGUAcwB0ACAAZgByAG8AbQAgACcAJABsAGkAYgAvAHQAZQBzAHQAJwAKAGkAbQBwAG8AcgB0ACAAKgAgAGEAcwAgAHoAIABmAHIAbwBtACAAJwB6AG8AZAAnAAoA

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@floriandotorg floriandotorg added the S-Needs triage Status: this issue needs to be triaged label Mar 3, 2025
@floriandotorg
Copy link
Author

floriandotorg commented Mar 3, 2025

Hey biome team!

Thanks for your great work <3

In Svelte, it's common to use import from $lib or $app:

import * as z from 'zod'
import test from '$lib/test'
import foobar from './foobar.ts'

These should be sorted between node modules and local files. However, they are actually put before modules:

import test from '$lib/test'
import * as z from 'zod'
import foobar from './foobar.ts'

@ematipico
Copy link
Member

What are $lib and $app? Aliases? If so, to what?

@ematipico ematipico added the S-Needs response Status: await response from OP label Mar 4, 2025
@floriandotorg
Copy link
Author

They are aliases to local folders like src/lib.

@ematipico
Copy link
Member

The current import sorting implementation doesn't support aliases. It probably will after we land #3177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs response Status: await response from OP S-Needs triage Status: this issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants