Maintenance

This commit is contained in:
Dmitry Shirokov 2022-09-30 12:19:15 +10:00
parent 9032016305
commit eae67c45e6
No known key found for this signature in database
GPG Key ID: 8497F81BB7F0B0C0
8 changed files with 15 additions and 30 deletions

View File

@ -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"]
}
}

View File

@ -12,7 +12,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [10.x, 12.x, 14.x] node-version: [12.x, 14.x, 16.x, 18.x]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -21,6 +21,5 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: npm i - run: npm i
- run: npm run lint
- run: npm test - run: npm test
- run: npm run build - run: npm run build

View File

@ -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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -14,15 +14,15 @@
}, },
"scripts": { "scripts": {
"build": "rm -rf lib/* && tsc", "build": "rm -rf lib/* && tsc",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:types": "tsc --noEmit",
"format": "prettier --write ./src/**/*.ts", "format": "prettier --write ./src/**/*.ts",
"format:check": "prettier --list-different ./src/**/*.ts", "format:check": "prettier --list-different ./src/**/*.ts",
"test": "jest", "test": "jest",
"prepublish": "npm run build", "prepublish": "npm run build",
"semantic-release": "semantic-release" "semantic-release": "semantic-release"
}, },
"files": ["lib"], "files": [
"lib"
],
"main": "lib/index.js", "main": "lib/index.js",
"typings": "lib/index.d.ts", "typings": "lib/index.d.ts",
"engine": { "engine": {
@ -35,14 +35,11 @@
"devDependencies": { "devDependencies": {
"@types/jest": "^26.0.14", "@types/jest": "^26.0.14",
"@types/node": "^14.11.2", "@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", "jest": "^26.4.2",
"prettier": "^2.1.2", "prettier": "^2.1.2",
"semantic-release": "^17.1.2", "semantic-release": "^17.1.2",
"ts-jest": "^26.4.0", "ts-jest": "^26.4.0",
"typescript": "^4.0.3" "typescript": "^4.8.4"
}, },
"keywords": [ "keywords": [
"encoding", "encoding",

View File

@ -98,8 +98,7 @@ class mbcs implements Recogniser {
* bits 8-15: The match reason, an enum-like value. * bits 8-15: The match reason, an enum-like value.
*/ */
match(det: Context): Match | null { match(det: Context): Match | null {
let singleByteCharCount = 0, //TODO Do we really need this? let doubleByteCharCount = 0,
doubleByteCharCount = 0,
commonCharCount = 0, commonCharCount = 0,
badCharCount = 0, badCharCount = 0,
totalCharCount = 0, totalCharCount = 0,
@ -115,9 +114,7 @@ class mbcs implements Recogniser {
} else { } else {
const cv = iter.charValue & 0xffffffff; const cv = iter.charValue & 0xffffffff;
if (cv <= 0xff) { if (cv > 0xff) {
singleByteCharCount++;
} else {
doubleByteCharCount++; doubleByteCharCount++;
if (this.commonChars != null) { if (this.commonChars != null) {
// NOTE: This assumes that there are no 4-byte common chars. // NOTE: This assumes that there are no 4-byte common chars.
@ -192,7 +189,7 @@ class mbcs implements Recogniser {
* being iterated over. * being iterated over.
* @return True if a character was returned, false at end of input. * @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; return true;
} }
} }

View File

@ -120,7 +120,7 @@ class sbcs implements Recogniser {
return []; return [];
} }
name(input: Context): string { name(_input: Context): string {
return 'sbcs'; return 'sbcs';
} }

View File

@ -60,7 +60,7 @@ class UTF_32 implements Recogniser, WithGetChar {
return 'UTF-32'; return 'UTF-32';
} }
getChar(input: Uint8Array, index: number): number { getChar(_input: Uint8Array, _index: number): number {
return -1; return -1;
} }

View File

@ -8,13 +8,15 @@
"declaration": true, "declaration": true,
"diagnostics": true, "diagnostics": true,
"esModuleInterop": true, "esModuleInterop": true,
"extendedDiagnostics": true, "extendedDiagnostics": false,
"listEmittedFiles": true, "listEmittedFiles": true,
"module": "commonjs", "module": "commonjs",
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"strict": true, "strict": true,
"target": "ES2019" "target": "ES2019",
"noUnusedLocals": true,
"noUnusedParameters": true
}, },
"exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts", "__mocks__", "lib"] "exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts", "__mocks__", "lib"]
} }