mirror of
https://github.com/leafo/moonscript.git
synced 2025-01-09 00:04:22 +00:00
Merge branch 'master' of https://github.com/leafo/moonscript into compile_for_lua5.3
This commit is contained in:
commit
ea129603c8
@ -314,16 +314,22 @@ if opts.w then
|
||||
|
||||
io.stderr:write("\nQuitting...\n")
|
||||
elseif opts.l then
|
||||
local has_linted_with_error;
|
||||
local lint = require "moonscript.cmd.lint"
|
||||
for _, tuple in pairs(files) do
|
||||
local fname = tuple[1]
|
||||
local res, err = lint.lint_file(fname)
|
||||
if res then
|
||||
has_linted_with_error = true
|
||||
io.stderr:write(res .. "\n\n")
|
||||
elseif err then
|
||||
has_linted_with_error = true
|
||||
io.stderr:write(fname .. "\n" .. err.. "\n\n")
|
||||
end
|
||||
end
|
||||
if has_linted_with_error then
|
||||
os.exit(1)
|
||||
end
|
||||
else
|
||||
for _, tuple in ipairs(files) do
|
||||
local fname, target = util.unpack(tuple)
|
||||
|
@ -134,11 +134,14 @@ A full list of flags can be seen by passing the `-h` or `--help` flag.
|
||||
|
||||
`moonc` contains a [lint][1] tool for statically detecting potential problems
|
||||
with code. The linter has two tests: detects accessed global variables,
|
||||
detect unused declared variables.
|
||||
detect unused declared variables. If the linter detects any issues with a file,
|
||||
the program will exit with a status of `1`.
|
||||
|
||||
You can execute the linter with the `-l` flag. When the linting flag is
|
||||
provided only linting takes place and no compiled code is generated.
|
||||
|
||||
The linter is compatible with the watch mode (see above) for automatic linting.
|
||||
|
||||
```bash
|
||||
moonc -l file1.moon file2.moon
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user