infernu
infernu copied to clipboard
Allow users to ignore common variable names
When I infernu my JavaScript code, I often see warnings about variable names that infernu thinks are undefined, but are actually defined by the JavaScript engines I use.
For example:
./coffeescript/Gruntfile.js:3:1: Error: Unbound variable: '"module"'
./css/Gruntfile.js:3:1: Error: Unbound variable: '"module"'
./html/Gruntfile.js:3:1: Error: Unbound variable: '"module"'
./iojs/Gruntfile.js:3:1: Error: Unbound variable: '"module"'
module
is a built-in variable in Node.js, so it would be nice to offer infernu users a configuration file for specifying node-related variables to ignore. The same goes for alert
and location
, browser-related variables.
JSHint and ESLint offer ways to hide these warnings, for example.
Pending #13.
The real solution is twofold, and will (eventually) be implemented:
- Common APIs available in browsers will be part of the standard environment known to infernu, with specific types assigned to all bindings (such as 'alert' - will be a function of the proper type).
- Other external APIs will need a sort of 'header file' format for introducing external bindings, like the externs of Google Closure Compiler and the .d.ts files in TypeScript.
For now, there is no good solution. As the main README says, infernu is still in early development... Thanks for raising the issue, but it may take time to fix.
- Other external APIs will need a sort of 'header file' format for introducing external bindings, like the externs of Google Closure Compiler and the .d.ts files in TypeScript.
This will definitely be needed for infernu's broader adoption :)
:+1: