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

🐛 editorconfig rule insert_final_newline cannot be disabled with insert_final_newline = unset #5065

Closed
1 task done
knyghty opened this issue Feb 9, 2025 · 7 comments
Closed
1 task done
Assignees
Labels
S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@knyghty
Copy link

knyghty commented Feb 9, 2025

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:           "v22.12.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.9.0"

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

Workspace:
  Open Documents:               0

What happened?

If I try to disable a rule such as insert_final_newline = ignore, which should be supported, I get an error:

configuration ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ Failed to parse the .editorconfig file.
    
    Caused by:
      Custom("expected 'true' or 'false'")

Expected result

The configuration should validate properly and disable the rule for this pattern.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@knyghty knyghty added the S-Needs triage Status: this issue needs to be triaged label Feb 9, 2025
@ematipico ematipico added the S-Needs repro Status: needs a reproduction label Feb 9, 2025
Copy link
Contributor

github-actions bot commented Feb 9, 2025

Hello @knyghty, please provide a minimal reproduction. You can use one of the following options:

  • Provide a link to our playground, if it's applicable.
  • Provide a link to GitHub repository. To easily create a reproduction, you can use our interactive CLI via npm create @biomejs/biome-reproduction

Issues marked with S-Needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Feb 9, 2025
@ematipico
Copy link
Member

Unfortunately GitHub isn't a source of truth. The spec says otherwise https://spec.editorconfig.org/#supported-pairs

If you want, you can bring this to their attention.

@ematipico ematipico closed this as not planned Won't fix, can't repro, duplicate, stale Feb 9, 2025
@knyghty
Copy link
Author

knyghty commented Feb 9, 2025

It seems like those docs aren't either. It looks like this was merged in #3907 but only allows "off" and "unset" - and also I assume this isn't released yet since it's still not working on 1.9.4

@dyc3
Copy link
Contributor

dyc3 commented Feb 9, 2025

Those should work in 1.9.4.

@knyghty
Copy link
Author

knyghty commented Feb 9, 2025

@dyc3 From what I can tell, it either does not, or I am fundamentally misunderstanding something:

❯ npx @biomejs/biome version
CLI:        1.9.4
Server:     not connected
❯ npx @biomejs/biome check
configuration ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ Failed to parse the .editorconfig file.
    
    Caused by:
      Custom("expected 'true' or 'false'")
  

Using this file:

# https://editorconfig.org/

root = true

[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8

# Docstrings and comments use max_line_length = 79
[*.py]
max_line_length = 88

# Use 2 spaces for the HTML files
[*.html]
indent_size = 2

# The JSON files contain newlines inconsistently
[*.json]
indent_size = 2
insert_final_newline = unset

[**/admin/js/vendor/**]
indent_style = unset
indent_size = unset

# Minified JavaScript files shouldn't be changed
[**.min.js]
indent_style = unset
insert_final_newline = unset

# Makefiles always use tabs for indentation
[Makefile]
indent_style = tab

# Batch files use tabs for indentation
[*.bat]
indent_style = tab

[docs/**.txt]
max_line_length = 79

[*.yml]
indent_size = 2

@knyghty
Copy link
Author

knyghty commented Feb 9, 2025

(I should point out, I have to comment out all lines using unset to get this to run)

@ematipico ematipico reopened this Feb 9, 2025
@dyc3 dyc3 self-assigned this Feb 9, 2025
@dyc3 dyc3 added S-Bug-confirmed Status: report has been confirmed as a valid bug and removed S-Needs repro Status: needs a reproduction labels Feb 9, 2025
@dyc3
Copy link
Contributor

dyc3 commented Feb 9, 2025

I'm able to reproduce this. unset does work, it just doesn't work for insert_final_newline. Fix will be up soon.

@dyc3 dyc3 changed the title 🐛 editorconfig rules cannot be disabled 🐛 editorconfig rule insert_final_newline cannot be disabled with insert_final_newline = unset Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

3 participants