add eslint example

This commit is contained in:
iampeterbanjo
2016-10-29 18:15:31 +02:00
parent 07375ca50a
commit 3515d4f648
5 changed files with 51 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules/

View File

@@ -0,0 +1,12 @@
{
"plugins": [
"mozilla"
],
"extends": [
"eslint:recommended",
"plugin:mozilla"
],
"rules": {
"no-set-state": "off"
}
}

15
eslint-example/file.js Normal file
View File

@@ -0,0 +1,15 @@
function getJSON(url, callback) {
var one, two
let xhr = new XMLHttpRequest();
xhr.onload = function() {
callback(this.responseText);
};
xhr.open("GET", url, true);
xhr.send();
}
export function getUsefulContents(url, callback) {
getJSON(url, data => callback(JSON.parse(data)));
}

7
eslint-example/main.js Normal file
View File

@@ -0,0 +1,7 @@
import {
getUsefulContents
} from "file";
getUsefulContents("http://www.example.com", data => {
doSomethingUseful(data);
});

View File

@@ -0,0 +1,16 @@
{
"name": "eslint-example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"eslint": "^3.9.0",
"eslint-plugin-mozilla": "^0.2.3"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}