From b20601af89aa772a44b2968a1488932857a60821 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Wed, 2 Jun 2021 12:49:35 -0700 Subject: [PATCH] Update lint.md (#44) Update FunctionUnused and ImportUnused following internal changes that make it possible to suppress the warning using _ --- docs/_pages/lint.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_pages/lint.md b/docs/_pages/lint.md index fc5d7cb3..684ffc62 100644 --- a/docs/_pages/lint.md +++ b/docs/_pages/lint.md @@ -100,7 +100,7 @@ print(x, x) While unused local variables could be useful for debugging, unused functions usually contain dead code that was meant to be removed. Unused functions clutter code, can be a result of typos similar to local variables, and can mislead the reader into thinking that some functionality is supported. ```lua --- Function 'bar' is never used +-- Function 'bar' is never used; prefix with '_' to silence local function bar() end @@ -115,7 +115,7 @@ return foo() In Luau, there's no first-class module system that's part of the syntax, but `require` function acts as an import statement. When a local is initialized with a `require` result, and the local is unused, this is classified as "unused import". Removing unused imports improves code quality because it makes it obvious what the dependencies of the code are: ```lua --- Import 'Roact' is never used +-- Import 'Roact' is never used; prefix with '_' to silence local Roact = require(game.Packages.Roact) ```