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

🐛 overrides for specific include filenames, triggers checks with same filename (different case) in other paths #2421

Open
1 task done
FedericoBiccheddu opened this issue Apr 12, 2024 · 1 comment · May be fixed by #2620
Assignees
Labels
A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug
Milestone

Comments

@FedericoBiccheddu
Copy link

Environment information

CLI:
  Version:                      1.6.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm"
  JS_RUNTIME_VERSION:           "v20.11.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/8.15.6"

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

Workspace:
  Open Documents:               0

What happened?

Having this file structure:

.
├── biome.jsonc
├── ...
├── server.ts
├── source
│   ├── ...
│   └── Shared
│       └── Infrastructure
│           ├── ...
│           └── Server.ts
├── ...

and this configuration:

{
	"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
	"files": {
		"ignoreUnknown": true,
		"include": ["config/**/*.ts", "source/**/*.ts", "server.ts"]
	},
	"linter": {
		"enabled": true,
		"rules": {
			"style": {
				"useFilenamingConvention": {
					"level": "error",
					"options": {
						"requireAscii": true,
						"filenameCases": ["PascalCase", "export"]
					}
				}
			},
		}
	},
	"overrides": [
		{
			"include": ["./server.ts"],
			"linter": {
				"rules": {
					"style": {
						"useFilenamingConvention": {
							"level": "error",
							"options": {
								"filenameCases": ["camelCase", "export"]
							}
						}
					}
				}
			}
		}
	]
}

Running biome check --config-path ./ --apply ./ results in an error:

./source/Shared/Infrastructure/Server.ts lint/style/useFilenamingConvention ━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ The filename should be in camelCase or equal to the name of an export.
  
  ℹ The filename could be renamed to one of the following names:
    server.ts
  

Checked 18 files in 375ms. No fixes needed.
Found 1 error.

Expected result

I expect the override function to apply the configuration only in included files, server.ts in the root in this particular case and matching the case too.

I suppose there is a match with the filename so ./server.ts matches my ./Server.ts regardless how deep is in another folder and its case.

Code of Conduct

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

I think it is an issue coming from our glob pattern library that seems to treat ./server.ts as **/server.ts.

@Conaclos Conaclos added S-Bug-confirmed Status: report has been confirmed as a valid bug A-Project Area: project labels Apr 12, 2024
@Conaclos Conaclos self-assigned this Apr 27, 2024
@Conaclos Conaclos linked a pull request Apr 27, 2024 that will close this issue
@Conaclos Conaclos added this to the Biome 2.0 milestone Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Project Area: project 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.

2 participants