Skip to content

Commit dc7045f

Browse files
authored
Report Unused using diagnostics as hint instead of warning (#8997)
Fix the issue that unused-using Diagnostics are reported as warning instead of hint when there are linters defined in tspconfig.yaml fixes #8692
1 parent 54bbb2e commit dc7045f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@typespec/compiler"
5+
---
6+
7+
UnusedUsing Diagnostics are reported as warning instead of hint when there are linters defined in tspconfig.yaml

packages/compiler/src/server/compile-service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { CompilerOptions } from "../core/options.js";
1515
import { parse } from "../core/parser.js";
1616
import { getBaseFileName, getDirectoryPath } from "../core/path-utils.js";
1717
import type { CompilerHost, TypeSpecScriptNode } from "../core/types.js";
18-
import { distinctArray } from "../utils/misc.js";
18+
import { deepClone, distinctArray } from "../utils/misc.js";
1919
import { getLocationInYamlScript } from "../yaml/diagnostics.js";
2020
import { parseYaml } from "../yaml/parser.js";
2121
import { ClientConfigProvider } from "./client-config-provider.js";
@@ -141,8 +141,10 @@ export function createCompileService({
141141
const [optionsFromConfig, _] = resolveOptionsFromConfig(config, {
142142
cwd: getDirectoryPath(path),
143143
});
144+
// we need to keep the optionsFromConfig unchanged which will be returned in CompileResult
145+
const clone = deepClone(optionsFromConfig);
144146
const options: CompilerOptions = {
145-
...optionsFromConfig,
147+
...clone,
146148
...serverOptions,
147149
...(additionalOptions ?? {}),
148150
};

0 commit comments

Comments
 (0)