Skip to content

Commit

Permalink
Use parameter properties
Browse files Browse the repository at this point in the history
  • Loading branch information
monosans committed Jul 2, 2023
1 parent 7b1164c commit fe3d123
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@
}
],
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/parameter-properties": [
"error",
{
"prefer": "parameter-property"
}
],
"@typescript-eslint/prefer-readonly-parameter-types": "off",
"@typescript-eslint/strict-boolean-expressions": [
"error",
Expand Down
14 changes: 5 additions & 9 deletions src/args.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import type vscode from "vscode";

export abstract class CliArg {
readonly vscodeName: string;
readonly cliName: string;
readonly minVersion: string;

constructor(vscodeName: string, cliName: string, minVersion: string) {
this.vscodeName = vscodeName;
this.cliName = cliName;
this.minVersion = minVersion;
}
constructor(
readonly vscodeName: string,
readonly cliName: string,
readonly minVersion: string
) {}

abstract build(
config: vscode.WorkspaceConfiguration,
Expand Down
5 changes: 1 addition & 4 deletions src/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import { configSection, getConfig } from "./config";
import { runDjlint } from "./runner";

export class Formatter implements vscode.DocumentFormattingEditProvider {
protected readonly context: vscode.ExtensionContext;
protected providerDisposable: vscode.Disposable | undefined;

constructor(context: vscode.ExtensionContext) {
this.context = context;
}
constructor(protected readonly context: vscode.ExtensionContext) {}

activate(): void {
this.register();
Expand Down
4 changes: 1 addition & 3 deletions src/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ export class Linter {
protected static readonly oldOutputRegex =
/^(?<code>[A-Z]+\d+)\s+(?<line>\d+):(?<column>\d+)\s+(?<message>.+)$/gm;
protected readonly collection: vscode.DiagnosticCollection;
protected readonly context: vscode.ExtensionContext;

constructor(context: vscode.ExtensionContext) {
this.context = context;
constructor(protected readonly context: vscode.ExtensionContext) {
this.collection = vscode.languages.createDiagnosticCollection("djLint");
this.context.subscriptions.push(this.collection);
}
Expand Down

0 comments on commit fe3d123

Please sign in to comment.