In Python world, one of the most widely-used static code analysis tools, pylint
has a special check, that detects typos in comments and docstrings.
Is there a way to detect typos in JavaScript code using static code analysis?
To make the question more specific, here is an example code I want to cause a warning:
// enter credntials and log in
scope.loginPage.logIn(browser.params.regularUser.login, browser.params.regularUser.password);
Here credntials
is misspelled.
There is a
eslint
plugin built specifically for the task -eslint-plugin-spellcheck
:It is based on the
hunspell-spellchecker
library that knows how to parse and useHunspell
dictionaries of known words:Here is what it outputs for the example code provided in the question:
The plugin is easily customizable and can check in comments, identifiers and strings.