Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

New linter#299

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
nilnor wants to merge5 commits intoleafo:master
base:master
Choose a base branch
Loading
fromnilnor:moonpick-linter
Open

New linter#299

nilnor wants to merge5 commits intoleafo:masterfromnilnor:moonpick-linter

Conversation

@nilnor
Copy link
Contributor

This replace the current linter with the newmoonpick 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 currentcmd.lint module, replacing it with a newlint module. It also adds alint_config.moon and updates the current code to be lint clean for the new linter (two separate commits).

Things to consider / be aware of are:

  • What defaults should be used? Currently unused parameter detection is disabled by default, while unused loop variables and shadowing detections are enabled by default.
  • The oldcmd.lint module is removed. This was never advertised as a public API (AFAIK), but nonetheless it might have been used by other downstream projects.
  • The new API isn't documented - perhaps it should be to allow for easier integration for anyone who wishes to use it programmatically.

suunr reacted with thumbs up emoji
The new linter is capable of detecting a lot more possible issues withMoonscript compared to the current one. Similarly to the old linter, itdetects unused variables and undeclared global usages. It does howeverdetect 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 declarationof a variable where a previous declaration already exists higher up in ascope.
@nilnor
Copy link
ContributorAuthor

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@nilnor

[8]ページ先頭

©2009-2025 Movatter.jp