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

💅 useNamingConvention stuck with --write flag and TypeScript #3561

Closed
1 task done
tobua opened this issue Aug 1, 2024 · 2 comments · Fixed by #3565
Closed
1 task done

💅 useNamingConvention stuck with --write flag and TypeScript #3561

tobua opened this issue Aug 1, 2024 · 2 comments · Fixed by #3565
Assignees

Comments

@tobua
Copy link

tobua commented Aug 1, 2024

Environment information

CLI:
  Version:                      1.8.3
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v22.5.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "bun/1.1.21"

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

Linter:
  JavaScript enabled:           true
  JSON enabled:                 true
  CSS enabled:                  false
  Recommended:                  false
  All:                          false
  Enabled rules:
  ...
  style/useNamingConvention
  ...

Workspace:
  Open Documents:               0

Rule name

style/useNamingConvention

Playground link

https://biomejs.dev/playground/?lintRules=all&code=aQBuAHQAZQByAGYAYQBjAGUAIABWAE4AbwBkAGUAIAB7AAoACQBoAGUAbABsAG8AOgAgACIAdwBvAHIAbABkACIACgB9AAoA

Expected result

CLI when run with --write option should not get stuck infinitely. Cannot be reproduced in Playground as there is no fix option.

interface VNode {
	hello: 'world'
}
type AAb = any // Causes same problem.
const VNode = 'fine' // Works fine, as it changes to lowercase.

To me it looks like a conflict between "This interface name should be in PascalCase." and "Two consecutive uppercase characters are not allowed in PascalCase because strictCase is set to true." leading to an infinite fix loop. Both of these come from style/useNamingConvention.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Conaclos
Copy link
Member

Conaclos commented Aug 1, 2024

I don't manage to reproduce your issue. However, the rule seems to propose a safe fix that has no effect. This could be the cause of your problem. I will take a look later.

@Conaclos Conaclos self-assigned this Aug 1, 2024
@tobua
Copy link
Author

tobua commented Aug 1, 2024

Thanks for taking a look, here are more details about the setup:

biome.json

{
	"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
	"linter": {
		"rules": {
			"style": {
				"useNamingConvention": "error"
			}
		}
	}
}

package.json:

{
	"scripts": {
		"check": "biome check --write issue.ts"
	},
	"dependencies": {
		"@biomejs/biome": "^1.8.3"
	}
}

Nothing happens either when I run bun check or npm run check. In the VSCode extension it works fine even with quickfix.biome enabled...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants