Skip to content

Commit 1753209

Browse files
committed
feat(linter/vscode): run extension when JS configs are detected (#18832)
1 parent a3417b1 commit 1753209

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

editors/vscode/client/tools/linter.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export default class LinterTool implements ToolInterface {
7676
}
7777

7878
this.allowedToStartServer = configService.vsCodeConfig.requireConfig
79-
? (await workspace.findFiles(`**/.oxlintrc.json`, "**/node_modules/**", 1)).length > 0
79+
? (await workspace.findFiles(`**/{.oxlintrc.json,oxlint.config.ts}`, "**/node_modules/**", 1))
80+
.length > 0
8081
: true;
8182

8283
const restartCommand = commands.registerCommand(OxcCommands.RestartServerLint, async () => {
@@ -307,7 +308,7 @@ export default class LinterTool implements ToolInterface {
307308
if (!this.allowedToStartServer) {
308309
return {
309310
isEnabled: false,
310-
tooltipText: "no .oxlintrc.json found",
311+
tooltipText: "no oxlint config found",
311312
};
312313
} else if (!enable) {
313314
return {
@@ -352,7 +353,7 @@ export default class LinterTool implements ToolInterface {
352353
statusBarItemHandler: StatusBarItemHandler,
353354
): void {
354355
const watcher = workspace.createFileSystemWatcher(
355-
"**/.oxlintrc.json",
356+
"**/{.oxlintrc.json,oxlint.config.ts}",
356357
false,
357358
true,
358359
!config.requireConfig,
@@ -368,7 +369,8 @@ export default class LinterTool implements ToolInterface {
368369
watcher.onDidDelete(async () => {
369370
// only can be called when config.requireConfig
370371
this.allowedToStartServer =
371-
(await workspace.findFiles(`**/.oxlintrc.json`, "**/node_modules/**", 1)).length > 0;
372+
(await workspace.findFiles(`**/{.oxlintrc.json,oxlint.config.ts}`, "**/node_modules/**", 1))
373+
.length > 0;
372374
if (!this.allowedToStartServer) {
373375
this.updateStatusBar(statusBarItemHandler, false);
374376
if (this.client && this.client.isRunning()) {

0 commit comments

Comments
 (0)