diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000000000000000000000000000000000000..35f0578f7ebf917e68b55d834d01ee34139f9da0 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,45 @@ +{ + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"], + "parserOptions": { + "ecmaVersion": 9, + "ecmaFeatures": { + "jsx": false + }, + "project": "tsconfig.json" + }, + "env": { + "node": true, + "jasmine": true + }, + "extends": ["plugin:@typescript-eslint/recommended"], + "rules": { + "ordered-imports": "off", + "no-trailing-spaces": "error", + "max-classes-per-file": ["warn", 1], + "object-literal-sort-keys": "off", + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/prefer-for-of": "error", + "@typescript-eslint/typedef": "warn", + "@typescript-eslint/no-floating-promises": "error", + "curly": "error", + "no-empty": "off", + "no-invalid-this": "error", + "@typescript-eslint/no-throw-literal": "warn", + "prefer-const": "error", + "indent": ["error", 4], + "max-lines": ["warn", 500], + "no-duplicate-imports": "error", + "@typescript-eslint/array-type": "error", + "@typescript-eslint/promise-function-async": "error", + "no-bitwise": "error", + "no-debugger": "error", + "prefer-template": "error", + // Disable these as they were introduced by @typescript-eslint/recommended + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/member-delimiter-style": "off", + "@typescript-eslint/no-unused-expressions": "off" + } +} + \ No newline at end of file diff --git a/package.json b/package.json index 0f6c4cbadfdca0edc0502fc021d9a51d59b7915b..55f76538f0c17391e227e0d422dde4fa32dc9c84 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "discordas.js", "scripts": { "test": "npm run-script build && mocha build/test/config.js build/test", - "lint": "tslint --project ./tsconfig.json -t stylish", + "lint": "eslint -c .eslintrc --max-warnings 0 src/**/*.ts test/**/*.ts", "coverage": "tsc && nyc mocha build/test/config.js build/test", "build": "tsc", "postinstall": "npm run build", @@ -55,6 +55,8 @@ }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@typescript-eslint/eslint-plugin": "^2.14.0", + "@typescript-eslint/parser": "^2.14.0", "@types/chai": "^4.2.11", "@types/command-line-args": "^5.0.0", "@types/js-yaml": "^3.12.4", @@ -68,8 +70,8 @@ "proxyquire": "^1.7.11", "source-map-support": "^0.5.19", "ts-node": "^8.10.2", - "tslint": "^5.20.1", "typescript": "^3.9.5", - "why-is-node-running": "^2.2.0" + "why-is-node-running": "^2.2.0", + "eslint": "^7.4.0" } } diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 9b0ff6f8d641ed7cb9ae37cc0c24343e655e4306..0000000000000000000000000000000000000000 --- a/tslint.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "extends": "tslint:recommended", - "rules": { - "ordered-imports": false, - "no-trailing-whitespace": "error", - "max-classes-per-file": { - "severity": "warning" - }, - "object-literal-sort-keys": "off", - "no-any": true, - "arrow-return-shorthand": true, - "prefer-for-of": true, - "typedef": { - "severity": "warning" - }, - "await-promise": [true], - "curly": true, - "no-empty": false, - "no-invalid-this": true, - "no-string-throw": { - "severity": "warning" - }, - "no-unused-expression": true, - "prefer-const": true, - "indent": [true, "spaces", 4], - "max-file-line-count": { - "severity": "warning", - "options": [500] - }, - "no-duplicate-imports": true, - "array-type": [true, "array"], - "promise-function-async": true, - "no-bitwise": true, - "no-debugger": true, - "no-floating-promises": true, - "prefer-template": [true, "allow-single-concat"] - } -}