Skip to content

Commit e44e02c

Browse files
committed
fix eslint and remove posttest
1 parent 9f4821d commit e44e02c

File tree

9 files changed

+22
-20
lines changed

9 files changed

+22
-20
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": ["oclif", "oclif-typescript", "plugin:prettier/recommended"],
33
"rules": {
44
"quotes": ["error", "double"],
5-
"no-await-in-loop": "off"
5+
"no-await-in-loop": "off",
6+
"unicorn/filename-case": "off"
67
}
78
}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"prettier": "2.2.1",
3232
"rimraf": "^3.0.2",
3333
"ts-node": "^9.1.1",
34-
"typescript": "^4.2.2"
34+
"typescript": "^4.2.3"
3535
},
3636
"engines": {
3737
"node": ">=8.0.0"
@@ -51,7 +51,6 @@
5151
},
5252
"repository": "hckhanh/create-javascript-project",
5353
"scripts": {
54-
"posttest": "eslint . --ext .ts --config .eslintrc",
5554
"prepack": "rimraf lib && tsc -b && oclif-dev readme",
5655
"test": "echo NO TESTS",
5756
"version": "oclif-dev readme && git add README.md"

src/formatters/FormatterFactory.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { ConfigsFileFormat } from "../types";
22
import { Formatter } from "./Formatter";
3-
import { JSFormatter } from "./JSFormatter";
4-
import { JSONFormatter } from "./JSONFormatter";
5-
import { YAMLFormatter } from "./YAMLFormatter";
3+
import { JsFormatter } from "./JsFormatter";
4+
import { JsonFormatter } from "./JsonFormatter";
5+
import { YamlFormatter } from "./YamlFormatter";
66

77
export class FormatterFactory {
88
private static factory: FormatterFactory = new FormatterFactory();
99

10+
// eslint-disable-next-line no-useless-constructor,@typescript-eslint/no-empty-function
1011
private constructor() {}
1112

1213
public static getInstance() {
@@ -15,15 +16,15 @@ export class FormatterFactory {
1516

1617
createFormatter(type: ConfigsFileFormat): Formatter {
1718
if (type === "js") {
18-
return new JSFormatter();
19+
return new JsFormatter();
1920
}
2021

2122
if (type === "json") {
22-
return new JSONFormatter();
23+
return new JsonFormatter();
2324
}
2425

2526
if (type === "yml") {
26-
return new YAMLFormatter();
27+
return new YamlFormatter();
2728
}
2829

2930
throw new Error(`"${type}" formatter not implemented.`);

src/formatters/JSFormatter.ts renamed to src/formatters/JsFormatter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { JSONFormatter } from "./JSONFormatter";
1+
import { JsonFormatter } from "./JsonFormatter";
22

3-
export class JSFormatter extends JSONFormatter {
3+
export class JsFormatter extends JsonFormatter {
44
format(configs: object) {
55
const jsonObj = super.format(configs);
66
return "module.exports = ".concat(jsonObj);

src/formatters/JSONFormatter.ts renamed to src/formatters/JsonFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { formatJson } from "../process";
22
import { Formatter } from "./Formatter";
33

4-
export class JSONFormatter extends Formatter {
4+
export class JsonFormatter extends Formatter {
55
format(configs: object) {
66
return formatJson(configs);
77
}

src/formatters/YAMLFormatter.ts renamed to src/formatters/YamlFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { dump } from "js-yaml";
22
import { Formatter } from "./Formatter";
33

4-
export class YAMLFormatter extends Formatter {
4+
export class YamlFormatter extends Formatter {
55
format(configs: object) {
66
return dump(configs);
77
}

src/packagers/NPMPackager.ts renamed to src/packagers/NpmPackager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { runCommand } from "../process";
22
import { Packager } from "./Packager";
33

4-
export class NPMPackager extends Packager {
4+
export class NpmPackager extends Packager {
55
installDependencies(packages: string[]): Promise<number> {
66
return runCommand("npm", ["install", "--save-dev", ...packages]);
77
}

src/packagers/PackagerFactory.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { PackagerType } from "../types";
2-
import { NPMPackager } from "./NPMPackager";
2+
import { NpmPackager } from "./NpmPackager";
33
import { Packager } from "./Packager";
44
import { YarnPackager } from "./YarnPackager";
55

66
export class PackagerFactory {
77
private static factory: PackagerFactory = new PackagerFactory();
88

9+
// eslint-disable-next-line no-useless-constructor,@typescript-eslint/no-empty-function
910
private constructor() {}
1011

1112
public static getInstance() {
@@ -18,7 +19,7 @@ export class PackagerFactory {
1819
}
1920

2021
if (type === "npm") {
21-
return new NPMPackager();
22+
return new NpmPackager();
2223
}
2324

2425
throw new Error(`"${type}" packager not implemented.`);

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,10 +2144,10 @@ typedarray-to-buffer@^3.1.5:
21442144
dependencies:
21452145
is-typedarray "^1.0.0"
21462146

2147-
typescript@^4.2.2:
2148-
version "4.2.2"
2149-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz#1450f020618f872db0ea17317d16d8da8ddb8c4c"
2150-
integrity sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==
2147+
typescript@^4.2.3:
2148+
version "4.2.3"
2149+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
2150+
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
21512151

21522152
universalify@^0.1.0:
21532153
version "0.1.2"

0 commit comments

Comments
 (0)