lint: Allow marking variables/arguments as unused

Unused variables or arguments can indicate bugs, but they can also
help document the code, in particular in case of signal handlers
and destructuring.

Account for this by keeping the error, but set up patterns that allow
us to opt out of if for individual variables/arguments. For arguments
we pick a '_' prefix, while for variables we go with a suffix instead,
to not accidentally exempt private module-scope variables.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
This commit is contained in:
Florian Müllner 2019-01-28 01:37:12 +01:00
parent 466dc8da8f
commit 0257de1b7e

View File

@ -16,6 +16,13 @@
"afterColon": true "afterColon": true
} }
], ],
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "_$"
}
],
"object-curly-spacing": [ "object-curly-spacing": [
"error", "error",
"always" "always"