Skip to content

Commit 81dd60f

Browse files
committed
Use recommended ESLint rules and fix all issues
1 parent 0c9eaf8 commit 81dd60f

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

.eslintrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"root": true,
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:@typescript-eslint/recommended"
6+
],
37
"parser": "@typescript-eslint/parser",
48
"parserOptions": {
59
"ecmaVersion": 6,

src/extension.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { commands, env, ExtensionContext } from 'vscode';
22
import { generateSnippet } from './lib/textHelpers';
33

4-
export function activate(context: ExtensionContext) {
4+
export function activate(context: ExtensionContext): void {
55
context.subscriptions.push(
66
commands.registerTextEditorCommand('snippet-copy.copySnippet', async (editor) => {
77
const snippet = generateSnippet(editor.document, editor.selections, false);
@@ -17,5 +17,3 @@ export function activate(context: ExtensionContext) {
1717
})
1818
);
1919
}
20-
21-
export function deactivate() { }

src/lib/textHelpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { contentOfLinesWithAdjustedIndentation, endOfLineCharacter, languageId,
33
import { lineIndexesForSelection } from "./selectionHelpers";
44

55
export function generateSnippet(document: TextDocument, selections: Selection[], markdownCodeBlock = false): string {
6-
let texts: string[] = [];
6+
const texts: string[] = [];
77
selections.forEach(selection => {
88
texts.push(generateCopyableText(document, selection));
99
});
@@ -19,7 +19,7 @@ export function generateSnippet(document: TextDocument, selections: Selection[],
1919
return snippet;
2020
}
2121

22-
export function generateCopyableText(document: TextDocument, selection: Selection) {
22+
export function generateCopyableText(document: TextDocument, selection: Selection): string {
2323
const lineIndexes = lineIndexesForSelection(selection);
2424

2525
// Remove last line's index if there's no selected text on that line

src/test/suite/lib/documentHelpers.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Document Helpers', function () {
5151
const uri = vscode.Uri.file(
5252
path.join(__dirname + fixturesPath + 'crlf-ruby-example.rb')
5353
);
54-
let crlfDocument = await vscode.workspace.openTextDocument(uri);
54+
const crlfDocument = await vscode.workspace.openTextDocument(uri);
5555

5656
assert.equal(contentOfLinesWithAdjustedIndentation(crlfDocument, [1, 2, 3], 2), 'def polish\r\n puts "Polishing"\r\nend');
5757
});

0 commit comments

Comments
 (0)