mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
chore(compiler): Enable strict property access TS compiler flag. (#6255)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -38,7 +38,7 @@ function renderHastNode(
|
||||
// Handle Element Nodes: Determine color and pass it down, don't wrap
|
||||
if (node.type === 'element') {
|
||||
const nodeClasses: string[] =
|
||||
(node.properties?.className as string[]) || [];
|
||||
(node.properties?.['className'] as string[]) || [];
|
||||
let elementColor: string | undefined = undefined;
|
||||
|
||||
// Find color defined specifically for this element's class
|
||||
|
||||
@@ -52,22 +52,24 @@ type SupportedTerminal = 'vscode' | 'cursor' | 'windsurf';
|
||||
|
||||
// Terminal detection
|
||||
async function detectTerminal(): Promise<SupportedTerminal | null> {
|
||||
const termProgram = process.env.TERM_PROGRAM;
|
||||
const termProgram = process.env['TERM_PROGRAM'];
|
||||
|
||||
// Check VS Code and its forks - check forks first to avoid false positives
|
||||
// Check for Cursor-specific indicators
|
||||
if (
|
||||
process.env.CURSOR_TRACE_ID ||
|
||||
process.env.VSCODE_GIT_ASKPASS_MAIN?.toLowerCase().includes('cursor')
|
||||
process.env['CURSOR_TRACE_ID'] ||
|
||||
process.env['VSCODE_GIT_ASKPASS_MAIN']?.toLowerCase().includes('cursor')
|
||||
) {
|
||||
return 'cursor';
|
||||
}
|
||||
// Check for Windsurf-specific indicators
|
||||
if (process.env.VSCODE_GIT_ASKPASS_MAIN?.toLowerCase().includes('windsurf')) {
|
||||
if (
|
||||
process.env['VSCODE_GIT_ASKPASS_MAIN']?.toLowerCase().includes('windsurf')
|
||||
) {
|
||||
return 'windsurf';
|
||||
}
|
||||
// Check VS Code last since forks may also set VSCODE env vars
|
||||
if (termProgram === 'vscode' || process.env.VSCODE_GIT_IPC_HANDLE) {
|
||||
if (termProgram === 'vscode' || process.env['VSCODE_GIT_IPC_HANDLE']) {
|
||||
return 'vscode';
|
||||
}
|
||||
|
||||
@@ -118,10 +120,10 @@ function getVSCodeStyleConfigDir(appName: string): string | null {
|
||||
'User',
|
||||
);
|
||||
} else if (platform === 'win32') {
|
||||
if (!process.env.APPDATA) {
|
||||
if (!process.env['APPDATA']) {
|
||||
return null;
|
||||
}
|
||||
return path.join(process.env.APPDATA, appName, 'User');
|
||||
return path.join(process.env['APPDATA'], appName, 'User');
|
||||
} else {
|
||||
return path.join(os.homedir(), '.config', appName, 'User');
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('checkForUpdates', () => {
|
||||
vi.useFakeTimers();
|
||||
vi.resetAllMocks();
|
||||
// Clear DEV environment variable before each test
|
||||
delete process.env.DEV;
|
||||
delete process.env['DEV'];
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -31,7 +31,7 @@ describe('checkForUpdates', () => {
|
||||
});
|
||||
|
||||
it('should return null when running from source (DEV=true)', async () => {
|
||||
process.env.DEV = 'true';
|
||||
process.env['DEV'] = 'true';
|
||||
getPackageJson.mockResolvedValue({
|
||||
name: 'test-package',
|
||||
version: '1.0.0',
|
||||
|
||||
@@ -41,7 +41,7 @@ function getBestAvailableUpdate(
|
||||
export async function checkForUpdates(): Promise<UpdateObject | null> {
|
||||
try {
|
||||
// Skip update check when running from source (development mode)
|
||||
if (process.env.DEV === 'true') {
|
||||
if (process.env['DEV'] === 'true') {
|
||||
return null;
|
||||
}
|
||||
const packageJson = await getPackageJson();
|
||||
|
||||
Reference in New Issue
Block a user