-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to let luacheck know about/find imported files? #68
Comments
Luacheck doesn't evaluate code. In order to do what you are suggesting it would have to be a Lua VM and run the code — there would be no other way to effectively catch all the ways code could be loaded. This isn't going to happen. The way to deal with these warnings in your project is to define an allowed list of globals in your |
That makes sense. I was thinking more of a parsing solution where
That's the direction I was heading in. I just wanted to make sure I wasn't doing anything stupid before adding the entire SDK to my
I simplified the case but just running luacheck from the cmdline without any config file and you are correct those are not causing warnings anymore. So my
|
Try not overwriting the std = "min",
globals = { "playdate" }, -- these globals can be set and accessed.
read_globals = { "import" } -- these globals can only be accessed. Change If there are more things in the SDK that aren't covered by those presets, rather than you adding the whole SDK to a preference file lets setup a custom set of standards. For example we have existing ones for LÖVE and NGX as well as a busted mixing to add to any of the above. See the Also |
The "follow imports" issue is basically the same as #36 and won't be addressed. Adding a set of defaults for Playdate is definitely something we'd consider. I'd be happy to facilitate a PR that added support similarly to the way LÖVE or others are handled. Feel free to open a tracking issue specific to that and/or submit a PR. |
I'd be happy to look into that. Thanks for the help and keep up the great work. |
When using something like the Playdate SDK, a given Lua file will import others like so:
but it seems like luacheck doesn't support/know about the
import
statement and therefore those files are ignored. This generates incorrect warnings like so:What is the best way to make luacheck aware of what those import files contain?
The text was updated successfully, but these errors were encountered: