From e1df717218f9ae27da14a4ff42eee665c1080c78 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 6 Dec 2022 15:03:41 -0800 Subject: [PATCH] Make sure all samples are extending the eslint base configs --- authenticationprovider-sample/src/extension.ts | 4 +--- helloworld-web-sample/.eslintrc.json | 4 ++++ helloworld-web-sample/src/web/extension.ts | 10 ++++++---- l10n-sample/src/extension.ts | 5 +---- .../.eslintrc.json | 2 ++ notebook-extend-markdown-renderer-sample/src/emoji.ts | 2 +- notebook-renderer-react-sample/.eslintrc.json | 11 +++++++++-- notebook-renderer-react-sample/src/client/index.tsx | 10 ++++++++-- notebook-renderer-sample/.eslintrc.json | 6 +++++- notifications-sample/.eslintrc.json | 4 ++++ uri-handler-sample/.eslintrc.json | 4 ++++ uri-handler-sample/src/extension.ts | 4 +--- welcome-view-content-sample/.eslintrc.json | 6 +++++- welcome-view-content-sample/src/extension.ts | 4 +--- 14 files changed, 52 insertions(+), 24 deletions(-) diff --git a/authenticationprovider-sample/src/extension.ts b/authenticationprovider-sample/src/extension.ts index 6fb6e879..39285430 100644 --- a/authenticationprovider-sample/src/extension.ts +++ b/authenticationprovider-sample/src/extension.ts @@ -30,6 +30,7 @@ export function activate(context: vscode.ExtensionContext) { const req = await fetch('https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=6.0', { headers: { authorization: `Basic ${Buffer.from(`:${session.accessToken}`).toString('base64')}`, + // eslint-disable-next-line @typescript-eslint/naming-convention 'content-type': 'application/json', }, }); @@ -48,6 +49,3 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(disposable); } - -// this method is called when your extension is deactivated -export function deactivate() { } diff --git a/helloworld-web-sample/.eslintrc.json b/helloworld-web-sample/.eslintrc.json index 9123b6f1..acc88b91 100644 --- a/helloworld-web-sample/.eslintrc.json +++ b/helloworld-web-sample/.eslintrc.json @@ -8,6 +8,10 @@ "plugins": [ "@typescript-eslint" ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], "rules": { "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", diff --git a/helloworld-web-sample/src/web/extension.ts b/helloworld-web-sample/src/web/extension.ts index 7348e2e3..dfa98132 100644 --- a/helloworld-web-sample/src/web/extension.ts +++ b/helloworld-web-sample/src/web/extension.ts @@ -2,7 +2,7 @@ // Import the module and reference it with the alias vscode in your code below import * as vscode from 'vscode'; -// this method is called when your extension is activated +// This method is called when your extension is activated // your extension is activated the very first time the command is executed export function activate(context: vscode.ExtensionContext) { @@ -13,7 +13,7 @@ export function activate(context: vscode.ExtensionContext) { // The command has been defined in the package.json file // Now provide the implementation of the command with registerCommand // The commandId parameter must match the command field in package.json - let disposable = vscode.commands.registerCommand('helloworld-web-sample.helloWorld', () => { + const disposable = vscode.commands.registerCommand('helloworld-web-sample.helloWorld', () => { // The code you place here will be executed every time your command is executed // Display a message box to the user @@ -23,5 +23,7 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(disposable); } -// this method is called when your extension is deactivated -export function deactivate() { } +// This method is called when your extension is deactivated +export function deactivate() { + // Noop +} diff --git a/l10n-sample/src/extension.ts b/l10n-sample/src/extension.ts index ea776964..a6cac2e4 100644 --- a/l10n-sample/src/extension.ts +++ b/l10n-sample/src/extension.ts @@ -1,6 +1,6 @@ // The module 'vscode' contains the VS Code extensibility API // Import the module and reference it with the alias vscode in your code below -import path = require('path'); +import * as path from 'path'; import * as vscode from 'vscode'; import { sayByeCommand } from './command/sayBye'; @@ -35,6 +35,3 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(helloCmd, byeCmd); } - -// this method is called when your extension is deactivated -export function deactivate() { } diff --git a/notebook-extend-markdown-renderer-sample/.eslintrc.json b/notebook-extend-markdown-renderer-sample/.eslintrc.json index 5d561174..d4fa2f70 100644 --- a/notebook-extend-markdown-renderer-sample/.eslintrc.json +++ b/notebook-extend-markdown-renderer-sample/.eslintrc.json @@ -12,6 +12,8 @@ "webpack.config.js" ], "rules": { + "@typescript-eslint/semi": "warn", + "semi": "off", "@typescript-eslint/no-var-requires": 0 } } \ No newline at end of file diff --git a/notebook-extend-markdown-renderer-sample/src/emoji.ts b/notebook-extend-markdown-renderer-sample/src/emoji.ts index 9b936989..45308926 100644 --- a/notebook-extend-markdown-renderer-sample/src/emoji.ts +++ b/notebook-extend-markdown-renderer-sample/src/emoji.ts @@ -18,5 +18,5 @@ export async function activate(ctx: RendererContext) { const emoji = require('markdown-it-emoji'); markdownItRenderer.extendMarkdownIt((md: MarkdownIt) => { return md.use(emoji, {}); - }) + }); } diff --git a/notebook-renderer-react-sample/.eslintrc.json b/notebook-renderer-react-sample/.eslintrc.json index 9123b6f1..93d2b042 100644 --- a/notebook-renderer-react-sample/.eslintrc.json +++ b/notebook-renderer-react-sample/.eslintrc.json @@ -8,15 +8,22 @@ "plugins": [ "@typescript-eslint" ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], "rules": { "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", "curly": "warn", "eqeqeq": "warn", "no-throw-literal": "warn", - "semi": "off" + "semi": [ + "error", + "always" + ] }, "ignorePatterns": [ "**/*.d.ts" ] -} +} \ No newline at end of file diff --git a/notebook-renderer-react-sample/src/client/index.tsx b/notebook-renderer-react-sample/src/client/index.tsx index 12ba82c5..b1947cce 100644 --- a/notebook-renderer-react-sample/src/client/index.tsx +++ b/notebook-renderer-react-sample/src/client/index.tsx @@ -23,7 +23,12 @@ export const activate: ActivationFunction = context => { root.id = 'root'; shadow.append(root); } - const root = shadow.querySelector('#root')!; + + const root = shadow.querySelector('#root'); + if (!root) { + throw new Error('Could not find root element'); + } + errorOverlay.wrap(root, () => { root.innerHTML = ''; const node = document.createElement('div'); @@ -32,7 +37,8 @@ export const activate: ActivationFunction = context => { ReactDOM.render(, root); }); }, - disposeOutputItem(outputId) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + disposeOutputItem(_outputId) { // Do any teardown here. outputId is the cell output being deleted, or // undefined if we're clearing all outputs. } diff --git a/notebook-renderer-sample/.eslintrc.json b/notebook-renderer-sample/.eslintrc.json index 9123b6f1..34139145 100644 --- a/notebook-renderer-sample/.eslintrc.json +++ b/notebook-renderer-sample/.eslintrc.json @@ -8,6 +8,10 @@ "plugins": [ "@typescript-eslint" ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], "rules": { "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", @@ -19,4 +23,4 @@ "ignorePatterns": [ "**/*.d.ts" ] -} +} \ No newline at end of file diff --git a/notifications-sample/.eslintrc.json b/notifications-sample/.eslintrc.json index f9b22b79..8bc7cf2b 100644 --- a/notifications-sample/.eslintrc.json +++ b/notifications-sample/.eslintrc.json @@ -8,6 +8,10 @@ "plugins": [ "@typescript-eslint" ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], "rules": { "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", diff --git a/uri-handler-sample/.eslintrc.json b/uri-handler-sample/.eslintrc.json index 4d54b63c..4a4b82dd 100644 --- a/uri-handler-sample/.eslintrc.json +++ b/uri-handler-sample/.eslintrc.json @@ -8,6 +8,10 @@ "plugins": [ "@typescript-eslint" ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], "rules": { "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", diff --git a/uri-handler-sample/src/extension.ts b/uri-handler-sample/src/extension.ts index 9217ed42..854fca22 100644 --- a/uri-handler-sample/src/extension.ts +++ b/uri-handler-sample/src/extension.ts @@ -15,7 +15,7 @@ class MyUriHandler implements vscode.UriHandler { export function activate(context: vscode.ExtensionContext) { - let disposable = vscode.commands.registerCommand('uri-handler-sample.start', async () => { + const disposable = vscode.commands.registerCommand('uri-handler-sample.start', async () => { // Create our new UriHandler const uriHandler = new MyUriHandler(); @@ -31,5 +31,3 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(disposable); } - -export function deactivate() { } diff --git a/welcome-view-content-sample/.eslintrc.json b/welcome-view-content-sample/.eslintrc.json index 4d54b63c..76da300d 100644 --- a/welcome-view-content-sample/.eslintrc.json +++ b/welcome-view-content-sample/.eslintrc.json @@ -8,6 +8,10 @@ "plugins": [ "@typescript-eslint" ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], "rules": { "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", @@ -16,4 +20,4 @@ "no-throw-literal": "warn", "semi": "off" } -} +} \ No newline at end of file diff --git a/welcome-view-content-sample/src/extension.ts b/welcome-view-content-sample/src/extension.ts index ac5933d3..8d1e46c8 100644 --- a/welcome-view-content-sample/src/extension.ts +++ b/welcome-view-content-sample/src/extension.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; export function activate(context: vscode.ExtensionContext) { - let disposable = vscode.commands.registerCommand( + const disposable = vscode.commands.registerCommand( 'welcome-view-content-sample.hello', async () => { vscode.window.showInformationMessage('Hello world!'); @@ -10,5 +10,3 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(disposable); } - -export function deactivate() { }