Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
New linter #299
New linter #299
Conversation
The new linter is capable of detecting a lot more possible issues with Moonscript compared to the current one. Similarly to the old linter, it detects unused variables and undeclared global usages. It does however detect unused declarations in a lot more contexts, such as import lists, destructuring statements, for loops, parameter lists, etc. The new linter also warns for shadowing declarations, i.e. a declaration of a variable where a previous declaration already exists higher up in a scope.
|
Just a note: This is now out of date with the standalone moonpick implementation, which has had more checks added since the opening of this PR. |
This replace the current linter with the new moonpick linter. The new linter works against the parse tree instead of piggybacking on the compile process. Similarly to the old linter it detects global accesses and declared but unused variables. When it comes to unused variables it handles a lot more constructs, detecting unused variables resulting from destructuring statements, imports, etc. It also detects unused variables resulting from unused parameter declarations as well loop variable declarations. Another form of detection lacking altogether in the current linter is shadowing declarations, where a variable declaration of some sort shadows an existing declaration in an outer scope.
This PR removes the current
cmd.lintmodule, replacing it with a newlintmodule. It also adds alint_config.moonand updates the current code to be lint clean for the new linter (two separate commits).Things to consider / be aware of are:
cmd.lintmodule is removed. This was never advertised as a public API (AFAIK), but nonetheless it might have been used by other downstream projects.