Skip to content

Commit fed6180

Browse files
committed
style(editors): prefer const to let (#16395)
Use `const` where variables are not reassigned instead of `let`. Preparation for enabling ESLint's `prefer-const` rule (running as an Oxlint JS plugin) in our linting setup.
1 parent 3f3d646 commit fed6180

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

editors/vscode/client/ConfigService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class ConfigService implements IDisposable {
7474

7575
if (!path.isAbsolute(bin)) {
7676
// if the path is not absolute, resolve it to the first workspace folder
77-
let cwd = this.workspaceConfigs.keys().next().value;
77+
const cwd = this.workspaceConfigs.keys().next().value;
7878
if (!cwd) {
7979
return;
8080
}

editors/vscode/client/tools/linter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export default class LinterTool implements ToolInterface {
139139
// If the extension is launched in debug mode then the debug server options are used
140140
// Otherwise the run options are used
141141
// Options to control the language client
142-
let clientOptions: LanguageClientOptions = {
142+
const clientOptions: LanguageClientOptions = {
143143
// Register the server for plain text documents
144144
documentSelector: [
145145
{

editors/vscode/tests/ConfigService.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ suite('ConfigService', () => {
4444
await conf.update('path.server', './relative/oxc_language_server');
4545
const relativeServerPath = service.getUserServerBinPath();
4646

47-
let workspace_path = getWorkspaceFolderPlatformSafe();
47+
const workspace_path = getWorkspaceFolderPlatformSafe();
4848
strictEqual(relativeServerPath, `${workspace_path}/relative/oxc_language_server`);
4949
});
5050

@@ -63,7 +63,7 @@ suite('ConfigService', () => {
6363
const service = new ConfigService();
6464
await conf.update('path.server', './relative/oxc_language_server');
6565
const relativeServerPath = service.getUserServerBinPath();
66-
let workspace_path = getWorkspaceFolderPlatformSafe();
66+
const workspace_path = getWorkspaceFolderPlatformSafe();
6767

6868
strictEqual(workspace_path[1], ':', 'The test workspace folder must be an absolute path with a drive letter on Windows');
6969
strictEqual(relativeServerPath, `${workspace_path}\\relative\\oxc_language_server`);

editors/vscode/tests/code_actions.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ suite('code actions', () => {
8383

8484
// https://github.com/oxc-project/oxc/issues/10422
8585
test('code action `source.fixAll.oxc` on editor.codeActionsOnSave', async () => {
86-
let file = Uri.joinPath(fixturesWorkspaceUri(), 'fixtures', 'file.js');
87-
let expectedFile = Uri.joinPath(fixturesWorkspaceUri(), 'fixtures', 'expected.txt');
86+
const file = Uri.joinPath(fixturesWorkspaceUri(), 'fixtures', 'file.js');
87+
const expectedFile = Uri.joinPath(fixturesWorkspaceUri(), 'fixtures', 'expected.txt');
8888

8989
await workspace.getConfiguration('editor').update('codeActionsOnSave', {
9090
'source.fixAll.oxc': 'always',
@@ -112,8 +112,8 @@ suite('code actions', () => {
112112

113113
// https://discord.com/channels/1079625926024900739/1080723403595591700/1422191300395929620
114114
test('code action `source.fixAll.oxc` ignores "ignore this rule for this line/file"', async () => {
115-
let file = Uri.joinPath(fixturesWorkspaceUri(), 'fixtures', 'file2.js');
116-
let expectedFile = Uri.joinPath(fixturesWorkspaceUri(), 'fixtures', 'expected.txt');
115+
const file = Uri.joinPath(fixturesWorkspaceUri(), 'fixtures', 'file2.js');
116+
const expectedFile = Uri.joinPath(fixturesWorkspaceUri(), 'fixtures', 'expected.txt');
117117

118118
await workspace.getConfiguration('editor').update('codeActionsOnSave', {
119119
'source.fixAll.oxc': 'always',

0 commit comments

Comments
 (0)