infernu icon indicating copy to clipboard operation
infernu copied to clipboard

Allow users to ignore common variable names

Open mcandre opened this issue 9 years ago • 3 comments

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.

mcandre avatar Apr 19 '15 17:04 mcandre

The real solution is twofold, and will (eventually) be implemented:

  1. 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).
  2. 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.

sinelaw avatar Apr 19 '15 19:04 sinelaw

  1. 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 :)

vendethiel avatar Apr 19 '15 19:04 vendethiel

:+1:

mjgpy3 avatar Feb 01 '16 14:02 mjgpy3