Skip to content

Commit 4ab6c92

Browse files
committed
Fix linter errors
1 parent c75cb58 commit 4ab6c92

File tree

7 files changed

+20
-35
lines changed

7 files changed

+20
-35
lines changed

src/css-classes-storage.ts

-11
This file was deleted.

src/extension.ts

+13-14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
workspace,
99
} from "vscode";
1010
import CssClassDefinition from "./common/css-class-definition";
11-
import CssClassesStorage from "./css-classes-storage";
1211
import Fetcher from "./fetcher";
1312
import Notifier from "./notifier";
1413
import ParseEngineGateway from "./parse-engine-gateway";
@@ -18,7 +17,7 @@ let uniqueDefinitions: CssClassDefinition[] = [];
1817

1918
const completionTriggerChars = ['"', "'", " ", "."];
2019

21-
let caching: boolean = false;
20+
let caching = false;
2221

2322
const emmetDisposables: Array<{ dispose(): any }> = [];
2423

@@ -38,9 +37,9 @@ async function cache(): Promise<void> {
3837
console.log("Found all parseable documents.");
3938
const definitions: CssClassDefinition[] = [];
4039

41-
let filesParsed: number = 0;
42-
let failedLogs: string = "";
43-
let failedLogsCount: number = 0;
40+
let filesParsed = 0;
41+
let failedLogs = "";
42+
let failedLogsCount = 0;
4443

4544
console.log("Parsing documents and looking for CSS class definitions...");
4645

@@ -150,9 +149,9 @@ export async function activate(context: ExtensionContext): Promise<void> {
150149
isEnabled ? enableEmmetSupport(emmetDisposables) : disableEmmetSupport(emmetDisposables);
151150
}
152151
} catch (err) {
153-
err = new VError(err, "Failed to automatically reload the extension after the configuration change");
154-
console.error(err);
155-
window.showErrorMessage(err.message);
152+
const newErr = new VError(err, "Failed to automatically reload the extension after the configuration change");
153+
console.error(newErr);
154+
window.showErrorMessage(newErr.message);
156155
}
157156
}, null, disposables);
158157
context.subscriptions.push(...disposables);
@@ -166,9 +165,9 @@ export async function activate(context: ExtensionContext): Promise<void> {
166165
try {
167166
await cache();
168167
} catch (err) {
169-
err = new VError(err, "Failed to cache the CSS classes in the workspace");
170-
console.error(err);
171-
window.showErrorMessage(err.message);
168+
const newErr = new VError(err, "Failed to cache the CSS classes in the workspace");
169+
console.error(newErr);
170+
window.showErrorMessage(newErr.message);
172171
} finally {
173172
caching = false;
174173
}
@@ -200,9 +199,9 @@ export async function activate(context: ExtensionContext): Promise<void> {
200199
try {
201200
await cache();
202201
} catch (err) {
203-
err = new VError(err, "Failed to cache the CSS classes in the workspace for the first time");
204-
console.error(err);
205-
window.showErrorMessage(err.message);
202+
const newErr = new VError(err, "Failed to cache the CSS classes in the workspace for the first time");
203+
console.error(newErr);
204+
window.showErrorMessage(newErr.message);
206205
} finally {
207206
caching = false;
208207
}

src/fetcher.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as vscode from "vscode";
2-
import ParseEngineRegistry from "./parse-engines/parse-engine-registry";
32

43
class Fetcher {
54
public static async findAllParseableDocuments(): Promise<vscode.Uri[]> {

src/notifier.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Notifier {
1010
this.statusBarItem.show();
1111
}
1212

13-
public notify(icon: string, text: string, autoHide: boolean = true): void {
13+
public notify(icon: string, text: string, autoHide = true): void {
1414
if (this.timeoutId) {
1515
clearTimeout(this.timeoutId);
1616
}

src/parse-engines/common/css-class-extractor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default class CssClassExtractor {
66
* @description Extracts class names from CSS AST
77
*/
88
public static extract(ast: css.Stylesheet): CssClassDefinition[] {
9-
const classNameRegex: RegExp = /[.]([\w-]+)/g;
9+
const classNameRegex = /[.]([\w-]+)/g;
1010

1111
const definitions: CssClassDefinition[] = [];
1212

src/parse-engines/types/css-parse-engine.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import * as css from "css";
2-
import * as vscode from "vscode";
32
import CssClassDefinition from "../../common/css-class-definition";
43
import CssClassExtractor from "../common/css-class-extractor";
54
import IParseEngine from "../common/parse-engine";
65
import ISimpleTextDocument from "../common/simple-text-document";
76

87
class CssParseEngine implements IParseEngine {
9-
public languageId: string = "css";
10-
public extension: string = "css";
8+
public languageId = "css";
9+
public extension = "css";
1110

1211
public async parse(textDocument: ISimpleTextDocument): Promise<CssClassDefinition[]> {
1312
const code: string = textDocument.getText();

src/parse-engines/types/html-parse-engine.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@ import * as Bluebird from "bluebird";
22
import * as css from "css";
33
import * as html from "htmlparser2";
44
import * as request from "request-promise";
5-
import * as vscode from "vscode";
65
import CssClassDefinition from "../../common/css-class-definition";
76
import CssClassExtractor from "../common/css-class-extractor";
87
import IParseEngine from "../common/parse-engine";
98
import ISimpleTextDocument from "../common/simple-text-document";
109

1110
class HtmlParseEngine implements IParseEngine {
12-
public languageId: string = "html";
13-
public extension: string = "html";
11+
public languageId = "html";
12+
public extension = "html";
1413

1514
public async parse(textDocument: ISimpleTextDocument): Promise<CssClassDefinition[]> {
1615
const definitions: CssClassDefinition[] = [];
1716
const urls: string[] = [];
1817
let tag: string;
19-
let isRelStylesheet: boolean = false;
18+
let isRelStylesheet = false;
2019
let linkHref: string;
2120

2221
const parser = new html.Parser({

0 commit comments

Comments
 (0)