Merge branch 'main' into aperx

This commit is contained in:
2025-04-07 17:13:29 +09:00
10 changed files with 17 additions and 15 deletions

View File

@@ -20,12 +20,12 @@ jobs:
jq -s '.[0] * .[1].settings' temp.luarc.json ${{ github.workspace }}/factorio/config.json > check.luarc.json
- name: Install LuaLS
run: |
wget https://github.com/LuaLS/lua-language-server/releases/download/3.13.2/lua-language-server-3.13.2-linux-x64.tar.gz -q -O lusls.tar.gz
wget https://github.com/LuaLS/lua-language-server/releases/download/3.13.9/lua-language-server-3.13.9-linux-x64.tar.gz -q -O lusls.tar.gz
mkdir luals && tar -xf lusls.tar.gz -C luals && rm lusls.tar.gz
- name: Run Lint Report
shell: bash
run: |
./luals/bin/lua-language-server --check=. --logpath=. --configpath=check.luarc.json --checklevel=Information
./luals/bin/lua-language-server --check=. --logpath=. --configpath=check.luarc.json --checklevel=Information --check_out_path=check.json
# Credit to https://github.com/Krealle/luals-check-action/blob/main/action.yml
# Although some minor fixes were needed

View File

@@ -87,7 +87,7 @@ function GuiData._metatable.__index(self, key)
-- Check a given child table based on the object type
assert(type(key) == "userdata", "Index type '" .. ExpUtil.get_class_name(key) .. "' given to GuiData. Must be of type userdata.")
local object_name = key.object_name
local object_name = key.object_name --- @diagnostic disable-line assign-type-mismatch
if object_name == "LuaGuiElement" then
local data = self._raw.element_data
local player_elements = data and data[key.player_index]
@@ -110,7 +110,7 @@ end
--- @param value unknown
function GuiData._metatable.__newindex(self, key, value)
assert(type(key) == "userdata", "Index type '" .. ExpUtil.get_class_name(key) .. "' given to GuiData. Must be of type userdata.")
local object_name = key.object_name
local object_name = key.object_name --- @diagnostic disable-line assign-type-mismatch
if object_name == "LuaGuiElement" then
local data = self.element_data
local player_elements = data[key.player_index]

View File

@@ -37,6 +37,7 @@ local function nop() return nil, nil end
local function next_valid_element(elements, prev_index)
local element_index, element = next(elements, prev_index)
while element and not element.valid do
--- @cast element_index -nil
elements[element_index] = nil
element_index, element = next(elements, element_index)
end
@@ -61,6 +62,7 @@ local function next_valid_player(scope_elements, players, prev_index, online)
if index == nil then
return nil, nil, nil
end
--- @cast player -nil
if online == nil or player.connected == online then
local player_elements = scope_elements[player.index]

View File

@@ -280,7 +280,7 @@ local default = Roles.new_role("Guest", "")
"command/data-preference",
"command/connect",
"gui/player-list",
"gui/rocket-info",
--"gui/rocket-info",
"gui/science-info",
"gui/task-list",
"gui/warp-list",

View File

@@ -142,7 +142,7 @@ group:set_action('toggle_map_editor', false)
]]
function PermissionsGroups._prototype:set_action(action, state)
local input_action = defines.input_action[action]
local input_action = defines.input_action[action] --[[ @as defines.input_action? ]]
if input_action == nil then input_action = action end
assert(type(input_action) == "number", tostring(action) .. " is not a valid input action")
self.actions[input_action] = state

View File

@@ -16,9 +16,9 @@
"@clusterio/lib": "^2.0.0-alpha.19"
},
"devDependencies": {
"typescript": "^5.5.3",
"@clusterio/lib": "2.0.0-alpha.20",
"@types/node": "^20.4.5",
"@clusterio/lib": "^2.0.0-alpha.20"
"typescript": "^5.5.3"
},
"dependencies": {
"@expcluster/lib_commands": "workspace:*",

View File

@@ -34,7 +34,7 @@ local function get_server_id(server)
if server_count > 1 then
return false, { "exp-commands_connect.too-many-matching", concat(server_names, ", ") }
elseif server_count == 1 then
local server_id, server_details = next(servers)
local server_id, server_details = next(servers) --- @cast server_details -nil
local status = External.get_server_status(server_id)
if server_id == current_server.id then
return false, { "exp-commands_connect.same-server", server_details.name }

View File

@@ -16,17 +16,17 @@
"@clusterio/lib": "^2.0.0-alpha.19"
},
"devDependencies": {
"typescript": "^5.5.3",
"@clusterio/lib": "2.0.0-alpha.20",
"@clusterio/web_ui": "2.0.0-alpha.20.b",
"@types/node": "^20.4.5",
"@types/react": "^18.2.21",
"antd": "^5.13.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.5.3",
"webpack": "^5.98.0",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.9.0",
"@clusterio/web_ui": "^2.0.0-alpha.20.b",
"@clusterio/lib": "^2.0.0-alpha.20"
"webpack-merge": "^5.9.0"
},
"dependencies": {
"@expcluster/lib_commands": "workspace:*",

View File

@@ -42,7 +42,7 @@ local function check_type(value, type_name)
if type_name == "userdata" then
return false, value_type
end
value_type = value.object_name
value_type = value.object_name --- @diagnostic disable-line assign-type-mismatch
elseif value_type == "table" then
if type_name == "table" then
return false, value_type

View File

@@ -16,7 +16,7 @@
"@clusterio/lib": "^2.0.0-alpha.19"
},
"devDependencies": {
"@clusterio/lib": "^2.0.0-alpha.20",
"@clusterio/lib": "2.0.0-alpha.20",
"@types/node": "^20.14.9",
"typescript": "^5.5.3"
},