diff --git a/eslint-example/README.md b/eslint-example/README.md index eb0396f..ca380ba 100644 --- a/eslint-example/README.md +++ b/eslint-example/README.md @@ -2,9 +2,16 @@ ## What it shows -A project configured to use the [Mozilla ESlint configuration](https://www.npmjs.com/package/eslint-plugin-mozilla). By using a linter on your extension source code you can be sure that you will only be writing JavaScript that is compatible with Firefox. +This shows how to configure a WebExtension with +[eslint](http://eslint.org/) +to protect against +writing JavaScript code that may be incompatible with modern versions of +Firefox or Chrome. -## How to use +## How to use it -* run `npm install` to install packages -* run `npm run lint` to use eslint \ No newline at end of file +This requires [NodeJS](https://nodejs.org/en/) and [npm](http://npmjs.com/). + +* Change into the example directory and run `npm install` to install all + dependencies. +* Execute `npm run lint` to view a report of any coding errors. diff --git a/eslint-example/file.js b/eslint-example/file.js index 098aa7b..62f4e6d 100644 --- a/eslint-example/file.js +++ b/eslint-example/file.js @@ -1,3 +1,6 @@ +// This special eslint comment will declare that the named +// function has been "exported" into the global scope. + /* exported getUsefulContents */ function getUsefulContents(callback) { callback('Hello World'); diff --git a/eslint-example/main.js b/eslint-example/main.js index 3b2ea03..5f5981e 100644 --- a/eslint-example/main.js +++ b/eslint-example/main.js @@ -1,3 +1,6 @@ +// This special eslint comment declares that the code below relies on +// a named function in the global scope. + /* global getUsefulContents */ function start() { getUsefulContents(data => {