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

📝 stripping parenthesis breaks jsdoc types #4799

Closed
1 task done
JakobJingleheimer opened this issue Dec 27, 2024 · 3 comments
Closed
1 task done

📝 stripping parenthesis breaks jsdoc types #4799

JakobJingleheimer opened this issue Dec 27, 2024 · 3 comments
Labels
S-Needs triage Status: this issue needs to be triaged

Comments

@JakobJingleheimer
Copy link

JakobJingleheimer commented Dec 27, 2024

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:           "v23.5.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.9.2"

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

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:                      false
  JSX quote style:              Double
  Quote properties:             AsNeeded
  Trailing commas:              All
  Semicolons:                   Always
  Arrow parentheses:            Always
  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",
	"files": {
		"ignore": ["**/fixture/**", "**/fixture.*"],
		"include": ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.css", "**/*.json"]
	},
	"formatter": {
		"enabled": true,
		"useEditorconfig": true
	},
	"linter": {
		"rules": {
			"style": {
				"useImportType": "error",
				"useNodeAssertStrict": "error",
				"useNodejsImportProtocol": "error",
				"useTemplate": "off"
			},
			"suspicious": {
				"noExplicitAny": "error",
				"noEmptyBlock": "error",
				"noDuplicateAtImportRules": "error",
				"noDuplicateObjectKeys": "error"
			},
			"correctness": {
				"noUnusedVariables": "off",
				"useArrayLiterals": "off",
				"noUnknownFunction": "error"
			}
		}
	},
	"javascript": {
		"formatter": {
			"arrowParentheses": "always",
			"semicolons": "always",
			"quoteStyle": "single",
			"trailingCommas": "all"
		},
		"linter": {
			"enabled": true
		}
	},
	"organizeImports": {
		"enabled": false
	},
	"json": {
		"formatter": {
			"enabled": true
		}
	},
	"vcs": {
		"enabled": true,
		"clientKind": "git"
	}
}

Playground link

https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB7ACAAcwBwAGEAdwBuACAAfQAgAGYAcgBvAG0AIAAnAG4AbwBkAGUAOgBjAGgAaQBsAGQAXwBwAHIAbwBjAGUAcwBzACcAOwAKAAoALwAqACoACgAgACoAIABAAHAAYQByAGEAbQAgAHsALgAuAC4AUABhAHIAYQBtAGUAdABlAHIAcwA8AHQAeQBwAGUAbwBmACAAcwBwAGEAdwBuAD4AfQAgAGEAcgBnAHMACgAgACoALwAKAGUAeABwAG8AcgB0ACAAZgB1AG4AYwB0AGkAbwBuACAAcwBwAGEAdwBuAFAAcgBvAG0AaQBzAGkAZgBpAGUAZAAoAC4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BzAGUAKAAoAHIAZQBzAG8AbAB2AGUALAAgAHIAZQBqAGUAYwB0ACkAIAA9AD4AIAB7AAoACQAJAGMAaABpAGwAZAAuAG8AbgAoACcAYwBsAG8AcwBlACcALAAgACgAYwBvAGQAZQAsACAAcwBpAGcAbgBhAGwAKQAgAD0APgAgAHsACgAJAAkACQByAGUAcwBvAGwAdgBlACgAewAKAAkACQAJAAkAYwBvAGQAZQAsAAoACQAJAAkACQBzAGkAZwBuAGEAbAAsAAoACQAJAAkACQBzAHQAZABlAHIAcgAsAAoACQAJAAkACQBzAHQAZABvAHUAdAAsAAoACQAJAAkAfQApADsACgAJAAkAfQApADsACgAJAAkAYwBoAGkAbABkAC4AbwBuACgAJwBlAHIAcgBvAHIAJwAsACAAKABjAG8AZABlACwAIABzAGkAZwBuAGEAbAApACAAPQA%2BACAAewAKAAkACQAJAHIAZQBqAGUAYwB0ACgAewAKAAkACQAJAAkAYwBvAGQAZQAsAAoACQAJAAkACQBzAGkAZwBuAGEAbAAsAAoACQAJAAkACQBzAHQAZABlAHIAcgAsAAoACQAJAAkACQBzAHQAZABvAHUAdAAsAAoACQAJAAkAfQApADsACgAJAAkAfQApADsACgAJAH0AKQApADsACgB9AAoA

Code of Conduct

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

JakobJingleheimer commented Dec 27, 2024

But also, this behaviour is obnoxious in general, and I want to globally disable it. Sometimes extra parentheses greatly improve legibility, and I do not want to fight tooling to get get out of the way.

@arendjr
Copy link
Contributor

arendjr commented Jan 1, 2025

I'm not sure how exactly this breaks JSDoc types, but we don't have special support for JSDoc in any case, and we don't intend to add new formatter options: https://biomejs.dev/formatter/option-philosophy/

I don't think this issue will be picked up any time soon, sorry.

@arendjr arendjr closed this as not planned Won't fix, can't repro, duplicate, stale Jan 1, 2025
@JakobJingleheimer
Copy link
Author

Seemingly unnecessary parentheses are required around whatever is be casted in TypeScript via jsdocs:

https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#casts

Your formatter removes them, breaking the types.

JSDocs and TypeScript are huge—way bigger than biome, and they're already used in millions of projects. If you force a choice between them and biome, you'll surely lose.

This is not about one preference versus another—biome's opinion breaks things, which makes it objectively wrong.

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

2 participants