From 47b51c512d211ecbfabd374d48cab1e162f01c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sat, 11 Nov 2017 12:18:07 +0100 Subject: [PATCH] Add eslintrc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl Make run-eslint.sh executable Signed-off-by: Julius Härtl --- .eslintignore | 6 ++++++ .eslintrc.yml | 34 ++++++++++++++++++++++++++++++++++ js/app/App.js | 3 +++ js/app/Config.js | 2 +- run-eslint.sh | 6 +++++- 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.yml mode change 100644 => 100755 run-eslint.sh diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..7c384b23a --- /dev/null +++ b/.eslintignore @@ -0,0 +1,6 @@ +/js/tests/* +/js/vendor/* +/js/node_modules/* +/karma.conf.js +/tests/* +/l10n/* diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 000000000..c4f2d050d --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,34 @@ +root: true + + +extends: + - eslint:recommended + +env: + browser: true + amd: true + +globals: + app: false + angular: false + $: false + escapeHTML: false + OC: false + OCA: false + t: false + oc_current_user: false + oc_requesttoken: false + Clipboard: false + oc_defaults: false + +rules: + curly: error + eqeqeq: ["error", "smart"] + guard-for-in: error + no-console: off + no-fallthrough: error + no-mixed-spaces-and-tabs: error + no-unused-vars: warn + no-use-before-define: error + semi: ["error", "always"] + indent: ["error", "tab"] diff --git a/js/app/App.js b/js/app/App.js index e0e24281c..f5d0afc4f 100644 --- a/js/app/App.js +++ b/js/app/App.js @@ -20,6 +20,9 @@ * */ +/* global angular */ + + angular.module('markdown', []) .provider('markdown', [function () { var opts = {}; diff --git a/js/app/Config.js b/js/app/Config.js index dc0f2f7db..a0afc3c5d 100644 --- a/js/app/Config.js +++ b/js/app/Config.js @@ -20,7 +20,7 @@ * */ -/** global: oc_requesttoken, markdownitLinkTarget */ +/* global app oc_requesttoken markdownitLinkTarget */ app.config(function ($provide, $routeProvider, $interpolateProvider, $httpProvider, $urlRouterProvider, $stateProvider, $compileProvider, markdownItConverterProvider) { 'use strict'; diff --git a/run-eslint.sh b/run-eslint.sh old mode 100644 new mode 100755 index 50548f107..aec72454c --- a/run-eslint.sh +++ b/run-eslint.sh @@ -8,4 +8,8 @@ if [ -z "$ESLINT" ]; then fi echo Checking scripts with $ESLINT ... -find -name "*.js" -print0 | xargs -0 $ESLINT +find -name "*.js" -not -path '*js/node_modules*' \ + -not -path '*l10n/*' \ + -not -path '*js/vendor*' \ + -not -path '*js/tests*' \ + -print0 | xargs -0 $ESLINT --quiet