Enable noImplicitReturns option for vscode extension

This commit is contained in:
Tetsuharu OHZEKI 2019-12-12 00:49:54 +09:00
parent b21bb44c8d
commit 0e9cabab3f
5 changed files with 20 additions and 12 deletions

View file

@ -73,7 +73,7 @@ function createTask(spec: Runnable): vscode.Task {
} }
let prevRunnable: RunnableQuickPick | undefined; let prevRunnable: RunnableQuickPick | undefined;
export async function handle() { export async function handle(): Promise<vscode.TaskExecution | undefined> {
const editor = vscode.window.activeTextEditor; const editor = vscode.window.activeTextEditor;
if (editor == null || editor.document.languageId !== 'rust') { if (editor == null || editor.document.languageId !== 'rust') {
return; return;
@ -105,12 +105,14 @@ export async function handle() {
items.push(new RunnableQuickPick(r)); items.push(new RunnableQuickPick(r));
} }
const item = await vscode.window.showQuickPick(items); const item = await vscode.window.showQuickPick(items);
if (item) { if (!item) {
return;
}
item.detail = 'rerun'; item.detail = 'rerun';
prevRunnable = item; prevRunnable = item;
const task = createTask(item.runnable); const task = createTask(item.runnable);
return await vscode.tasks.executeTask(task); return await vscode.tasks.executeTask(task);
}
} }
export async function handleSingle(runnable: Runnable) { export async function handleSingle(runnable: Runnable) {

View file

@ -114,7 +114,8 @@ describe('SuggestedFix', () => {
const edit = codeAction.edit; const edit = codeAction.edit;
if (!edit) { if (!edit) {
return assert.fail('Code Action edit unexpectedly missing'); assert.fail('Code Action edit unexpectedly missing');
return;
} }
const editEntries = edit.entries(); const editEntries = edit.entries();

View file

@ -53,7 +53,8 @@ describe('SuggestedFixCollection', () => {
const { diagnostics } = codeAction; const { diagnostics } = codeAction;
if (!diagnostics) { if (!diagnostics) {
return assert.fail('Diagnostics unexpectedly missing'); assert.fail('Diagnostics unexpectedly missing');
return;
} }
assert.strictEqual(diagnostics.length, 1); assert.strictEqual(diagnostics.length, 1);
@ -114,7 +115,8 @@ describe('SuggestedFixCollection', () => {
const { diagnostics } = codeAction; const { diagnostics } = codeAction;
if (!diagnostics) { if (!diagnostics) {
return assert.fail('Diagnostics unexpectedly missing'); assert.fail('Diagnostics unexpectedly missing');
return;
} }
// We should be associated with both diagnostics // We should be associated with both diagnostics

View file

@ -120,7 +120,8 @@ describe('mapRustDiagnosticToVsCode', () => {
// One related information for the original definition // One related information for the original definition
const relatedInformation = diagnostic.relatedInformation; const relatedInformation = diagnostic.relatedInformation;
if (!relatedInformation) { if (!relatedInformation) {
return assert.fail('Related information unexpectedly undefined'); assert.fail('Related information unexpectedly undefined');
return;
} }
assert.strictEqual(relatedInformation.length, 1); assert.strictEqual(relatedInformation.length, 1);
const [related] = relatedInformation; const [related] = relatedInformation;
@ -154,7 +155,8 @@ describe('mapRustDiagnosticToVsCode', () => {
// One related information for the lint definition // One related information for the lint definition
const relatedInformation = diagnostic.relatedInformation; const relatedInformation = diagnostic.relatedInformation;
if (!relatedInformation) { if (!relatedInformation) {
return assert.fail('Related information unexpectedly undefined'); assert.fail('Related information unexpectedly undefined');
return;
} }
assert.strictEqual(relatedInformation.length, 1); assert.strictEqual(relatedInformation.length, 1);
const [related] = relatedInformation; const [related] = relatedInformation;

View file

@ -8,7 +8,8 @@
"rootDir": "src", "rootDir": "src",
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true "noUnusedParameters": true,
"noImplicitReturns": true
}, },
"exclude": ["node_modules", ".vscode-test"] "exclude": ["node_modules", ".vscode-test"]
} }