提交 e22c2707 编写于 作者: M Martin Aeschlimann

[json] set client to strict

上级 d40a1e24
...@@ -42,8 +42,8 @@ interface Settings { ...@@ -42,8 +42,8 @@ interface Settings {
format?: { enable: boolean; }; format?: { enable: boolean; };
}; };
http?: { http?: {
proxy: string; proxy?: string;
proxyStrictSSL: boolean; proxyStrictSSL?: boolean;
}; };
} }
...@@ -53,7 +53,7 @@ interface JSONSchemaSettings { ...@@ -53,7 +53,7 @@ interface JSONSchemaSettings {
schema?: any; schema?: any;
} }
let telemetryReporter: TelemetryReporter; let telemetryReporter: TelemetryReporter | undefined;
export function activate(context: ExtensionContext) { export function activate(context: ExtensionContext) {
...@@ -197,14 +197,14 @@ function getSettings(): Settings { ...@@ -197,14 +197,14 @@ function getSettings(): Settings {
let schemaSetting = schemaSettingsById[url]; let schemaSetting = schemaSettingsById[url];
if (!schemaSetting) { if (!schemaSetting) {
schemaSetting = schemaSettingsById[url] = { url, fileMatch: [] }; schemaSetting = schemaSettingsById[url] = { url, fileMatch: [] };
settings.json.schemas.push(schemaSetting); settings.json!.schemas!.push(schemaSetting);
} }
let fileMatches = setting.fileMatch; let fileMatches = setting.fileMatch;
if (Array.isArray(fileMatches)) { if (Array.isArray(fileMatches)) {
if (fileMatchPrefix) { if (fileMatchPrefix) {
fileMatches = fileMatches.map(m => fileMatchPrefix + m); fileMatches = fileMatches.map(m => fileMatchPrefix + m);
} }
schemaSetting.fileMatch.push(...fileMatches); schemaSetting.fileMatch!.push(...fileMatches);
} }
if (setting.schema) { if (setting.schema) {
schemaSetting.schema = setting.schema; schemaSetting.schema = setting.schema;
...@@ -222,7 +222,7 @@ function getSettings(): Settings { ...@@ -222,7 +222,7 @@ function getSettings(): Settings {
for (let folder of folders) { for (let folder of folders) {
let folderUri = folder.uri; let folderUri = folder.uri;
let schemaConfigInfo = workspace.getConfiguration('json', folderUri).inspect<JSONSchemaSettings[]>('schemas'); let schemaConfigInfo = workspace.getConfiguration('json', folderUri).inspect<JSONSchemaSettings[]>('schemas');
let folderSchemas = schemaConfigInfo.workspaceFolderValue; let folderSchemas = schemaConfigInfo!.workspaceFolderValue;
if (Array.isArray(folderSchemas)) { if (Array.isArray(folderSchemas)) {
let folderPath = folderUri.toString(); let folderPath = folderUri.toString();
if (folderPath[folderPath.length - 1] !== '/') { if (folderPath[folderPath.length - 1] !== '/') {
...@@ -247,7 +247,7 @@ function getSchemaId(schema: JSONSchemaSettings, rootPath?: string) { ...@@ -247,7 +247,7 @@ function getSchemaId(schema: JSONSchemaSettings, rootPath?: string) {
return url; return url;
} }
function getPackageInfo(context: ExtensionContext): IPackageInfo { function getPackageInfo(context: ExtensionContext): IPackageInfo | undefined {
let extensionPackage = require(context.asAbsolutePath('./package.json')); let extensionPackage = require(context.asAbsolutePath('./package.json'));
if (extensionPackage) { if (extensionPackage) {
return { return {
...@@ -256,5 +256,5 @@ function getPackageInfo(context: ExtensionContext): IPackageInfo { ...@@ -256,5 +256,5 @@ function getPackageInfo(context: ExtensionContext): IPackageInfo {
aiKey: extensionPackage.aiKey aiKey: extensionPackage.aiKey
}; };
} }
return null; return void 0;
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"module": "commonjs", "module": "commonjs",
"outDir": "./out", "outDir": "./out",
"noUnusedLocals": true, "noUnusedLocals": true,
"lib": [ "es2016" ] "lib": [ "es2016" ],
"strict": true
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册