From eae67c45e6a73dbf33309439a595ff093ceefced Mon Sep 17 00:00:00 2001 From: Dmitry Shirokov Date: Fri, 30 Sep 2022 12:19:15 +1000 Subject: [PATCH] Maintenance --- .eslintrc.json | 10 ---------- .github/workflows/build.yml | 3 +-- LICENSE | 2 +- package.json | 11 ++++------- src/encoding/mbcs.ts | 9 +++------ src/encoding/sbcs.ts | 2 +- src/encoding/unicode.ts | 2 +- tsconfig.json | 6 ++++-- 8 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 2906220..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint"], - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - "rules": { - "@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "_" }], - "@typescript-eslint/no-inferrable-types": ["off"] - } -} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d91862..917ac9e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 14.x] + node-version: [12.x, 14.x, 16.x, 18.x] steps: - uses: actions/checkout@v2 @@ -21,6 +21,5 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm i - - run: npm run lint - run: npm test - run: npm run build diff --git a/LICENSE b/LICENSE index 04ae22a..777f1cc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2021 Dmitry Shirokov +Copyright (C) 2022 Dmitry Shirokov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index d3fe8aa..3e97308 100644 --- a/package.json +++ b/package.json @@ -14,15 +14,15 @@ }, "scripts": { "build": "rm -rf lib/* && tsc", - "lint": "eslint . --ext .js,.jsx,.ts,.tsx", - "lint:types": "tsc --noEmit", "format": "prettier --write ./src/**/*.ts", "format:check": "prettier --list-different ./src/**/*.ts", "test": "jest", "prepublish": "npm run build", "semantic-release": "semantic-release" }, - "files": ["lib"], + "files": [ + "lib" + ], "main": "lib/index.js", "typings": "lib/index.d.ts", "engine": { @@ -35,14 +35,11 @@ "devDependencies": { "@types/jest": "^26.0.14", "@types/node": "^14.11.2", - "@typescript-eslint/eslint-plugin": "^4.2.0", - "@typescript-eslint/parser": "^4.2.0", - "eslint": "^7.9.0", "jest": "^26.4.2", "prettier": "^2.1.2", "semantic-release": "^17.1.2", "ts-jest": "^26.4.0", - "typescript": "^4.0.3" + "typescript": "^4.8.4" }, "keywords": [ "encoding", diff --git a/src/encoding/mbcs.ts b/src/encoding/mbcs.ts index 507f3f4..e94e5c7 100644 --- a/src/encoding/mbcs.ts +++ b/src/encoding/mbcs.ts @@ -98,8 +98,7 @@ class mbcs implements Recogniser { * bits 8-15: The match reason, an enum-like value. */ match(det: Context): Match | null { - let singleByteCharCount = 0, //TODO Do we really need this? - doubleByteCharCount = 0, + let doubleByteCharCount = 0, commonCharCount = 0, badCharCount = 0, totalCharCount = 0, @@ -115,9 +114,7 @@ class mbcs implements Recogniser { } else { const cv = iter.charValue & 0xffffffff; - if (cv <= 0xff) { - singleByteCharCount++; - } else { + if (cv > 0xff) { doubleByteCharCount++; if (this.commonChars != null) { // NOTE: This assumes that there are no 4-byte common chars. @@ -192,7 +189,7 @@ class mbcs implements Recogniser { * being iterated over. * @return True if a character was returned, false at end of input. */ - nextChar(iter: IteratedChar, det: Context): boolean { + nextChar(_iter: IteratedChar, _det: Context): boolean { return true; } } diff --git a/src/encoding/sbcs.ts b/src/encoding/sbcs.ts index bf17036..63c6b43 100644 --- a/src/encoding/sbcs.ts +++ b/src/encoding/sbcs.ts @@ -120,7 +120,7 @@ class sbcs implements Recogniser { return []; } - name(input: Context): string { + name(_input: Context): string { return 'sbcs'; } diff --git a/src/encoding/unicode.ts b/src/encoding/unicode.ts index 06ab709..543001c 100644 --- a/src/encoding/unicode.ts +++ b/src/encoding/unicode.ts @@ -60,7 +60,7 @@ class UTF_32 implements Recogniser, WithGetChar { return 'UTF-32'; } - getChar(input: Uint8Array, index: number): number { + getChar(_input: Uint8Array, _index: number): number { return -1; } diff --git a/tsconfig.json b/tsconfig.json index 1e91c55..e3a2fa7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,13 +8,15 @@ "declaration": true, "diagnostics": true, "esModuleInterop": true, - "extendedDiagnostics": true, + "extendedDiagnostics": false, "listEmittedFiles": true, "module": "commonjs", "removeComments": true, "sourceMap": true, "strict": true, - "target": "ES2019" + "target": "ES2019", + "noUnusedLocals": true, + "noUnusedParameters": true }, "exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts", "__mocks__", "lib"] }