Skip to content

How to check "no-unknown" equivalent from lua-language-server - assert every variable/function is typed #964

@dquixote-jr

Description

@dquixote-jr

Problem

The following file (test.lua) returns no errors when doing a check with emmylua_check -c ./.emmyrc.json --warnings-as-errors test.lua:

local function do_add(x, y)
  return x + y
end

return do_add

My .emmyrc.json is as follows:

{
  "format": {
    "externalTool": {
      "program": "stylua",
      "args": ["-", "--stdin-filepath", "${file}"]
    }
  },
  "runtime": {
    "version": "LuaJIT"
  },
  "diagnostics": {
    "globals": ["ngx"],
    "disable": ["unnecessary-if", "invert-if"]
  }
}

Expected behaviour

That emmylua_check should return an error when there is a function which is not typed.

Notes

I'm trying to make sure everything is typed properly in my code base but I'm not seeing any way to do that for functions. Is there any way or workaround to do this right now?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions