From dcdd025cb2dacafc5dda8d8dd403ead42b32dcb1 Mon Sep 17 00:00:00 2001 From: Kumar McMillan Date: Mon, 21 Nov 2016 10:20:26 -0600 Subject: [PATCH] fixed readme, added clarifying comments to the source (#147) --- eslint-example/README.md | 15 +++++++++++---- eslint-example/file.js | 3 +++ eslint-example/main.js | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) 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 => {