From 7368541ac781e38b063b78bbf06de1ad061ec966 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Tue, 3 Jan 2017 10:05:01 +0100 Subject: [PATCH] Replace JSHint with ESLint (#33) * Replace JSHint with ESLint * ESLint: Enable more rules --- .eslintrc.js | 42 +++++++++++++++++++++++++++++++ package.json | 4 +-- test-support/.eslintrc.js | 11 ++++++++ tests/.eslintrc.js | 11 ++++++++ tests/dummy/config/environment.js | 4 +-- 5 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 .eslintrc.js create mode 100644 test-support/.eslintrc.js create mode 100644 tests/.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..f151121b --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,42 @@ +module.exports = { + root: true, + env: { + node: true + }, + extends: 'eslint:recommended', + rules: { + // --- Possible Errors --- + + 'no-template-curly-in-string': 'error', + 'no-unsafe-negation': 'error', + + // --- Best Practices --- + + 'curly': 'error', + 'eqeqeq': 'error', + 'no-eval': 'error', + 'no-extra-bind': 'error', + 'no-implicit-coercion': 'error', + 'no-implied-eval': 'error', + 'no-multi-spaces': 'error', + 'no-new-func': 'error', + 'no-new-wrappers': 'error', + 'no-new': 'error', + 'no-return-assign': 'error', + 'no-return-await': 'error', + 'no-sequences': 'error', + 'no-throw-literal': 'error', + 'no-unused-expressions': 'error', + 'no-useless-call': 'error', + 'no-useless-concat': 'error', + 'no-useless-escape': 'error', + 'no-void': 'error', + 'no-with': 'error', + 'require-await': 'error', + 'yoda': 'error', + + // --- Variables --- + + 'no-use-before-define': ['error', 'nofunc'] + } +}; diff --git a/package.json b/package.json index 1986967c..824521e6 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "scripts": { "build": "ember build", - "lint": "jshint config test-support tests *.js", + "lint": "eslint config test-support tests *.js", "start": "ember server", "test": "ember try:each" }, @@ -37,7 +37,7 @@ "ember-export-application-global": "^1.0.5", "ember-load-initializers": "^0.5.1", "ember-resolver": "^2.0.3", - "jshint": "^2.9.4", + "eslint": "^3.12.2", "loader.js": "^4.0.10" }, "keywords": [ diff --git a/test-support/.eslintrc.js b/test-support/.eslintrc.js new file mode 100644 index 00000000..af760d3a --- /dev/null +++ b/test-support/.eslintrc.js @@ -0,0 +1,11 @@ +module.exports = { + parserOptions: { + ecmaVersion: 6, + sourceType: 'module' + }, + env: { + node: null, + browser: true, + embertest: true, + }, +}; diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js new file mode 100644 index 00000000..af760d3a --- /dev/null +++ b/tests/.eslintrc.js @@ -0,0 +1,11 @@ +module.exports = { + parserOptions: { + ecmaVersion: 6, + sourceType: 'module' + }, + env: { + node: null, + browser: true, + embertest: true, + }, +}; diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 703c4727..7ab9db81 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,4 +1,4 @@ -/* jshint node: true */ +/* eslint-env node */ module.exports = function(environment) { var ENV = { @@ -43,7 +43,7 @@ module.exports = function(environment) { } if (environment === 'production') { - + // nothing yet... } return ENV;