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