2527: Enable tsc builtin lint options for vscode/extension r=matklad a=saneyuki
* These options are not enabled by `--strict` option and these options make a code more solid.
* https://www.typescriptlang.org/docs/handbook/compiler-options.html
* For `noUnusedParameters` , we need to tweak tslint option to allow `_bar` style.
Co-authored-by: Tetsuharu OHZEKI <tetsuharu.ohzeki@gmail.com>
public syntaxTree: string = 'Not available';
public provideTextDocumentContent(
- uri: vscode.Uri,
+ _uri: vscode.Uri,
): vscode.ProviderResult<string> {
const editor = vscode.window.activeTextEditor;
if (editor == null) {
public eventEmitter = new vscode.EventEmitter<vscode.Uri>();
public provideTextDocumentContent(
- uri: vscode.Uri,
+ _uri: vscode.Uri,
): vscode.ProviderResult<string> {
async function handle() {
const editor = vscode.window.activeTextEditor;
}
let prevRunnable: RunnableQuickPick | undefined;
-export async function handle() {
+export async function handle(): Promise<vscode.TaskExecution | undefined> {
const editor = vscode.window.activeTextEditor;
if (editor == null || editor.document.languageId !== 'rust') {
return;
items.push(new RunnableQuickPick(r));
}
const item = await vscode.window.showQuickPick(items);
- if (item) {
- item.detail = 'rerun';
- prevRunnable = item;
- const task = createTask(item.runnable);
- return await vscode.tasks.executeTask(task);
+ if (!item) {
+ return;
}
+
+ item.detail = 'rerun';
+ prevRunnable = item;
+ const task = createTask(item.runnable);
+ return await vscode.tasks.executeTask(task);
}
export async function handleSingle(runnable: Runnable) {
}
const label = 'install-cargo-watch';
- const taskFinished = new Promise((resolve, reject) => {
+ const taskFinished = new Promise((resolve, _reject) => {
const disposable = vscode.tasks.onDidEndTask(({ execution }) => {
if (execution.task.name === label) {
disposable.dispose();
const edit = codeAction.edit;
if (!edit) {
- return assert.fail('Code Action edit unexpectedly missing');
+ assert.fail('Code Action edit unexpectedly missing');
+ return;
}
const editEntries = edit.entries();
const { diagnostics } = codeAction;
if (!diagnostics) {
- return assert.fail('Diagnostics unexpectedly missing');
+ assert.fail('Diagnostics unexpectedly missing');
+ return;
}
assert.strictEqual(diagnostics.length, 1);
const { diagnostics } = codeAction;
if (!diagnostics) {
- return assert.fail('Diagnostics unexpectedly missing');
+ assert.fail('Diagnostics unexpectedly missing');
+ return;
}
// We should be associated with both diagnostics
// One related information for the original definition
const relatedInformation = diagnostic.relatedInformation;
if (!relatedInformation) {
- return assert.fail('Related information unexpectedly undefined');
+ assert.fail('Related information unexpectedly undefined');
+ return;
}
assert.strictEqual(relatedInformation.length, 1);
const [related] = relatedInformation;
// One related information for the lint definition
const relatedInformation = diagnostic.relatedInformation;
if (!relatedInformation) {
- return assert.fail('Related information unexpectedly undefined');
+ assert.fail('Related information unexpectedly undefined');
+ return;
}
assert.strictEqual(relatedInformation.length, 1);
const [related] = relatedInformation;
"sourceMap": true,
"rootDir": "src",
"strict": true,
- "noUnusedLocals": true
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true
},
"exclude": ["node_modules", ".vscode-test"]
}
"rules": {
"quotemark": [true, "single"],
"interface-name": false,
- "object-literal-sort-keys": false
+ "object-literal-sort-keys": false,
+ // Allow `_bar` to sort with tsc's `noUnusedParameters` option
+ "variable-name": [true, "allow-leading-underscore"]
}
}