Skip to content

Commit

Permalink
Merge pull request online-go#2444 from online-go/strict
Browse files Browse the repository at this point in the history
Cleanup to enable various stricter typescript features
  • Loading branch information
anoek authored Dec 17, 2023
2 parents 7bb8ea9 + ea44956 commit 788046a
Show file tree
Hide file tree
Showing 294 changed files with 5,249 additions and 4,238 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ webpack-stats.json
analyze.json
stats.json
src/components/base
.vscode
todo
yarn-error.log
deployment-staging-area
Expand All @@ -17,8 +16,7 @@ how_to_add_a_new_language.txt
/.alm/
package-lock.json
report.*.json


neovide_backtraces.log

i18n/data/
i18n/import/
Expand Down
2 changes: 1 addition & 1 deletion .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-checkout'.\n"; exit 2; }
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-checkout "$@"
2 changes: 1 addition & 1 deletion .husky/post-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-commit'.\n"; exit 2; }
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-commit "$@"
2 changes: 1 addition & 1 deletion .husky/post-merge
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-merge'.\n"; exit 2; }
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-merge "$@"
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/pre-push'.\n"; exit 2; }
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs pre-push "$@"
1 change: 1 addition & 0 deletions .vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.log
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
"dbaeumer.vscode-eslint",
"sysoev.language-stylus",
"streetsidesoftware.code-spell-checker"
],
}
146 changes: 146 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"cSpell.words": [
"abcdefghjklmnopqrstuvwxyz",
"AILR",
"aireview",
"annulable",
"anoek",
"apikey",
"appinfo",
"automatch",
"automatcher",
"automatchers",
"automod",
"autoplaying",
"autoscore",
"Autoscoring",
"autoscroll",
"autoscrolling",
"Baduk",
"badukpop",
"benjito",
"bitfield",
"boardsize",
"byoyomi",
"cacheable",
"chillout",
"clearpen",
"covay",
"crosshairs",
"csrfmiddlewaretoken",
"csrftoken",
"cssnano",
"DATETIME",
"dedup",
"deinit",
"deinitialize",
"Dismissable",
"dont",
"DOTCSS",
"DOTJS",
"enableable",
"Errcode",
"fakelink",
"fuggly",
"Fuseki",
"gamedata",
"gamelist",
"gettext",
"glicko",
"goban",
"Gobans",
"goquest",
"groupify",
"hane",
"Heatmaps",
"hostinfo",
"icontains",
"iframes",
"inet",
"istartswith",
"JGOF",
"JGOFAI",
"joseki",
"josekipedia",
"josekis",
"jsonify",
"Kata",
"katago",
"kidsgoserver",
"kyus",
"Leela",
"lerp",
"localstorage",
"malkovich",
"MDPI",
"meijin",
"merchantlog",
"minigoban",
"misclick",
"misclicks",
"modlog",
"msgid",
"ngettext",
"nochallenge",
"nodetails",
"noextracontrols",
"nolink",
"npgettext",
"nums",
"offtopic",
"omnisearch",
"opengotha",
"pgettext",
"playouts",
"pluralidx",
"postback",
"rengo",
"replot",
"roundrobin",
"rrule",
"seekgraph",
"Seki",
"semeai",
"sepa",
"shadowban",
"shadowbanned",
"shownotesindicator",
"Sitewide",
"slowstrobe",
"sodos",
"styl",
"sublicensable",
"subprops",
"subselect",
"subtool",
"superchat",
"superko",
"swal",
"sweetalert",
"tenuki",
"testuser",
"tesuji",
"Timecop",
"tock",
"traceback",
"tsumegodojo",
"tygem",
"tzoffset",
"uffizzi",
"unannulable",
"unhighlight",
"unitify",
"Unranked",
"unstarted",
"uservoice",
"usgc",
"wbaduk",
"Weiqi",
"xgettext",
"yesno",
"yike",
"yomi",
"zoomable"
],
"cSpell.language": "en,en-GB"
}
47 changes: 24 additions & 23 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,20 @@ function dev_server(done) {
let http = require("http");
var proxy = require("express-http-proxy");
let url = require("url");
let devserver = express();
devserver.use(body_parser.json());
devserver.use(body_parser.text());
let dev_server = express();
dev_server.use(body_parser.json());
dev_server.use(body_parser.text());

http.createServer(devserver).listen(port, null, function () {
http.createServer(dev_server).listen(port, null, function () {
console.info(`#############################################`);
console.info(`## Development server started on port ${port}`);
console.info(`## ( http://localhost:${port} )`);
console.info(`## pointing at ${BACKEND} (${server_url})`);
console.info(`#############################################`);
});

devserver.use(express.static("dist"));
devserver.use(express.static("assets"));
dev_server.use(express.static("dist"));
dev_server.use(express.static("assets"));

// Based on https://github.com/villadora/express-http-proxy/issues/127
const isMultipartRequest = (req) => {
Expand Down Expand Up @@ -237,19 +237,19 @@ function dev_server(done) {
},
});

devserver.use("/api", backend_proxy("/api"));
devserver.use("/termination-api", backend_proxy("/termination-api"));
devserver.use("/merchant", backend_proxy("/merchant"));
devserver.use("/billing", backend_proxy("/billing"));
devserver.use("/sso", backend_proxy("/sso"));
devserver.use("/oauth2", backend_proxy("/oauth2"));
devserver.use("/complete", backend_proxy("/complete"));
devserver.use("/disconnect", backend_proxy("/disconnect"));
devserver.use("/OGSScoreEstimator", backend_proxy("/OGSScoreEstimator"));
devserver.use("/oje", backend_proxy("/oje"));
devserver.use("/firewall", backend_proxy("/firewall"));

devserver.get("/locale/*", (req, res) => {
dev_server.use("/api", backend_proxy("/api"));
dev_server.use("/termination-api", backend_proxy("/termination-api"));
dev_server.use("/merchant", backend_proxy("/merchant"));
dev_server.use("/billing", backend_proxy("/billing"));
dev_server.use("/sso", backend_proxy("/sso"));
dev_server.use("/oauth2", backend_proxy("/oauth2"));
dev_server.use("/complete", backend_proxy("/complete"));
dev_server.use("/disconnect", backend_proxy("/disconnect"));
dev_server.use("/OGSScoreEstimator", backend_proxy("/OGSScoreEstimator"));
dev_server.use("/oje", backend_proxy("/oje"));
dev_server.use("/firewall", backend_proxy("/firewall"));

dev_server.get("/locale/*", (req, res) => {
let options = {
hostname: "storage.googleapis.com",
port: 80,
Expand Down Expand Up @@ -277,7 +277,7 @@ function dev_server(done) {
req2.end();
});

devserver.get("/goban.js", (req, res) => {
dev_server.get("/goban.js", (req, res) => {
console.info(`GET ${req.path} -> node_modules/goban/lib/goban.js`);
let js = fs.readFileSync("node_modules/goban/lib/goban.js", { encoding: "utf-8" });
res.setHeader("Content-Type", "application/javascript; charset=utf-8");
Expand All @@ -288,7 +288,7 @@ function dev_server(done) {
res.status(200).send(js);
});

devserver.get("/goban.js.map", (req, res) => {
dev_server.get("/goban.js.map", (req, res) => {
console.info(`GET ${req.path} -> node_modules/goban/lib/goban.js.map`);
let js = fs.readFileSync("node_modules/goban/lib/goban.js.map", { encoding: "utf-8" });
res.setHeader("Content-Type", "application/javascript; charset=utf-8");
Expand All @@ -299,7 +299,7 @@ function dev_server(done) {
res.status(200).send(js);
});

devserver.get("/index.js.map", (req, res) => {
dev_server.get("/index.js.map", (req, res) => {
let js = fs.readFileSync("node_modules/goban/lib/index.js.map", { encoding: "utf-8" });
res.setHeader("Content-Type", "application/javascript; charset=utf-8");
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
Expand All @@ -309,7 +309,7 @@ function dev_server(done) {
res.status(200).send(js);
});

devserver.get("*", (req, res) => {
dev_server.get("*", (req, res) => {
console.info(`GET ${req.path}`);

if (req.path === "ogs.js") {
Expand Down Expand Up @@ -370,6 +370,7 @@ function dev_server(done) {
return JSON.stringify(supported_languages);

case "AMEX_CLIENT_ID":
/* cspell: disable-next-line */
return "kvEB9qXE6jpNUv3fPkdbWcPaZ7nQAXyg";
case "AMEX_ENV":
return "qa";
Expand Down
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,30 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.2.0",
"@types/jest": "^29.5.0",
"@types/valid-url": "^1.0.7",
"@types/react-linkify": "^1.0.4",
"@types/testing-library__jest-dom": "^5.14.5",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/eslint-plugin-tslint": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/eslint-plugin-tslint": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"autoprefixer": "^10.4.16",
"body-parser": "^1.16.1",
"circular-dependency-plugin": "^5.2.2",
"css-what": "^6.1.0",
"cssnano": "^6.0.1",
"deepl-node": "^1.10.1",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^46.9.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unicorn": "^48.0.1",
"eslint-plugin-unicorn": "^49.0.0",
"express": "^4.18.2",
"express-http-proxy": "^2.0.0",
"fork-ts-checker-webpack-plugin": "^9.0.0",
"goban": "=0.7.20",
"goban": "=0.7.25",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.3.0",
"gulp-eslint-new": "^1.8.4",
Expand All @@ -69,16 +71,16 @@
"pofile": "^1.1.0",
"postcss": "^8.4.16",
"postcss-inline-svg": "^5.0.0",
"prettier": "3.0.3",
"prettier-eslint": "^16.1.1",
"prettier": "3.1.1",
"prettier-eslint": "^16.1.2",
"pump": "^3.0.0",
"source-map-loader": "^4.0.0",
"stylus": "0.60.0",
"supervisor": "^0.12.0",
"ts-jest": "^29.1.1",
"ts-loader": "^9.5.0",
"tslint": "^6.1.3",
"typescript": "<5.3",
"typescript": "=5.3.3",
"webpack": "^5.89.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^5.1.4",
Expand Down
Loading

0 comments on commit 788046a

Please sign in to comment.