Skip to content

linter: Oxc server crashes in VS Code when opening a .astro with pascalCase filename #14565

@JamesJosephFinn

Description

@JamesJosephFinn

What version of Oxlint are you using?

1.23.0

What command did you run?

pnpm run lint defined as oxlint . --type-aware --format=stylish --report-unused-disable-directives

What does your .oxlintrc.json config file look like?

{
	// schema kept here for reference. not needed with vscode extension.
	// "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
	"ignorePatterns": [
		".astro/",
		"dist/",
		"node_modules/",
		".git/",
		".github/",
		".vscode/"
	],
	"categories": {
		"correctness": "error",
		"perf": "warn",
		"suspicious": "warn",
		"pedantic": "warn",
		"style": "warn",
		"nursery": "off",
		"restriction": "off"
	},
	"plugins": [
		"eslint",
		"typescript",
		"unicorn",
		"oxc",
		"import",
		"jsx-a11y",
		"node",
		"promise",
		"regex"
	],
	"rules": {
		"unicorn/filename-case": [
			"warn",
			{
				"cases": {
					"pascalCase": true, // components / layouts
					"kebabCase": true // everything else
				}
			}
		]
	},
	"overrides": [
		{
			"files": ["**/*.{jsx,tsx,mjsx,mtsx}"],
			"plugins": ["react", "react-perf"]
		},
		{
			"files": ["**/*.test.{js,ts}", "tests/**"],
			"plugins": ["vitest"]
		}
	]
}

What happened?

In VS Code, without the above rules: {} object for rule unicorn/filename-case, attempting to open, for example, /src/components/Component.astro crashes the Oxc server, and it needs to be restarted. After setting the rule as above, the file can be opened and parsed in VS Code by Oxc without issue.

Curiously, without the rule being set, opening of pascalCase files in the /src/layouts dir, e.g. /src/layouts/Layout.astro, does not crash the Oxc server. i.e., the issue is local only to the /src/components dir.

The CLI does not crash, but it mis-reports the warnings; i.e., without the rule being set, it emits a warning for /src/components/Component.astro, but not for src/layouts/Layout.astro. When adding the rule, the CLI behaves as expected, i.e. it emits no warnings for either file.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions