mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
Merge pull request #128 from iampeterbanjo/eslint-example
Eslint example
This commit is contained in:
16
eslint-example/.eslintrc.json
Normal file
16
eslint-example/.eslintrc.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"globals": {
|
||||
"browser": true,
|
||||
"chrome": true
|
||||
},
|
||||
"rules": {
|
||||
"no-set-state": "off"
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended"
|
||||
]
|
||||
}
|
||||
1
eslint-example/.gitignore
vendored
Normal file
1
eslint-example/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
10
eslint-example/README.md
Normal file
10
eslint-example/README.md
Normal file
@@ -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
|
||||
4
eslint-example/file.js
Normal file
4
eslint-example/file.js
Normal file
@@ -0,0 +1,4 @@
|
||||
/* exported getUsefulContents */
|
||||
function getUsefulContents(callback) {
|
||||
callback('Hello World');
|
||||
}
|
||||
2
eslint-example/icons/LICENSE
Normal file
2
eslint-example/icons/LICENSE
Normal file
@@ -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/.
|
||||
BIN
eslint-example/icons/page-32.png
Normal file
BIN
eslint-example/icons/page-32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 344 B |
BIN
eslint-example/icons/page-48.png
Normal file
BIN
eslint-example/icons/page-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 310 B |
10
eslint-example/main.js
Normal file
10
eslint-example/main.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/* global getUsefulContents */
|
||||
function start() {
|
||||
getUsefulContents(data => {
|
||||
var display = document.getElementById('display');
|
||||
|
||||
display.innerHTML = data;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', start);
|
||||
12
eslint-example/manifest.json
Normal file
12
eslint-example/manifest.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
16
eslint-example/package.json
Normal file
16
eslint-example/package.json
Normal file
@@ -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"
|
||||
}
|
||||
15
eslint-example/popup.html
Normal file
15
eslint-example/popup.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Pop-up</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="title">Example.com</h1>
|
||||
|
||||
<div id="display"></div>
|
||||
|
||||
<script src="file.js"></script>
|
||||
<script src="main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user