-- WoW Classic / TBC Anniversary / Retail multi-version luacheck config
-- Targets: Classic Era 1.15.8 (7x), TBC Anniversary 2.5.5, Retail 12.x

std = "lua51"
max_line_length = 160
unused_args = false
unused_globals = false
allow_defined_top = true

-- Ace3 libraries (read from)
read_globals = {
  "LibStub",
}

-- WoW global constants
globals = {
  -- Frame API
  "CreateFrame", "UIParent", "GameTooltip",
  "PlayerCastingBarFrame", "CastingBarFrame",

  -- Math / Lua helpers (WoW provides these globally for addons)
  "GetTime", "cos", "sin", "rad", "floor", "ceil",

  -- Unit API
  "UnitClass", "UnitGUID", "UnitAttackSpeed", "UnitRangedDamage",
  "UnitDamage", "UnitCastingInfo", "UnitChannelInfo", "UnitFactionGroup",
  "UnitIsPlayer", "UnitIsUnit",

  -- Spellbook (old globals — available on Classic 7x and 9x)
  "GetSpellCooldown", "GetSpellInfo", "GetSpellTabInfo",
  "GetNumSpellTabs", "GetSpellBookItemName", "GetSpellBookItemInfo",
  "BOOKTYPE_SPELL", "BOOKTYPE_PET",

  -- C_* namespace (available on Retail 12.x, partially on merged Classic)
  "C_Spell", "C_SpellBook", "C_AddOns", "C_CurveUtil",
  "C_Spell.DoesSpellExist", "C_Spell.GetSpellCooldown",
  "C_Spell.GetSpellInfo", "C_Spell.GetSpellCooldownDuration",

  -- Misc WoW API
  "CombatLogGetCurrentEventInfo",
  "GetCursorPosition", "GetSpecialization", "GetSpecializationRole",
  "GetBuildInfo", "GetAddOnInfo",
  "GetMouseFocus", "GetScreenWidth", "GetScreenHeight",
  "UnitAffectingCombat", "IsInRaid", "IsInGroup",

  -- WoW global tables / constants
  "Enum", "BackdropTemplate",
  "RAID_CLASS_COLORS", "TANK", "HEALER", "DAMAGER",

  -- Secure execution environment (Midnight / Retail)
  "secretwrap", "issecretvalue", "issecrettable",

  -- Error handling
  "geterrorhandler",

  -- Debug (may not exist on all versions)
  "debugstack",

  -- WoW utility globals
  "tinsert", "tremove", "CreateColor",
}

-- Suppress warnings about unused args in WoW event handlers
ignore = {
  "212", -- unused argument
  "311", -- value assigned to variable is unused (e.g. else-branch cleanup)
  "431", -- shadowing a local variable (common in WoW closures)
  "432", -- shadowing upvalue argument (common in WoW widget callbacks)
  "542", -- empty if branch (version migration placeholders)
}
