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

🐛 Setting indent_size to tab in .editorconfig causes error #5164

Open
1 task done
jonasgeiler opened this issue Feb 20, 2025 · 3 comments
Open
1 task done

🐛 Setting indent_size to tab in .editorconfig causes error #5164

jonasgeiler opened this issue Feb 20, 2025 · 3 comments
Labels
A-Project Area: project good first issue Good for newcomers S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@jonasgeiler
Copy link

jonasgeiler commented Feb 20, 2025

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

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

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

Workspace:
  Open Documents:               0

What happened?

  1. I have the following .editorconfig file:

    root = true
    
    [*]
    indent_style             = tab
    indent_size              = tab
    #tab_width               = 4
    end_of_line              = lf
    charset                  = utf-8
    trim_trailing_whitespace = true
    insert_final_newline     = true
    max_line_length          = 80

    I usually set indent_size to tab and comment out tab_width, so that it will use the tab width configured in the editor of the user.

  2. I have set formatter/useEditorconfig to true in biome.json, so it uses the .editorconfig file above.

  3. Running biome check now shows the following error and does nothing else:

    configuration ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
      ✖ Failed to parse the .editorconfig file.
     
        Caused by:
          Custom("invalid digit found in string")
    
  4. If I set indent_size to 4, everything works again, but according to https://editorconfig.org and their detailed document, setting indent_size to tab is perfectly valid and should be supported. I also noticed that the tab_width setting is currently not being parsed by Biome, it looks like, so that may have to be done first.

Expected result

It should accept indent_size = tab in .editorconfig and use the value of tab_width, or a default, and not throw an error.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@jonasgeiler jonasgeiler added the S-Needs triage Status: this issue needs to be triaged label Feb 20, 2025
@ematipico ematipico added A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug labels Feb 20, 2025
@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Feb 20, 2025
@ematipico
Copy link
Member

It seems that tab is a supported value: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#indent_size

@ematipico ematipico added good first issue Good for newcomers S-Needs triage Status: this issue needs to be triaged labels Feb 20, 2025
@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Feb 20, 2025
@dyc3
Copy link
Contributor

dyc3 commented Feb 21, 2025

I want to note that this should be used as the source of truth for the editorconfig spec: https://spec.editorconfig.org/

@ematipico
Copy link
Member

Yeah, also that web page mentions very briefly that the value is accepted. However, the wording is very weird for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Project Area: project good first issue Good for newcomers S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

3 participants