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

📝 Can't override json.formatter.trailingCommas #2009

Closed
1 task done
bgoscinski opened this issue Mar 8, 2024 · 2 comments · Fixed by #2025
Closed
1 task done

📝 Can't override json.formatter.trailingCommas #2009

bgoscinski opened this issue Mar 8, 2024 · 2 comments · Fixed by #2025
Labels
A-Project Area: project L-JSON Language: JSON and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@bgoscinski
Copy link

bgoscinski commented Mar 8, 2024

I configured overrides for the b.json so that it should format with trailingCommas=all and lineWidth=20, but when I run npx @biomejs/biome check --apply {a,b}.json biome doesn't add missing commas in b.json

Environment information

CLI:
  Version:                      1.6.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.11.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.2.4"

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 size:                  0
  Indent width:                 0
  Line ending:                  Lf
  Line width:                   80
  Attribute position:           Auto
  Ignore:                       []
  Include:                      []

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

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

Workspace:
  Open Documents:               0

Configuration

{
	"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
	"formatter": {
		"enabled": true
	},
	"json": {
		"parser": {
			"allowComments": false,
			"allowTrailingCommas": false
		},
		"formatter": {
			"enabled": true,
			"trailingCommas": "none"
		}
	},
	"overrides": [
		{
			"include": ["b.json"],
			"json": {
				"parser": {
					"allowComments": true,
					"allowTrailingCommas": true
				},
				"formatter": {
					"enabled": true,
					"trailingCommas": "all",
					"lineWidth": 20
				}
			}
		}
	]
}

Playground link

https://codesandbox.io/p/devbox/overrides-s4g9zw?file=%2Fbiome.json%3A4%2C1&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522cltj4jn8b0005356bja36b6lm%2522%252C%2522sizes%2522%253A%255B56.879255064532686%252C43.120744935467314%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522cltj4jn8a0002356bbhofn3ww%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522cltj4jn8a0003356ba609rune%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522cltj4jn8b0004356bbl2aitvj%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B100%252C0%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522cltj4jn8a0002356bbhofn3ww%2522%253A%257B%2522id%2522%253A%2522cltj4jn8a0002356bbhofn3ww%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cltj4zcw50002356cb3su6mdd%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fa.json%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522cltj55mpx0002356clzt1gb43%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A4%252C%2522startColumn%2522%253A1%252C%2522endLineNumber%2522%253A4%252C%2522endColumn%2522%253A1%257D%255D%252C%2522filepath%2522%253A%2522%252Fbiome.json%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522activeTabId%2522%253A%2522cltj55mpx0002356clzt1gb43%2522%257D%252C%2522cltj4jn8b0004356bbl2aitvj%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522cltj4jn8b0004356bbl2aitvj%2522%257D%252C%2522cltj4jn8a0003356ba609rune%2522%253A%257B%2522id%2522%253A%2522cltj4jn8a0003356ba609rune%2522%252C%2522activeTabId%2522%253A%2522cltj55r6j0040356cb1vwf7yy%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cltj55r6j0040356cb1vwf7yy%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522cltj55st70030djip7dqm3wob%2522%257D%255D%257D%257D%252C%2522showDevtools%2522%253Afalse%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A16.405700864585256%257D

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico ematipico added A-Project Area: project L-JSON Language: JSON and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Mar 8, 2024
@senerdude
Copy link

Seems like still it's an issue. I have version 1.8.1 and javascript > formatter > trailingCommas has a yellow warning on VS Code says; "Property trailingCommas is not allowed."

@igorescobar-moonpay
Copy link

Seems like still it's an issue. I have version 1.8.1 and javascript > formatter > trailingCommas has a yellow warning on VS Code says; "Property trailingCommas is not allowed."

Update your scheme to:

"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",

It worked 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 L-JSON Language: JSON and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants