mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
fixed readme, added clarifying comments to the source (#147)
This commit is contained in:
@@ -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
|
||||
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.
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user