diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44ed933ab24..8f2626236c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: bash tools/ci/install_dreamchecker.sh - name: Run Linters run: | - find . -name "*.json" -not -path "*/node_modules/*" -print0 | xargs -0 python3 ./tools/ci/json_verifier.py + tools/ci/check_json.sh tools/ci/build_tgui.sh tools/ci/check_grep.sh python3 tools/ci/check_line_endings.py diff --git a/.vscode/settings.json b/.vscode/settings.json index c7a55cdc20c..ab8b9cdbf62 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,20 @@ }, "gitlens.advanced.blame.customArguments": [ "--ignore-revs-file", "${workspaceRoot}/.git-blame-ignore-revs" - ] + ], + // ESLint settings: + "eslint.workingDirectories": [ + "tgui/" + ], + "eslint.rules.customizations": [ + // We really want to fail the CI builds on styling errors, + // but it's better to show them as yellow squigglies in IDE + // and thus differentiate from the red typescript ones which + // are actually hard errors. + { "rule": "*", "severity": "warn" } + ], + "eslint.format.enable": true, + "[javascript]": { + "editor.defaultFormatter": "dbaeumer.vscode-eslint" + }, } diff --git a/tools/ci/check_json.sh b/tools/ci/check_json.sh new file mode 100755 index 00000000000..a5e4655d68c --- /dev/null +++ b/tools/ci/check_json.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -euo pipefail + +# We probably could validate literally everything as json5, but let's be cautions for no good reason here. +find .vscode/ -name "*.json" -print0 | xargs -0 python3 tools/ci/json_verifier.py -5 +find . -name "*.json" -not -path "*/node_modules/*" -and -not -path "./.vscode/*" -print0 | xargs -0 python3 tools/ci/json_verifier.py diff --git a/tools/ci/install_build_deps.sh b/tools/ci/install_build_deps.sh index dff6bb4a0d9..9118316d28c 100755 --- a/tools/ci/install_build_deps.sh +++ b/tools/ci/install_build_deps.sh @@ -7,4 +7,5 @@ source ~/.nvm/nvm.sh nvm install $NODE_VERSION nvm use $NODE_VERSION npm install --global yarn +python3 -m pip install json5 diff --git a/tools/ci/json_verifier.py b/tools/ci/json_verifier.py index aa746206674..14167fcb9a5 100644 --- a/tools/ci/json_verifier.py +++ b/tools/ci/json_verifier.py @@ -1,5 +1,9 @@ import sys -import json +if sys.argv[1:2] == ["-5"]: + import json5 as json + sys.argv.pop(1) +else: + import json if len(sys.argv) <= 1: exit(1)