replace tslint (deprecated) with eslint

This commit is contained in:
Fred K. Schott
2019-10-13 16:41:11 -07:00
parent eb521faa8d
commit 9f183a6dfc
5 changed files with 836 additions and 554 deletions

24
.eslintrc.json Normal file
View File

@@ -0,0 +1,24 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"no-useless-constructor": 0,
"no-unused-vars": 0,
"no-prototype-builtins": 0,
"require-atomic-updates": 0
}
}

View File

@@ -31,9 +31,12 @@
},
"devDependencies": {
"@types/node": "11.13.0",
"@typescript-eslint/eslint-plugin": "^2.3.3",
"@typescript-eslint/parser": "^2.3.3",
"assert-diff": "^1.0.1",
"doctoc": "^0.15.0",
"ejs": "^2.3.4",
"eslint": "^6.5.1",
"eventemitter2": "^0.4.14",
"gulp": "^4.0.2",
"json-loader": "^0.5.2",
@@ -45,9 +48,7 @@
"source-map-support": "0.5.12",
"ts-loader": "^3.2.0",
"ts-node": "8.0.3",
"tslint": "^5.8.0",
"tslint-eslint-rules": "^4.1.1",
"typescript": "3.4.2",
"typescript": "^3.6.4",
"uglifyjs-webpack-plugin": "^1.1.4",
"webpack": "3.12.0"
},
@@ -60,7 +61,7 @@
"watch": "tsc -w",
"prepublish": "npm run clean && npm run compile && npm run build",
"test": "TS_NODE_PROJECT=src/tsconfig.json nyc mocha --exit",
"lint": "tslint -p ./",
"lint": "eslint src/**/*.ts",
"perf": "./scripts/perf_test.sh",
"start": "node scripts/http.js"
},

View File

@@ -17,7 +17,7 @@ function dropsToXrp(drops: string | BigNumber): string {
if (typeof drops === 'string') {
if (!drops.match(/^-?[0-9]*\.?[0-9]*$/)) {
throw new ValidationError(`dropsToXrp: invalid value '${drops}',` +
` should be a number matching (^-?[0-9]*\.?[0-9]*$).`)
` should be a number matching (^-?[0-9]*.?[0-9]*$).`)
} else if (drops === '.') {
throw new ValidationError(`dropsToXrp: invalid value '${drops}',` +
` should be a BigNumber or string-encoded number.`)
@@ -51,7 +51,7 @@ function xrpToDrops(xrp: string | BigNumber): string {
if (typeof xrp === 'string') {
if (!xrp.match(/^-?[0-9]*\.?[0-9]*$/)) {
throw new ValidationError(`xrpToDrops: invalid value '${xrp}',` +
` should be a number matching (^-?[0-9]*\.?[0-9]*$).`)
` should be a number matching (^-?[0-9]*.?[0-9]*$).`)
} else if (xrp === '.') {
throw new ValidationError(`xrpToDrops: invalid value '${xrp}',` +
` should be a BigNumber or string-encoded number.`)

View File

@@ -1,76 +0,0 @@
{
"extends": [
"tslint-eslint-rules"
],
"rules": {
"ban": [true, ["alert"]],
"no-arg": true,
"no-conditional-assignment": true,
"no-console": false,
"no-constant-condition": true,
"no-control-regex": true,
"no-debugger": true,
"no-duplicate-case": true,
"no-empty": true,
"no-empty-character-class": true,
"no-eval": true,
"no-ex-assign": true,
"no-extra-boolean-cast": true,
"no-extra-semi": true,
"no-switch-case-fall-through": true,
"no-inner-declarations": [true, "functions"],
"no-invalid-regexp": true,
// this rule would cause problems with mocha test cases,
"no-invalid-this": false,
"no-irregular-whitespace": true,
"ter-no-irregular-whitespace": true,
"label-position": true,
"indent": [true, "spaces", 2],
"linebreak-style": [true, "unix"],
"no-multi-spaces": true,
"no-consecutive-blank-lines": [true, 2],
"no-unused-expression": true,
"no-construct": true,
"no-duplicate-variable": true,
"no-regex-spaces": true,
"no-shadowed-variable": true,
"ter-no-sparse-arrays": true,
"no-trailing-whitespace": true,
"no-string-throw": true,
"no-unexpected-multiline": true,
"no-unused-variable": [true, {"ignore-pattern": "^_"}],
"no-use-before-declare": true,
"no-var-keyword": true,
"no-magic-numbers": false,
"array-bracket-spacing": [true, "never"],
"ter-arrow-body-style": false,
"ter-arrow-parens": [true, "as-needed"],
"ter-arrow-spacing": true,
"block-spacing": true,
"brace-style": [true, "1tbs", {"allowSingleLine": true}],
"variable-name": false,
"trailing-comma": [true, {"multiline": "never", "singleline": "never"}],
"cyclomatic-complexity": [false, 11],
"curly": [true, "all"],
"switch-default": false,
"eofline": true,
"triple-equals": true,
"forin": false,
"handle-callback-err": true,
"ter-max-len": [true, 120],
"new-parens": true,
"object-curly-spacing": [true, "never"],
"object-literal-shorthand": false,
"one-variable-per-declaration": [true, "ignore-for-loop"],
"ter-prefer-arrow-callback": false,
"prefer-const": true,
"object-literal-key-quotes": false,
"quotemark": [true, "single"],
"radix": true,
"semicolon": [true, "never"],
"space-in-parens": [true, "never"],
"comment-format": [true, "check-space"],
"use-isnan": true,
"valid-typeof": true
}
}

1277
yarn.lock

File diff suppressed because it is too large Load Diff