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

📝 JSON files formatted by "biome format" are accepted by "biome lint" on Linux are rejected by "biome lint" on Windows #4529

Closed
1 task done
seriousme opened this issue Nov 13, 2024 · 3 comments
Labels
S-Needs triage Status: this issue needs to be triaged

Comments

@seriousme
Copy link

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:           "v22.11.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

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

JavaScript Formatter:
  Enabled:                      true
  JSX quote style:              Double
  Quote properties:             AsNeeded
  Trailing commas:              All
  Semicolons:                   Always
  Arrow parentheses:            Always
  Bracket spacing:              unset
  Bracket same line:            false
  Quote style:                  Double
  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

{
	"files": {
		"ignore": [
			".nyc_output",
			"coverage",
			"schemas",
			"schemas.orig",
			"dummy.json",
			"package.json"
		]
	},
	"linter": {
		"enabled": true,
		"rules": {
			"recommended": true,
			"complexity": { "useLiteralKeys": "off" }
		}
	}
}

Playground link

https://biomejs.dev/playground/?lineWidth=120&indentStyle=space&quoteStyle=single&indentWidth=4&arrowParentheses=as-needed&code=ewAKAAkAIgBmAGkAbABlAHMAIgA6ACAAewAKAAkACQAiAGkAZwBuAG8AcgBlACIAOgAgAFsACgAJAAkACQAiAC4AbgB5AGMAXwBvAHUAdABwAHUAdAAiACwACgAJAAkACQAiAGMAbwB2AGUAcgBhAGcAZQAiACwACgAJAAkACQAiAHMAYwBoAGUAbQBhAHMAIgAsAAoACQAJAAkAIgBzAGMAaABlAG0AYQBzAC4AbwByAGkAZwAiACwACgAJAAkACQAiAGQAdQBtAG0AeQAuAGoAcwBvAG4AIgAsAAoACQAJAAkAIgBwAGEAYwBrAGEAZwBlAC4AagBzAG8AbgAiAAoACQAJAF0ACgAJAH0ALAAKAAkAIgBsAGkAbgB0AGUAcgAiADoAIAB7AAoACQAJACIAZQBuAGEAYgBsAGUAZAAiADoAIAB0AHIAdQBlACwACgAJAAkAIgByAHUAbABlAHMAIgA6ACAAewAKAAkACQAJACIAcgBlAGMAbwBtAG0AZQBuAGQAZQBkACIAOgAgAHQAcgB1AGUALAAKAAkACQAJACIAYwBvAG0AcABsAGUAeABpAHQAeQAiADoAIAB7ACAAIgB1AHMAZQBMAGkAdABlAHIAYQBsAEsAZQB5AHMAIgA6ACAAIgBvAGYAZgAiACAAfQAKAAkACQB9AAoACQB9AAoAfQAKAA%3D%3D

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@seriousme seriousme added the S-Needs triage Status: this issue needs to be triaged label Nov 13, 2024
@seriousme
Copy link
Author

I also tried:

{
	"files": {
		"ignore": [
			".nyc_output",
			"coverage",
			"schemas",
			"schemas.orig",
			"dummy.json",
			"package.json"
		]
	},
	"formatter": {
		"lineEnding": "lf"
	},
	"json": {
		"formatter": {
			"lineEnding": "lf"
		}
	},
	"linter": {
		"enabled": true,
		"rules": {
			"recommended": true,
			"complexity": { "useLiteralKeys": "off" }
		}
	}
}

but the issue persists.

@seriousme
Copy link
Author

This is the output I get on "windows-latest" on GitHub

biome ci .

.\biome.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × File content differs from formatting output
  
     1    │ - {␍
     2    │ - → "files":·{␍
     3    │ - → → "ignore":·[␍
     4    │ - → → → ".nyc_output",␍
     5    │ - → → → "coverage",␍
     6    │ - → → → "schemas",␍
     7    │ - → → → "schemas.orig",␍
      8   │ - → → → "dummy.json",␍
     9    │ - → → → "package.json"␍
    10    │ - → → ]␍
    11    │ - → },␍
    12    │ - → "formatter":·{␍
    13    │ - → → "lineEnding":·"lf"␍
    14    │ - → },␍
    15    │ - → "json":·{␍
    16    │ - → → "formatter":·{␍
    17    │ - → → → "lineEnding":·"lf"␍
    18    │ - → → }␍
    19    │ - → },␍
    20    │ - → "linter":·{␍
    21    │ - → → "enabled":·true,␍
    22    │ - → → "rules":·{␍
    23    │ - → → → "recommended":·true,␍
    24    │ - → → → "complexity":·{·"useLiteralKeys":·"off"·}␍
    25    │ - → → }␍
    26    │ - → }␍
    27    │ - }␍
        1 │ + {
        2 │ + → "files":·{
        3 │ + → → "ignore":·[
        4 │ + → → → ".nyc_output",
        5 │ + → → → "coverage",
        6 │ + → → → "schemas",
        7 │ + → → → "schemas.orig",
        8 │ + → → → "dummy.json",
        9 │ + → → → "package.json"
       10 │ + → → ]
       11 │ + → },
       12 │ + → "formatter":·{
       13 │ + → → "lineEnding":·"lf"
       14 │ + → },
       15 │ + → "json":·{
       16 │ + → → "formatter":·{
       17 │ + → → → "lineEnding":·"lf"
       18 │ + → → }
       19 │ + → },
       20 │ + → "linter":·{
       21 │ + → → "enabled":·true,
       22 │ + → → "rules":·{
       23 │ + → → → "recommended":·true,
       24 │ + → → → "complexity":·{·"useLiteralKeys":·"off"·}
       25 │ + → → }
       26 │ + → }
       27 │ + }
       28 │

@seriousme
Copy link
Author

Found the problem.
It was caused by Git, not by Biome.
Git on Windows automatically coverts lf to crlf, I solved it by adding a .gitattributes file containing:

*.json text eol=lf 
*.js text eol=lf 
*.ts text eol=lf 
*.cjs text eol=lf

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

No branches or pull requests

1 participant