Migrate from TSLint to ESLint
This commit is contained in:
155
.eslintrc.js
Normal file
155
.eslintrc.js
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
module.exports = {
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||||
|
"prettier/@typescript-eslint",
|
||||||
|
"plugin:prettier/recommended",
|
||||||
|
"plugin:import/errors",
|
||||||
|
"plugin:import/warnings",
|
||||||
|
"plugin:import/typescript"
|
||||||
|
],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"project": "tsconfig.json",
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint",
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/adjacent-overload-signatures": "error",
|
||||||
|
"@typescript-eslint/array-type": "error",
|
||||||
|
"@typescript-eslint/ban-types": "error",
|
||||||
|
"@typescript-eslint/class-name-casing": "error",
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "error",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "error",
|
||||||
|
"@typescript-eslint/explicit-function-return-type": "off",
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"accessibility": "explicit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/indent": "off",
|
||||||
|
"@typescript-eslint/interface-name-prefix": "error",
|
||||||
|
"@typescript-eslint/member-delimiter-style": [
|
||||||
|
"off",
|
||||||
|
{
|
||||||
|
"multiline": {
|
||||||
|
"delimiter": "none",
|
||||||
|
"requireLast": true
|
||||||
|
},
|
||||||
|
"singleline": {
|
||||||
|
"delimiter": "semi",
|
||||||
|
"requireLast": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/member-ordering": "off",
|
||||||
|
"@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-use-before-define": "off",
|
||||||
|
"@typescript-eslint/no-var-requires": "error",
|
||||||
|
"@typescript-eslint/prefer-for-of": "error",
|
||||||
|
"@typescript-eslint/prefer-function-type": "error",
|
||||||
|
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||||
|
"@typescript-eslint/quotes": "off",
|
||||||
|
"@typescript-eslint/semi": [
|
||||||
|
"off",
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"@typescript-eslint/space-within-parens": [
|
||||||
|
"off",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"@typescript-eslint/triple-slash-reference": "error",
|
||||||
|
"@typescript-eslint/type-annotation-spacing": "off",
|
||||||
|
"@typescript-eslint/unified-signatures": "error",
|
||||||
|
"arrow-body-style": "error",
|
||||||
|
"arrow-parens": [
|
||||||
|
"off",
|
||||||
|
"as-needed"
|
||||||
|
],
|
||||||
|
"camelcase": "error",
|
||||||
|
"comma-dangle": "off",
|
||||||
|
"complexity": "off",
|
||||||
|
"constructor-super": "error",
|
||||||
|
"curly": "error",
|
||||||
|
"dot-notation": "error",
|
||||||
|
"eol-last": "off",
|
||||||
|
"eqeqeq": [
|
||||||
|
"error",
|
||||||
|
"smart"
|
||||||
|
],
|
||||||
|
"guard-for-in": "off",
|
||||||
|
"id-blacklist": [
|
||||||
|
"error",
|
||||||
|
"any",
|
||||||
|
"Number",
|
||||||
|
"number",
|
||||||
|
"String",
|
||||||
|
"string",
|
||||||
|
"Boolean",
|
||||||
|
"boolean",
|
||||||
|
"Undefined"
|
||||||
|
],
|
||||||
|
"id-match": "error",
|
||||||
|
"linebreak-style": "off",
|
||||||
|
"max-classes-per-file": [
|
||||||
|
"error",
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"max-len": "off",
|
||||||
|
"new-parens": "off",
|
||||||
|
"newline-per-chained-call": "off",
|
||||||
|
"no-bitwise": "error",
|
||||||
|
"no-caller": "error",
|
||||||
|
"no-cond-assign": "error",
|
||||||
|
"no-console": "off",
|
||||||
|
"no-debugger": "error",
|
||||||
|
"no-empty": "error",
|
||||||
|
"no-eval": "error",
|
||||||
|
"no-extra-semi": "off",
|
||||||
|
"no-fallthrough": "off",
|
||||||
|
"no-invalid-this": "off",
|
||||||
|
"no-irregular-whitespace": "off",
|
||||||
|
"no-multiple-empty-lines": "off",
|
||||||
|
"no-new-wrappers": "error",
|
||||||
|
"no-shadow": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"hoist": "all"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-throw-literal": "error",
|
||||||
|
"no-trailing-spaces": "off",
|
||||||
|
"no-undef-init": "error",
|
||||||
|
"no-underscore-dangle": "warn",
|
||||||
|
"no-unsafe-finally": "error",
|
||||||
|
"no-unused-expressions": "error",
|
||||||
|
"no-unused-labels": "error",
|
||||||
|
"no-var": "error",
|
||||||
|
"object-shorthand": "error",
|
||||||
|
"one-var": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"prefer-const": "error",
|
||||||
|
"quote-props": "off",
|
||||||
|
"radix": "error",
|
||||||
|
"sort-imports": "warn",
|
||||||
|
"space-before-function-paren": "off",
|
||||||
|
"spaced-comment": "error",
|
||||||
|
"use-isnan": "error",
|
||||||
|
"valid-typeof": "off",
|
||||||
|
}
|
||||||
|
};
|
||||||
47
.vscode/settings.json
vendored
47
.vscode/settings.json
vendored
@@ -1,23 +1,28 @@
|
|||||||
{
|
{
|
||||||
"editor.renderWhitespace": "boundary",
|
"[javascript]": {
|
||||||
"files.encoding": "utf8",
|
"editor.formatOnSave": false
|
||||||
"files.trimTrailingWhitespace": true,
|
},
|
||||||
"files.insertFinalNewline": true,
|
"[json]": {
|
||||||
"search.exclude": {
|
"editor.formatOnSave": true
|
||||||
"_book/**": true,
|
},
|
||||||
".rpt2_cache/**": true,
|
"[typescript]": {
|
||||||
"dist/**": true,
|
"editor.formatOnSave": false
|
||||||
"node_modules/**": true,
|
},
|
||||||
"typings/**": true
|
"editor.codeActionsOnSave": {
|
||||||
},
|
"source.fixAll.eslint": true
|
||||||
"typescript.tsdk": "./node_modules/typescript/lib",
|
},
|
||||||
"[json]": {
|
"editor.formatOnSave": true,
|
||||||
"editor.formatOnSave": true
|
"editor.renderWhitespace": "boundary",
|
||||||
},
|
"files.encoding": "utf8",
|
||||||
"[javascript]": {
|
"files.insertFinalNewline": true,
|
||||||
"editor.formatOnSave": true
|
"files.trimTrailingWhitespace": true,
|
||||||
},
|
"search.exclude": {
|
||||||
"[typescript]": {
|
"_book/**": true,
|
||||||
"editor.formatOnSave": true
|
".rpt2_cache/**": true,
|
||||||
}
|
"dist/**": true,
|
||||||
|
"node_modules/**": true,
|
||||||
|
"typings/**": true
|
||||||
|
},
|
||||||
|
"typescript.tsdk": "./node_modules/typescript/lib",
|
||||||
|
"eslint.enable": true
|
||||||
}
|
}
|
||||||
|
|||||||
16
package.json
16
package.json
@@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"//": "If you add or change the names of destinations in screeps.json, make sure you update these scripts to reflect the changes",
|
"//": "If you add or change the names of destinations in screeps.json, make sure you update these scripts to reflect the changes",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "tslint -p tsconfig.json \"src/**/*.ts\"",
|
"lint": "eslint \"src/**/*.ts\"",
|
||||||
"build": "rollup -c",
|
"build": "rollup -c",
|
||||||
"push-main": "rollup -c --environment DEST:main",
|
"push-main": "rollup -c --environment DEST:main",
|
||||||
"push-pserver": "rollup -c --environment DEST:pserver",
|
"push-pserver": "rollup -c --environment DEST:pserver",
|
||||||
@@ -35,10 +35,17 @@
|
|||||||
"@types/screeps": "^3.0.0",
|
"@types/screeps": "^3.0.0",
|
||||||
"@types/sinon": "^5.0.5",
|
"@types/sinon": "^5.0.5",
|
||||||
"@types/sinon-chai": "^3.2.0",
|
"@types/sinon-chai": "^3.2.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^2.6.1",
|
||||||
|
"@typescript-eslint/parser": "^2.6.1",
|
||||||
|
"@typescript-eslint/typescript-estree": "^2.6.1",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
|
"eslint": "^6.6.0",
|
||||||
|
"eslint-config-prettier": "^6.5.0",
|
||||||
|
"eslint-plugin-import": "^2.20.0",
|
||||||
|
"eslint-plugin-prettier": "^3.1.1",
|
||||||
"lodash": "^3.10.1",
|
"lodash": "^3.10.1",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"prettier": "^1.14.0",
|
"prettier": "^1.19.1",
|
||||||
"rollup": "^0.63.4",
|
"rollup": "^0.63.4",
|
||||||
"rollup-plugin-buble": "^0.19.4",
|
"rollup-plugin-buble": "^0.19.4",
|
||||||
"rollup-plugin-clear": "^2.0.7",
|
"rollup-plugin-clear": "^2.0.7",
|
||||||
@@ -51,10 +58,7 @@
|
|||||||
"sinon": "^6.3.5",
|
"sinon": "^6.3.5",
|
||||||
"sinon-chai": "^3.2.0",
|
"sinon-chai": "^3.2.0",
|
||||||
"ts-node": "^7.0.1",
|
"ts-node": "^7.0.1",
|
||||||
"tslint": "^5.9.1",
|
"typescript": "^3.7.5"
|
||||||
"tslint-config-prettier": "^1.14.0",
|
|
||||||
"tslint-plugin-prettier": "^1.3.0",
|
|
||||||
"typescript": "^2.9.2"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"source-map": "~0.6.1"
|
"source-map": "~0.6.1"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrorMapper } from "utils/ErrorMapper";
|
import { ErrorMapper } from "./utils/ErrorMapper";
|
||||||
|
|
||||||
// When compiling TS to JS and bundling with rollup, the line numbers and file names in error messages change
|
// When compiling TS to JS and bundling with rollup, the line numbers and file names in error messages change
|
||||||
// This utility uses source maps to get the line numbers and file names of the original, TS source code
|
// This utility uses source maps to get the line numbers and file names of the original, TS source code
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "esnext",
|
|
||||||
"lib": ["esnext"],
|
|
||||||
"target": "es5",
|
|
||||||
"moduleResolution": "Node",
|
|
||||||
"outDir": "dist",
|
|
||||||
"baseUrl": "src/",
|
|
||||||
"sourceMap": true,
|
|
||||||
"strict": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"noImplicitReturns": true,
|
|
||||||
"noImplicitAny": false,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"allowUnreachableCode": false
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
21
tslint.json
21
tslint.json
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"rulesDirectory": "tslint-plugin-prettier",
|
|
||||||
"extends" : [
|
|
||||||
"tslint:recommended",
|
|
||||||
"tslint-config-prettier"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"forin": false,
|
|
||||||
"interface-name": [true, "never-prefix"],
|
|
||||||
"member-ordering": [false],
|
|
||||||
"no-console": [false],
|
|
||||||
"no-namespace": [true, "allow-declarations"],
|
|
||||||
"variable-name": [
|
|
||||||
true,
|
|
||||||
"ban-keywords",
|
|
||||||
"check-format",
|
|
||||||
"allow-pascal-case",
|
|
||||||
"allow-leading-underscore"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user