From 4e342fb3a925e3e5a1cd5f135c66a12228c46d6d Mon Sep 17 00:00:00 2001 From: Jack Taylor Date: Wed, 20 Dec 2023 23:29:53 -0800 Subject: [PATCH] fix selene lints --- example/src/client/systems/roombasHurt.lua | 2 +- example/src/client/systems/spinSpinners.lua | 2 +- example/src/server/systems/roombasMove.lua | 2 +- .../src/server/systems/spawnMotherships.lua | 4 +-- example/src/server/systems/spawnRoombas.lua | 2 +- lib/Loop.spec.lua | 28 +++++++++---------- lib/debugger/mouseHighlight.lua | 1 - lib/debugger/widgets/selectionList.lua | 2 +- lib/debugger/widgets/worldInspect.lua | 2 +- lib/hooks/useEvent.spec.lua | 4 +-- selene.toml | 3 ++ 11 files changed, 27 insertions(+), 25 deletions(-) diff --git a/example/src/client/systems/roombasHurt.lua b/example/src/client/systems/roombasHurt.lua index b33d466..f8647ae 100644 --- a/example/src/client/systems/roombasHurt.lua +++ b/example/src/client/systems/roombasHurt.lua @@ -4,7 +4,7 @@ local Components = require(ReplicatedStorage.Shared.components) local Matter = require(ReplicatedStorage.Lib.Matter) local function roombasHurt(world) - for id, roomba, model in world:query(Components.Roomba, Components.Model) do + for _, _, model in world:query(Components.Roomba, Components.Model) do for _, part in Matter.useEvent(model.model.PrimaryPart, "Touched") do local touchedModel = part:FindFirstAncestorWhichIsA("Model") if not touchedModel then diff --git a/example/src/client/systems/spinSpinners.lua b/example/src/client/systems/spinSpinners.lua index a76cea7..7170f4e 100644 --- a/example/src/client/systems/spinSpinners.lua +++ b/example/src/client/systems/spinSpinners.lua @@ -10,7 +10,7 @@ local function spinSpinners(world, _, ui) local randomize = ui.button("Randomize colors!"):clicked() - for id, model in world:query(Components.Model, Components.Spinner) do + for _, model in world:query(Components.Model, Components.Spinner) do model.model.PrimaryPart.CFrame = model.model.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(5), 0) model.model.PrimaryPart.Transparency = transparency diff --git a/example/src/server/systems/roombasMove.lua b/example/src/server/systems/roombasMove.lua index 38fa52b..e549885 100644 --- a/example/src/server/systems/roombasMove.lua +++ b/example/src/server/systems/roombasMove.lua @@ -7,7 +7,7 @@ local function roombasMove(world) table.insert(targets, model.model.PrimaryPart.CFrame.p) end - for id, roomba, charge, model in world:query(Components.Roomba, Components.Charge, Components.Model) do + for _, _, charge, model in world:query(Components.Roomba, Components.Charge, Components.Model) do if charge.charge <= 0 then continue end diff --git a/example/src/server/systems/spawnMotherships.lua b/example/src/server/systems/spawnMotherships.lua index eabfb4d..e6d464f 100644 --- a/example/src/server/systems/spawnMotherships.lua +++ b/example/src/server/systems/spawnMotherships.lua @@ -23,7 +23,7 @@ local function spawnMotherships(world) ) end - for id, transform in world:query(Components.Transform, Components.Mothership):without(Components.Model) do + for id in world:query(Components.Transform, Components.Mothership):without(Components.Model) do local model = ReplicatedStorage.Assets.Mothership:Clone() model.Parent = workspace model.PrimaryPart:SetNetworkOwner(nil) @@ -57,7 +57,7 @@ local function spawnMotherships(world) end end - for id, mothership, model in world:query(Components.Mothership, Components.Model):without(Components.Lasering) do + for _, mothership, model in world:query(Components.Mothership, Components.Model):without(Components.Lasering) do model.model.Roomba.AlignPosition.Position = mothership.goal end end diff --git a/example/src/server/systems/spawnRoombas.lua b/example/src/server/systems/spawnRoombas.lua index 769f3fa..95abe9f 100644 --- a/example/src/server/systems/spawnRoombas.lua +++ b/example/src/server/systems/spawnRoombas.lua @@ -2,7 +2,7 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage") local Components = require(ReplicatedStorage.Shared.components) local function spawnRoombas(world) - for id, transform in world:query(Components.Transform, Components.Roomba):without(Components.Model) do + for id, _ in world:query(Components.Transform, Components.Roomba):without(Components.Model) do local model = ReplicatedStorage.Assets.KillerRoomba:Clone() model.Parent = workspace model.PrimaryPart:SetNetworkOwner(nil) diff --git a/lib/Loop.spec.lua b/lib/Loop.spec.lua index e0100c8..49ab9d7 100644 --- a/lib/Loop.spec.lua +++ b/lib/Loop.spec.lua @@ -167,15 +167,15 @@ return function() it("should throw error for systems with unscheduled depedencies", function() local loop = Loop.new() - local order = {} + local _order = {} local systemA = { system = function() - table.insert(order, "a") + table.insert(_order, "a") end, } local systemB = { system = function() - table.insert(order, "b") + table.insert(_order, "b") end, after = { systemA }, } @@ -197,15 +197,15 @@ return function() it("should throw error for system if dependency is evicted", function() local loop = Loop.new() - local order = {} + local _order = {} local systemA = { system = function() - table.insert(order, "a") + table.insert(_order, "a") end, } local systemB = { system = function() - table.insert(order, "b") + table.insert(_order, "b") end, after = { systemA }, } @@ -221,10 +221,10 @@ return function() it("should throw error for system with empty after table", function() local loop = Loop.new() - local order = {} + local _order = {} local systemA = { system = function() - table.insert(order, "a") + table.insert(_order, "a") end, after = {}, } @@ -239,22 +239,22 @@ return function() it("should throw error for systems with cyclic dependency", function() local loop = Loop.new() - local order = {} + local _order = {} local systemC = {} local systemA = { system = function() - table.insert(order, "a") + table.insert(_order, "a") end, after = { systemC }, } local systemB = { system = function() - table.insert(order, "b") + table.insert(_order, "b") end, after = { systemA, systemC }, } systemC.system = function() - table.insert(order, "c") + table.insert(_order, "c") end systemC.after = { systemA, systemB } @@ -270,10 +270,10 @@ return function() it("should throw error for systems with both after and priority defined", function() local loop = Loop.new() - local order = {} + local _order = {} local systemA = { system = function() - table.insert(order, "a") + table.insert(_order, "a") end, priority = 1, after = {}, diff --git a/lib/debugger/mouseHighlight.lua b/lib/debugger/mouseHighlight.lua index bfc22a4..a5f8007 100644 --- a/lib/debugger/mouseHighlight.lua +++ b/lib/debugger/mouseHighlight.lua @@ -1,4 +1,3 @@ -local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") diff --git a/lib/debugger/widgets/selectionList.lua b/lib/debugger/widgets/selectionList.lua index 63e3c1a..b031e74 100644 --- a/lib/debugger/widgets/selectionList.lua +++ b/lib/debugger/widgets/selectionList.lua @@ -1,7 +1,7 @@ return function(Plasma) local create = Plasma.create - local Item = Plasma.widget(function(text, selected, icon, sideText, width) + local Item = Plasma.widget(function(text, selected, icon, sideText) local clicked, setClicked = Plasma.useState(false) local style = Plasma.useStyle() diff --git a/lib/debugger/widgets/worldInspect.lua b/lib/debugger/widgets/worldInspect.lua index 7cc130f..a233773 100644 --- a/lib/debugger/widgets/worldInspect.lua +++ b/lib/debugger/widgets/worldInspect.lua @@ -42,7 +42,7 @@ return function(plasma) setCache(cache) - for entityId, entityData in world do + for _, entityData in world do for component in entityData do cache.uniqueComponents[component] = (cache.uniqueComponents[component] or 0) + 1 end diff --git a/lib/hooks/useEvent.spec.lua b/lib/hooks/useEvent.spec.lua index 95a5d70..9078971 100644 --- a/lib/hooks/useEvent.spec.lua +++ b/lib/hooks/useEvent.spec.lua @@ -1,6 +1,6 @@ +local BindableEvent = require(script.Parent.Parent.mock.BindableEvent) local topoRuntime = require(script.Parent.Parent.topoRuntime) local useEvent = require(script.Parent.useEvent) -local BindableEvent = require(script.Parent.Parent.mock.BindableEvent) return function() describe("useEvent", function() @@ -112,7 +112,7 @@ return function() } local event = { - connect = function(self, handler) + connect = function(_, handler) eventHandler = handler return { diff --git a/selene.toml b/selene.toml index 27c3b76..e4cfd94 100644 --- a/selene.toml +++ b/selene.toml @@ -2,3 +2,6 @@ std = "roblox+testez" [rules] shadowing = "allow" + +# Plasma's API encourages using mixed tables, so we kind of have to allow it +mixed_table = "allow"