Skip to content

Commit

Permalink
lint: formatting and fix prettier since nlohmann::json's jsonc parser…
Browse files Browse the repository at this point in the history
… doesn't like trailing commas!

prettier/prettier#15553
  • Loading branch information
xTVaser committed Jan 16, 2024
1 parent 5d2cbad commit 50e398b
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 20 deletions.
1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"endOfLine": "auto",
"overrides": [
{
"files": ["**/*.jsonc"],
"options": {
"parser": "json"
}
}
]
}
17 changes: 8 additions & 9 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,23 @@ tasks:
msg: "Couldn't locate compiler executable in '{{.GOALC_BIN_RELEASE_DIR}}/goalc'"
cmds:
- "{{.GOALC_BIN_RELEASE_DIR}}/goalc --user-auto --game {{.GAME}}"
format:
format-json:
desc: "Format code"
cmds:
- cmd: python ./scripts/cpp/format-includes.py
- cmd: python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test tools lsp -i
# npm install -g prettier
- cmd: npx prettier --write ./decompiler/config/jak1/**/*.jsonc
ignore_error: true
- cmd: npx prettier --write ./decompiler/config/jak2/**/*.jsonc
ignore_error: true
format-json:
- cmd: npx prettier --write ./decompiler/config/jak3/**/*.jsonc
ignore_error: true
format:
desc: "Format code"
cmds:
# npm install -g prettier
- cmd: npx prettier --write ./decompiler/config/jak1/**/*.jsonc
ignore_error: true
- cmd: npx prettier --write ./decompiler/config/jak2/**/*.jsonc
ignore_error: true
- cmd: python ./scripts/cpp/format-includes.py
- cmd: python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test tools lsp -i
- task: format-json

# DECOMPILING
decomp:
cmds:
Expand Down
3 changes: 2 additions & 1 deletion decompiler/analysis/analyze_inspect_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,8 @@ void inspect_top_level_for_metadata(Function& top_level,
if (temp_as_str.find("call!") != std::string::npos) {
break;
}
auto temp_label_match = get_regex_match(temp_as_str, std::regex("\\(set!\\s[^\\s]*\\s(L.*)\\)"));
auto temp_label_match =
get_regex_match(temp_as_str, std::regex("\\(set!\\s[^\\s]*\\s(L.*)\\)"));
if (!temp_label_match.empty()) {
was_another_label = true;
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
11 changes: 9 additions & 2 deletions decompiler/config/jak3/ntsc_v1/hacks.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -755,14 +755,21 @@
"generic-warp-dest",
"generic-warp-envmap-dest",
"generic-no-light-proc"

],

"mips2c_jump_table_functions": {},

// there are some missing textures. I don't know what the game actually does here.
// the format for entries is [level, tpage, index]
"missing_textures": [["lfac", 0, 0], ["ltow", 0, 0], ["lcit", 0, 0], ["pow", 0, 0], ["wasintro", 0, 0], ["lfacctyb", 0, 0], ["intpfall", 0, 0]],
"missing_textures": [
["lfac", 0, 0],
["ltow", 0, 0],
["lcit", 0, 0],
["pow", 0, 0],
["wasintro", 0, 0],
["lfacctyb", 0, 0],
["intpfall", 0, 0]
],

// some object files have garbage pad data at the end which makes the decompiler
// assume they must be different files, such as the art group for orb-cache-top.
Expand Down
4 changes: 2 additions & 2 deletions decompiler/config/jak3/ntsc_v1/inputs.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// most objects are part of CGO/DGO files (both go in dgo_names). This includes levels and the engine
// the DGOs will be processed in this order. Usually it's best to have KERNEL, ENGINE, then the levels when
// you want to run on the entire game.
"dgo_names":[
"dgo_names": [
//"CGO/ART.CGO",
"CGO/KERNEL.CGO",
// "CGO/ENGINE.CGO",
Expand Down Expand Up @@ -285,7 +285,7 @@
"DGO/LCTYPROT.DGO",
"DGO/DESHOVER.DGO",
"DGO/DESBOSS2.DGO"
],
],

// some objects are part of STR files (streaming data).
"str_file_names": [],
Expand Down
2 changes: 1 addition & 1 deletion decompiler/config/jak3/ntsc_v1/label_types.jsonc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
2 changes: 1 addition & 1 deletion decompiler/config/jak3/ntsc_v1/stack_structures.jsonc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
2 changes: 1 addition & 1 deletion decompiler/config/jak3/ntsc_v1/type_casts.jsonc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
2 changes: 1 addition & 1 deletion decompiler/config/jak3/ntsc_v1/var_names.jsonc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}

0 comments on commit 50e398b

Please sign in to comment.