Skip to content

Commit

Permalink
Fix eslint, deprecate tslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Aug 1, 2022
1 parent b3b4c0e commit 409a2bb
Show file tree
Hide file tree
Showing 5 changed files with 1,334 additions and 141 deletions.
188 changes: 119 additions & 69 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,30 +1,59 @@
{
"env": {
"browser": true,
"es6": true,
"es2021": true,
"node": true
},
"extends": [],
"ignorePatterns": [],
"extends": [
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"project": "./tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"@typescript-eslint/tslint"
"eslint-plugin-import",
"eslint-plugin-jsdoc",
"eslint-plugin-node",
"eslint-plugin-unicorn",
"@typescript-eslint"
],
"rules": {
"quotes": [
"off"
],
"@typescript-eslint/quotes": "off",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/array-type": [
"error",
{
"default": "array"
}
],
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"Object": {
"message": "Avoid using the `Object` type. Did you mean `object`?"
},
"Function": {
"message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
},
"Boolean": {
"message": "Avoid using the `Boolean` type. Did you mean `boolean`?"
},
"Number": {
"message": "Avoid using the `Number` type. Did you mean `number`?"
},
"String": {
"message": "Avoid using the `String` type. Did you mean `string`?"
},
"Symbol": {
"message": "Avoid using the `Symbol` type. Did you mean `symbol`?"
}
}
}
],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/indent": [
"error",
2,
Expand All @@ -35,37 +64,55 @@
},
"FunctionExpression": {
"parameters": "first"
}
},
"SwitchCase": 1
}
],
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/no-empty-function": [
"error",
{
"allow": [
"constructors"
]
}
],
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-shadow": [
"error",
{
"hoist": "all"
}
],
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": "off",
"@typescript-eslint/semi": [
"error",
"always"
],
/*
"@typescript-eslint/space-within-parens": [
"@typescript-eslint/triple-slash-reference": [
"error",
"always"
],*/
"@typescript-eslint/triple-slash-reference": "error",
{
"path": "always",
"types": "prefer-import",
"lib": "always"
}
],
"@typescript-eslint/unified-signatures": "error",
"arrow-parens": [
"error",
"as-needed"
],
"camelcase": "error",
"comma-dangle": "error",
"complexity": "off",
"constructor-super": "error",
Expand All @@ -77,9 +124,10 @@
"smart"
],
"guard-for-in": "off",
"id-blacklist": [
"id-denylist": [
"error",
"any",
"Number",
"number",
"String",
"string",
Expand All @@ -89,24 +137,19 @@
"undefined"
],
"id-match": "error",
/*
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": false
}
], */
/*
"import/no-internal-modules": [
"error",
{
"allow": [
"strtok3/*",
"file-type/*"
]
}
],*/
"error", {"devDependencies": ["test/**/*.ts"]}
],
"import/no-internal-modules": "off",
"import/order": "off",
"import/no-unresolved": ["error", {"caseSensitiveStrict": true }],
"indent": "off",
"jsdoc/check-alignment": "error",
"jsdoc/check-indentation": "error",
"jsdoc/newline-after-description": [
"error",
"never"
],
"max-classes-per-file": "off",
"max-len": [
"error",
Expand All @@ -123,6 +166,7 @@
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "error",
"no-empty-function": "off",
"no-eval": "error",
"no-extra-bind": "error",
"no-fallthrough": "off",
Expand All @@ -132,12 +176,7 @@
"no-redeclare": "error",
"no-return-await": "error",
"no-sequences": "error",
"no-shadow": [
"error",
{
"hoist": "all"
}
],
"no-shadow": "off",
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
Expand All @@ -147,46 +186,57 @@
"no-unsafe-finally": "error",
"no-unused-expressions": "error",
"no-unused-labels": "error",
"no-use-before-define": "off",
"no-var": "error",
"node/file-extension-in-import": ["error", "always"],
"node/no-extraneous-import": "error",
"object-shorthand": "error",
"one-var": [
"error",
"never"
],
// "prefer-arrow/prefer-arrow-functions": "error",
"prefer-const": "error",
"prefer-object-spread": "error",
"quote-props": [
"error",
"as-needed"
],
"quotes": "off",
"radix": "error",
"spaced-comment": "error",
"use-isnan": "error",
"valid-typeof": "off",
"@typescript-eslint/tslint/config": [
"semi": "error",
"space-in-parens": [
"error",
"never"
],
"spaced-comment": [
"error",
"always",
{
"rules": {
"jsdoc-format": [
true,
"check-multiline-start"
],
"no-reference-import": true,
"prefer-conditional-expression": true,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast",
"check-type-operator",
"check-rest-spread"
]
}
"markers": [
"/"
]
}
],
"unicorn/prefer-ternary": "error",
"use-isnan": "error",
"valid-typeof": "off"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".tsx"
]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": [
"lib/tsconfig.json",
"test/tsconfig.json"
]
}
]
}
}
}

1 change: 1 addition & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ export class IgnoreType implements IGetToken<void> {
}

// ToDo: don't read, but skip data
// eslint-disable-next-line @typescript-eslint/no-empty-function
public get(array: Uint8Array, off: number) {
}
}
Expand Down
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
"compile-src": "tsc --p lib",
"compile-test": "tsc --p test",
"compile": "npm run compile-src && npm run compile-test",
"eslint": "eslint lib test --ext .ts --ignore-pattern *.d.ts",
"lint-ts": "tslint lib/index.ts --exclude '*.d.ts' 'test/**/*.ts' --exclude 'test/**/*.d.ts'",
"lint-md": "remark -u preset-lint-recommended .",
"lint": "npm run lint-ts && npm run lint-md",
"lint": "npm run lint-md && npm run eslint",
"test": "mocha",
"test-coverage": "c8 npm run test",
"send-codacy": "c8 report --reports-dir=./.coverage --reporter=text-lcov | codacy-coverage"
Expand All @@ -45,16 +46,24 @@
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.0",
"@types/node": "^18.6.3",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"c8": "^7.12.0",
"chai": "^4.3.6",
"coveralls": "^3.1.1",
"del-cli": "^5.0.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.3.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-unicorn": "^43.0.2",
"mocha": "^10.0.0",
"remark-cli": "^11.0.0",
"remark-preset-lint-recommended": "^6.1.2",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.1",
"tslint": "^6.1.3",
"typescript": "^4.7.4"
},
"dependencies": {
Expand Down
4 changes: 3 additions & 1 deletion test/test-iso-8859-1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { assert } from 'chai';
import { Buffer } from 'node:buffer';
import { AnsiStringType } from '../lib/index.js';

/* eslint-disable max-len */

describe('Decode ANSI-string (ISO-8859-1)', () => {

function decode(v: string): string {
Expand All @@ -19,7 +21,7 @@ describe('Decode ANSI-string (ISO-8859-1)', () => {
);
assert.equal(
decode('\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\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u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\x9D\u017E\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF",
'Decoding all other symbols in the character set'
);
});
Expand Down
Loading

0 comments on commit 409a2bb

Please sign in to comment.