From c0f43dcc542afe59b2e5b6d533d3e2e96c6aaf5d Mon Sep 17 00:00:00 2001 From: iampeterbanjo Date: Tue, 15 Nov 2016 05:46:35 +0000 Subject: [PATCH] mv .gitignore. fix indents. update eslint config. use export and global to fix eslint errors --- eslint-example/.eslintrc.json | 12 +++++++++--- .gitignore => eslint-example/.gitignore | 0 eslint-example/file.js | 1 + eslint-example/main.js | 19 ++++++++++--------- 4 files changed, 20 insertions(+), 12 deletions(-) rename .gitignore => eslint-example/.gitignore (100%) diff --git a/eslint-example/.eslintrc.json b/eslint-example/.eslintrc.json index 2415576..51d8a7f 100644 --- a/eslint-example/.eslintrc.json +++ b/eslint-example/.eslintrc.json @@ -1,10 +1,16 @@ { - "globals": {"chrome": true}, + "globals": { + "browser": true, + "chrome": true + }, "rules": { "no-set-state": "off" }, "env": { - "browser": true, + "browser": true, "es6": true - } + }, + "extends": [ + "eslint:recommended" + ] } \ No newline at end of file diff --git a/.gitignore b/eslint-example/.gitignore similarity index 100% rename from .gitignore rename to eslint-example/.gitignore diff --git a/eslint-example/file.js b/eslint-example/file.js index b8a351f..998c8da 100644 --- a/eslint-example/file.js +++ b/eslint-example/file.js @@ -1,3 +1,4 @@ +/* exported getUsefulContents */ // we cant use export here function getUsefulContents(callback) { callback('Hello World'); diff --git a/eslint-example/main.js b/eslint-example/main.js index 72a34ce..9e480ba 100644 --- a/eslint-example/main.js +++ b/eslint-example/main.js @@ -1,12 +1,13 @@ - // not supported in Firefox - // import { getUsefulContents } from "file"; +/* global getUsefulContents */ +// not supported in Firefox +// import { getUsefulContents } from "file"; - function start() { - getUsefulContents(data => { - var display = document.getElementById('display'); +function start() { + getUsefulContents(data => { + var display = document.getElementById('display'); - display.innerHTML = data; - }); - } + display.innerHTML = data; + }); +} - document.addEventListener('DOMContentLoaded', start); \ No newline at end of file +document.addEventListener('DOMContentLoaded', start); \ No newline at end of file