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 2f9e6f0
Show file tree
Hide file tree
Showing 5 changed files with 1,333 additions and 140 deletions.
188 changes: 119 additions & 69 deletions .eslintrc
@@ -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
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
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
2 changes: 2 additions & 0 deletions test/test-iso-8859-1.ts
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 Down

0 comments on commit 2f9e6f0

Please sign in to comment.