Skip to content

Commit

Permalink
Bump to eslint v9 and typescript 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
anoek committed Jul 18, 2024
1 parent 9b2ee67 commit e990481
Show file tree
Hide file tree
Showing 7 changed files with 658 additions and 393 deletions.
134 changes: 0 additions & 134 deletions .eslintrc.js

This file was deleted.

137 changes: 137 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import jsdoc from "eslint-plugin-jsdoc";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import prettier from "eslint-plugin-prettier";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"),
{
plugins: {
jsdoc,
"@typescript-eslint": typescriptEslint,
prettier,
},

languageOptions: {
globals: {
...globals.browser,
},

parser: tsParser,
ecmaVersion: 5,
sourceType: "module",

parserOptions: {
project: "tsconfig.json",
},
},

rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/no-floating-promises": "error",

"@typescript-eslint/no-inferrable-types": ["error", {
ignoreParameters: true,
ignoreProperties: true,
}],

"@typescript-eslint/no-unused-vars": ["error", {
varsIgnorePattern: "^_[a-zA-Z_]",
argsIgnorePattern: "^_[a-zA-Z_]",
}],

"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/semi": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"computed-property-spacing": ["error", "never"],
curly: "error",
"eol-last": "error",
eqeqeq: ["error", "smart"],

"id-denylist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined",
],

"id-match": "error",
"jsdoc/check-alignment": "error",
"jsdoc/require-asterisk-prefix": "error",
"linebreak-style": ["error", "unix"],
"no-caller": "error",
"no-cond-assign": "error",
"no-debugger": "error",
"no-eval": "error",

"no-fallthrough": ["error", {
commentPattern: "break[\\s\\w]*omitted",
}],

"@typescript-eslint/no-invalid-this": "error",

"no-multiple-empty-lines": ["error", {
max: 3,
}],

"no-new-wrappers": "error",
"no-tabs": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-unsafe-finally": "error",
"no-unused-labels": "error",
"no-var": "error",
"one-var": ["error", "never"],

"prefer-arrow-callback": ["error", {
allowNamedFunctions: true,
}],

"prettier/prettier": "error",
"use-isnan": "error",

"prefer-const": ["error", {
destructuring: "all",
}],
},
},
{
files: ["**/*.test.ts", "**/*.test.tsx"],

languageOptions: {
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
project: null,
},
},

rules: {
"@typescript-eslint/no-floating-promises": "off",
},
},
];
40 changes: 21 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gtp2ogs",
"version": "8.0.3",
"version": "8.0.4",
"homepage": "https://github.com/online-go/gtp2ogs",
"repository": {
"type": "git",
Expand All @@ -16,8 +16,8 @@
"gulp": "gulp",
"webpack-watch": "webpack --watch --progress --color",
"test": "jest",
"lint": "eslint src/ --ext=.ts",
"lint:fix": "eslint --fix src/ --ext=.ts",
"lint": "eslint src/",
"lint:fix": "eslint --fix src/",
"prettier": "prettier --write \"src/**/*.{ts}\"",
"prettier:check": "prettier --check \"src/**/*.{ts,}\"",
"typedoc": "typedoc src/config.ts"
Expand Down Expand Up @@ -46,33 +46,36 @@
},
"bin": "./dist/gtp2ogs.js",
"dependencies": {
"split2": "^4.1.0",
"tracer": "^1.1.6",
"bufferutil": "^4.0.7",
"goban": "=0.7.5",
"json5": "^2.2.3",
"jsonschema": "^1.4.1",
"goban": "=0.7.5",
"ws": "^8.13.0",
"bufferutil": "^4.0.7",
"utf-8-validate": "^6.0.3",
"source-map-support": "^0.5.21",
"split2": "^4.1.0",
"tracer": "^1.1.6",
"utf-8-validate": "^6.0.3",
"ws": "^8.13.0",
"yargs": "^17.7.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/eslint-plugin-tslint": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.7.0",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.5",
"@types/split2": "^3.2.1",
"@types/ws": "^8.5.4",
"@types/yargs": "^17.0.23",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"eslint": "^9.7.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^46.2.6",
"eslint-plugin-jsdoc": "^48.7.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unicorn": "^45.0.2",
"globals": "^15.8.0",
"gulp": "^4.0.2",
"gulp-eslint-new": "^1.7.2",
"gulp-sourcemaps": "^3.0.0",
Expand All @@ -82,16 +85,15 @@
"jest-transform-stub": "^2.0.0",
"jest-websocket-mock": "^2.4.0",
"pkg": "^5.8.1",
"prettier": "2.8.2",
"prettier-eslint": "^15.0.1",
"prettier": "3.1.1",
"prettier-eslint": "^16.3.0",
"sinon": "^9.0.2",
"ts-jest": "^29.0.5",
"ts-json-schema-generator": "^1.2.0",
"tslint": "^6.1.3",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typedoc": "^0.25.9",
"typescript": "=5.3.3",
"typescript": "=5.5.3",
"webpack": "^5.76.3",
"webpack-cli": "^5.0.1"
}
Expand Down
13 changes: 8 additions & 5 deletions src/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -836,11 +836,14 @@ export class Game extends EventEmitter<Events> {
this.sendChat("Maximum pause time reached, unpausing clock");
this.resumeGame();
} else {
this.unpause_timeout = setTimeout(() => {
this.unpause_timeout = undefined;
this.sendChat("Maximum pause time reached, unpausing clock");
this.resumeGame();
}, (config.max_pause_time - pause_duration_s) * 1000);
this.unpause_timeout = setTimeout(
() => {
this.unpause_timeout = undefined;
this.sendChat("Maximum pause time reached, unpausing clock");
this.resumeGame();
},
(config.max_pause_time - pause_duration_s) * 1000,
);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ function load_config_or_throw(): Config {
});
}

/* eslint-disable-next-line @typescript-eslint/no-var-requires */
/* @typescript-eslint/no-var-requires */
const contents = filename ? fs.readFileSync(filename, "utf8") : "{}";
const raw = JSON5.parse(contents);
const with_defaults = { ...defaults(), ...raw, ...from_cli };
Expand Down
Loading

0 comments on commit e990481

Please sign in to comment.