diff --git a/eslint-example/.eslintrc.json b/eslint-example/.eslintrc.json new file mode 100644 index 0000000..51d8a7f --- /dev/null +++ b/eslint-example/.eslintrc.json @@ -0,0 +1,16 @@ +{ + "globals": { + "browser": true, + "chrome": true + }, + "rules": { + "no-set-state": "off" + }, + "env": { + "browser": true, + "es6": true + }, + "extends": [ + "eslint:recommended" + ] +} \ No newline at end of file diff --git a/eslint-example/.gitignore b/eslint-example/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/eslint-example/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/eslint-example/README.md b/eslint-example/README.md new file mode 100644 index 0000000..eb0396f --- /dev/null +++ b/eslint-example/README.md @@ -0,0 +1,10 @@ +# ESLint Example + +## 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. + +## How to use + +* run `npm install` to install packages +* run `npm run lint` to use eslint \ No newline at end of file diff --git a/eslint-example/file.js b/eslint-example/file.js new file mode 100644 index 0000000..098aa7b --- /dev/null +++ b/eslint-example/file.js @@ -0,0 +1,4 @@ +/* exported getUsefulContents */ +function getUsefulContents(callback) { + callback('Hello World'); +} diff --git a/eslint-example/icons/LICENSE b/eslint-example/icons/LICENSE new file mode 100644 index 0000000..20e821d --- /dev/null +++ b/eslint-example/icons/LICENSE @@ -0,0 +1,2 @@ + +The "page-32.png" and "page-48.png" icons are taken from the miu iconset created by Linh Pham Thi Dieu, and are used under the terms of its license: http://linhpham.me/miu/. diff --git a/eslint-example/icons/page-32.png b/eslint-example/icons/page-32.png new file mode 100644 index 0000000..dae663d Binary files /dev/null and b/eslint-example/icons/page-32.png differ diff --git a/eslint-example/icons/page-48.png b/eslint-example/icons/page-48.png new file mode 100644 index 0000000..ba042cd Binary files /dev/null and b/eslint-example/icons/page-48.png differ diff --git a/eslint-example/main.js b/eslint-example/main.js new file mode 100644 index 0000000..3b2ea03 --- /dev/null +++ b/eslint-example/main.js @@ -0,0 +1,10 @@ +/* global getUsefulContents */ +function start() { + getUsefulContents(data => { + var display = document.getElementById('display'); + + display.innerHTML = data; + }); +} + +document.addEventListener('DOMContentLoaded', start); diff --git a/eslint-example/manifest.json b/eslint-example/manifest.json new file mode 100644 index 0000000..21dfebf --- /dev/null +++ b/eslint-example/manifest.json @@ -0,0 +1,12 @@ +{ + "manifest_version": 2, + "description": "Example using eslint", + "name": "eslint-example", + "version": "1.0", + "homepage_url": "https://github.com/mdn/webextensions-examples/tree/master/eslint-example", + + "browser_action": { + "default_icon": "icons/page-32.png", + "default_popup": "popup.html" + } +} \ No newline at end of file diff --git a/eslint-example/package.json b/eslint-example/package.json new file mode 100644 index 0000000..314d61e --- /dev/null +++ b/eslint-example/package.json @@ -0,0 +1,16 @@ +{ + "name": "eslint-example", + "version": "1.0.0", + "description": "", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "eslint": "^3.9.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "lint": "eslint ." + }, + "author": "", + "license": "ISC" +} \ No newline at end of file diff --git a/eslint-example/popup.html b/eslint-example/popup.html new file mode 100644 index 0000000..92abfaa --- /dev/null +++ b/eslint-example/popup.html @@ -0,0 +1,15 @@ + + + + + Pop-up + + +

Example.com

+ +
+ + + + + \ No newline at end of file