Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "defs", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Static scope analysis and transpilation of ES6 block scoped const and let variables, to ES3.", | ||
@@ -5,0 +5,0 @@ "main": "defs-main.js", |
@@ -21,35 +21,40 @@ # defs.js | ||
## Configuration | ||
`defs.js` looks for a `defs-config.json` configuration file in your current | ||
`defs` looks for a `defs-config.json` configuration file in your current | ||
directory. It will search for it in parent directories soon as you'd expect. | ||
Example `defs-config.json`: | ||
```javascript``` | ||
{ | ||
"environments": ["node", "browser"], | ||
"globals": { | ||
"my": false, | ||
"hat": true | ||
}, | ||
"disallowVars": false, | ||
"disallowDuplicated": true, | ||
"disallowUnknownReferences": true | ||
} | ||
``` | ||
{ | ||
"environments": ["node", "browser"], | ||
"globals": { | ||
"my": false, | ||
"hat": true | ||
}, | ||
"disallowVars": false, | ||
"disallowDuplicated": true, | ||
"disallowUnknownReferences": true | ||
} | ||
`globals` lets you list your program's globals, and indicate whether they are | ||
writable (`true`) or read-only (`false`), just like `jshint`. `environments` | ||
lets you import a set of pre-defined globals, here `node` and `browser`. | ||
These default environments are borrowed from `jshint` (see | ||
writable (`true`) or read-only (`false`), just like `jshint`. | ||
`environments` lets you import a set of pre-defined globals, here `node` and | ||
`browser`. These default environments are borrowed from `jshint` (see | ||
`jshint_globals/vars.js`). | ||
* `disallowVars` (defaults to `false`) can be enabled to make | ||
`disallowVars` (defaults to `false`) can be enabled to make | ||
usage of `var` an error. | ||
* `disallowDuplicated` (defaults to `true`) errors on duplicated | ||
`var` definitions in the same function scope. | ||
* `disallowUnknownReferences` (defaults to `true`) errors on references to | ||
unknown global variables. | ||
`disallowDuplicated` (defaults to `true`) errors on duplicated | ||
`var` definitions in the same function scope. | ||
`disallowUnknownReferences` (defaults to `true`) errors on references to | ||
unknown global variables. | ||
## Example | ||
Input `example.js`: | ||
```javascript | ||
@@ -68,3 +73,4 @@ "use strict"; | ||
Output from `~ % defs example.js`: | ||
Output from running `defs example.js`: | ||
```javascript | ||
@@ -71,0 +77,0 @@ "use strict"; |
46262
90