Skip to content

Commit

Permalink
[Fix] Fixed eslint errors & updated configs
Browse files Browse the repository at this point in the history
  • Loading branch information
KreativJos committed Oct 19, 2021
1 parent f5d0cf1 commit 54d32dc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"rules": {
"indent": [
"error",
4
4,
{
"SwitchCase": 1
}
],
"linebreak-style": [
"error",
Expand Down
6 changes: 3 additions & 3 deletions src/csprojReader.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Nameable from './nameable';
import * as xml2js from 'xml2js';
import { Parser } from 'xml2js';

export default class CsprojReader implements Nameable {
private readonly xml: string;
private readonly xmlParser: any;
private readonly xmlParser: Parser;

/**
* Initializes a new instance for a .csproj
Expand All @@ -13,7 +13,7 @@ export default class CsprojReader implements Nameable {
*/
constructor(fileContent: string) {
this.xml = fileContent;
this.xmlParser = new xml2js.Parser();
this.xmlParser = new Parser();
}

public async getRootNamespace(): Promise<string | undefined> {
Expand Down
7 changes: 3 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function activate(context: vscode.ExtensionContext): void {
export function deactivate(): void { /* Nothing to do here */ }

export class Extension {
private constructor() { }
private constructor() { /**/ }

private _getIncomingPath(args: any): string | undefined {
if (args) {
Expand Down Expand Up @@ -75,8 +75,7 @@ export class Extension {

if (newFilename.endsWith('.cs')) newFilename = newFilename.substring(0, newFilename.length - 3);

let pathWithoutExtension = `${incomingPath}${path.sep}${newFilename}`;

const pathWithoutExtension = `${incomingPath}${path.sep}${newFilename}`;
const existingFiles = await template.getExistingFiles(pathWithoutExtension);

if (existingFiles.length) {
Expand Down Expand Up @@ -104,7 +103,7 @@ export class Extension {
'jsw.csharpextensions'
];

public static GetInstance() {
public static GetInstance(): Extension {
if (!this.Instance) {
this.Instance = new Extension();
}
Expand Down
4 changes: 2 additions & 2 deletions src/namespaceDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class NamespaceDetector {

private async read(file: Uri): Promise<string> {
const document = await workspace.openTextDocument(file);

return document.getText();
}

Expand All @@ -104,7 +104,7 @@ export default class NamespaceDetector {
for (let index = rootDirSegments.length; index < filePathSegments.length; index++) {
fullNamespace += '.' + filePathSegments[index];
}

return fullNamespace;
}
}
2 changes: 1 addition & 1 deletion src/template/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default abstract class Template {
return await namespaceDetector.getNamespace();
}

protected async _createFile(templatePath: string, filePath: string, filename: string) {
protected async _createFile(templatePath: string, filePath: string, filename: string): Promise<void> {
try {
const doc = await fs.readFile(templatePath, 'utf-8');
const namespace = await this.getNamespace(filePath);
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
],
"sourceMap": true,
"rootDir": ".",
"strict": true
"strict": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noUnusedLocals": true
},
"exclude": [
"node_modules",
Expand Down

0 comments on commit 54d32dc

Please sign in to comment.