Skip to content

Commit a1846e8

Browse files
committed
revise eslint settings
1 parent 54a4d36 commit a1846e8

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ module.exports = {
1919
"no-useless-escape": "warn",
2020
"no-console": "warn",
2121
"valid-typeof": "warn", // "bigint" is not yet supported
22+
"no-return-await": "error",
23+
"prefer-const": "error",
24+
"guard-for-in": "error",
2225

23-
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_|^intl$" }],
26+
"@typescript-eslint/no-unused-vars":"warn",
2427
"@typescript-eslint/array-type": ["error", "generic"],
2528
"@typescript-eslint/camelcase": "warn",
2629
"@typescript-eslint/class-name-casing": "warn", // to allow the initial underscore
@@ -29,6 +32,9 @@ module.exports = {
2932
"@typescript-eslint/prefer-includes": "warn",
3033
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
3134
"@typescript-eslint/no-use-before-define": "warn",
35+
"@typescript-eslint/restrict-plus-operands": "error",
36+
"@typescript-eslint/await-thenable": "error",
37+
"@typescript-eslint/no-for-in-array": "error",
3238

3339
"@typescript-eslint/indent": "off",
3440
"@typescript-eslint/no-explicit-any": "off",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"test:cover": "npx nyc mocha 'test/**/*.test.ts'",
1515
"lint": "eslint --ext .ts src test",
1616
"lint:fix": "eslint --fix --ext .ts src test && npm run format",
17+
"lint:print-config": "eslint --print-config .eslintrc.js",
1718
"format": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
1819
"profile:encode": "rm -f isolate-*.log ; node --prof --require ts-node/register -e 'require(\"./benchmark/profile-encode\")' && node --prof-process --preprocess -j isolate-*.log | npx flamebearer",
1920
"profile:decode": "rm -f isolate-*.log ; node --prof --require ts-node/register -e 'require(\"./benchmark/profile-decode\")' && node --prof-process --preprocess -j isolate-*.log | npx flamebearer",

src/Decoder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class Decoder {
5555
return new RangeError(`Extra ${view.byteLength - pos} byte(s) found at buffer[${posToShow}]`);
5656
}
5757

58-
decodeOneSync() {
58+
decodeOneSync(): unknown {
5959
const object = this.decodeSync();
6060
if (this.hasRemaining()) {
6161
throw this.createNoExtraBytesError(this.pos);

src/decodeAsync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export async function decodeAsync(
1212
{ extensionCodec }: DecodeAsyncOptions = {},
1313
): Promise<unknown> {
1414
const decoder = new Decoder(extensionCodec);
15-
return await decoder.decodeOneAsync(stream);
15+
return decoder.decodeOneAsync(stream);
1616
}

test/msgpack-test-suite.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe("msgpack-test-suite", () => {
5757
Exam.getExams(TEST_TYPES).forEach((exam) => {
5858
const types = exam.getTypes(TEST_TYPES);
5959
const first = types[0];
60-
const title = first + ": " + exam.stringify(first);
60+
const title = `${first}: ${exam.stringify(first)}`;
6161
it(`encodes ${title}`, () => {
6262
types.forEach((type) => {
6363
const value = exam.getValue(type);

0 commit comments

Comments
 (0)