diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000000000000000000000000000000000000..67141171e26c56056f7b1fc1a9da50825a120f79 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,258 @@ +{ + "env": { + "browser": true, + "jasmine": true, + "jquery": true + }, + + "globals": { + "_": false, + "autosize": false, + "Backbone": false, + "Bloodhound": false, + "gon": false, + "Handlebars": false, + "HandlebarsTemplates": false, + "ImagePaths": false, + "jsxc": false, + "L": false, + "Routes": false, + "OSM": false, + "qq": false, + "blueimp": false, + + "loginAs": true, + "logout": true, + "spec": true, + "context": true, + "factory": true, + "stubView": true, + + "app": true, + "Diaspora": true, + "Keycodes": true, + "PosixBracketExpressions": true + }, + + "rules": { + "accessor-pairs": 0, + "array-bracket-spacing": [2, "never"], + "array-callback-return": 0, + "arrow-body-style": 0, + "arrow-parens": 0, + "arrow-spacing": 0, + "block-scoped-var": 0, + "block-spacing": [2, "always"], + "brace-style": [2, "1tbs", {"allowSingleLine": true}], + "callback-return": 0, + "camelcase": 2, + "comma-dangle": [2, "never"], + "comma-spacing": [2, {"before": false, "after": true}], + "comma-style": [2, "last"], + "complexity": [1, {"max": 20}], + "computed-property-spacing": [2, "never"], + "consistent-return": 2, + "consistent-this": 0, + "constructor-super": 0, + "curly": [2, "all"], + "default-case": 0, + "dot-location": [2, "property"], + "dot-notation": 2, + "eol-last": 2, + "eqeqeq": [2, "allow-null"], + "func-names": 0, + "func-style": 0, + "generator-star-spacing": 0, + "global-require": 0, + "guard-for-in": 1, + "handle-callback-err": 0, + "id-blacklist": 0, + "id-length": 0, + "id-match": 0, + "indent": [2, 2, {"SwitchCase": 1}], + "init-declarations": 0, + "jsx-quotes": 0, + "key-spacing": [2, {"beforeColon": false, "afterColon": true}], + "keyword-spacing": 2, + "linebreak-style": 0, + "lines-around-comment": 0, + "max-depth": 0, + "max-len": [1, {"code": 120, "ignoreUrls": true}], + "max-lines": 0, + "max-nested-callbacks": [2, {"max": 3}], + "max-params": 0, + "max-statements": 0, + "max-statements-per-line": 0, + "new-cap": [2, {"capIsNew": false}], + "new-parens": 2, + "newline-after-var": 0, + "newline-before-return": 0, + "newline-per-chained-call": 0, + "no-alert": 0, + "no-array-constructor": 2, + "no-bitwise": 0, + "no-caller": 2, + "no-case-declarations": 2, + "no-catch-shadow": 0, + "no-class-assign": 2, + "no-cond-assign": 2, + "no-confusing-arrow": 2, + "no-console": 2, + "no-const-assign": 2, + "no-constant-condition": 2, + "no-continue": 0, + "no-control-regex": 2, + "no-debugger": 2, + "no-delete-var": 2, + "no-div-regex": 0, + "no-dupe-args": 2, + "no-dupe-class-members": 2, + "no-dupe-keys": 2, + "no-duplicate-case": 2, + "no-duplicate-imports": 0, + "no-else-return": 2, + "no-empty": 2, + "no-empty-character-class": 2, + "no-empty-function": 1, + "no-empty-pattern": 2, + "no-eq-null": 0, + "no-eval": 2, + "no-ex-assign": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-extra-boolean-cast": 2, + "no-extra-label": 0, + "no-extra-parens": 0, + "no-extra-semi": 2, + "no-fallthrough": 2, + "no-floating-decimal": 0, + "no-func-assign": 2, + "no-implicit-coercion": 0, + "no-implicit-globals": 0, + "no-implied-eval": 0, + "no-inline-comments": 0, + "no-inner-declarations": 2, + "no-invalid-regexp": 2, + "no-invalid-this": 0, + "no-irregular-whitespace": 2, + "no-iterator": 0, + "no-label-var": 0, + "no-labels": 0, + "no-lone-blocks": 0, + "no-lonely-if": 2, + "no-loop-func": 2, + "no-magic-numbers": 0, + "no-mixed-operators": 0, + "no-mixed-requires": 0, + "no-mixed-spaces-and-tabs": 2, + "no-multi-spaces": 1, + "no-multi-str": 0, + "no-multiple-empty-lines": [1, {"max": 1}], + "no-native-reassign": 2, + "no-negated-condition": 0, + "no-negated-in-lhs": 2, + "no-nested-ternary": 0, + "no-new": 0, + "no-new-func": 0, + "no-new-object": 0, + "no-new-require": 0, + "no-new-symbol": 0, + "no-new-wrappers": 0, + "no-obj-calls": 2, + "no-octal": 2, + "no-octal-escape": 0, + "no-param-reassign": 0, + "no-path-concat": 0, + "no-plusplus": 0, + "no-process-env": 0, + "no-process-exit": 0, + "no-proto": 2, + "no-prototype-builtins": 0, + "no-redeclare": 2, + "no-regex-spaces": 2, + "no-restricted-globals": 0, + "no-restricted-imports": 0, + "no-restricted-modules": 0, + "no-restricted-syntax": 0, + "no-return-assign": 2, + "no-script-url": 0, + "no-self-assign": 2, + "no-self-compare": 2, + "no-sequences": 2, + "no-shadow": 1, + "no-shadow-restricted-names": 2, + "no-spaced-func": 1, + "no-sparse-arrays": 2, + "no-sync": 0, + "no-ternary": 0, + "no-this-before-super": 2, + "no-throw-literal": 2, + "no-trailing-spaces": 2, + "no-undef": 2, + "no-undef-init": 0, + "no-undefined": 0, + "no-underscore-dangle": 0, + "no-unexpected-multiline": 2, + "no-unmodified-loop-condition": 1, + "no-unneeded-ternary": 1, + "no-unreachable": 2, + "no-unsafe-finally": 1, + "no-unused-expressions": 0, + "no-unused-labels": 2, + "no-unused-vars": 2, + "no-use-before-define": [2, {"functions": false, "classes": true}], + "no-useless-call": 1, + "no-useless-computed-key": 0, + "no-useless-concat": 0, + "no-useless-constructor": 0, + "no-useless-escape": 0, + "no-useless-rename": 0, + "no-var": 0, + "no-void": 0, + "no-warning-comments": 0, + "no-whitespace-before-property": 2, + "no-with": 2, + "object-curly-newline": 0, + "object-curly-spacing": [2, "never"], + "object-property-newline": 0, + "object-shorthand": 0, + "one-var": 0, + "one-var-declaration-per-line": 0, + "operator-assignment": 0, + "operator-linebreak": 0, + "padded-blocks": [2, "never"], + "prefer-arrow-callback": 0, + "prefer-const": 0, + "prefer-reflect": 0, + "prefer-rest-params": 0, + "prefer-spread": 0, + "prefer-template": 0, + "quote-props": 0, + "quotes": [2, "double", "avoid-escape"], + "radix": [2, "always"], + "require-jsdoc": 0, + "require-yield": 0, + "rest-spread-spacing": 0, + "semi": [2, "always"], + "semi-spacing": [2, {"before": false, "after": true}], + "sort-imports": 0, + "sort-vars": 0, + "space-before-blocks": [2, "always"], + "space-before-function-paren": [2, "never"], + "space-in-parens": [2, "never"], + "space-infix-ops": [2, {"int32Hint": true}], + "space-unary-ops": [2, {"words": true, "nonwords": false}], + "spaced-comment": [2, "always"], + "strict": 0, + "template-curly-spacing": 0, + "unicode-bom": 0, + "use-isnan": 2, + "valid-jsdoc": 0, + "valid-typeof": 2, + "vars-on-top": 0, + "wrap-iife": 0, + "wrap-regex": 0, + "yield-star-spacing": 0, + "yoda": [2, "never"] + } +} diff --git a/.jshintignore b/.jshintignore deleted file mode 120000 index e650afb0573525cf100cf912bca925ae911c2884..0000000000000000000000000000000000000000 --- a/.jshintignore +++ /dev/null @@ -1 +0,0 @@ -config/.jshint_ignore \ No newline at end of file diff --git a/.jshintrc b/.jshintrc deleted file mode 120000 index 2c12c8897ed69beb7360822f4c002c08c6fe532d..0000000000000000000000000000000000000000 --- a/.jshintrc +++ /dev/null @@ -1 +0,0 @@ -config/.jshint.json \ No newline at end of file diff --git a/Gemfile b/Gemfile index 25067f5d222b27a94d44cbe01b22738b0f75a70b..2328b8aec9c7161177c9c942d9beb6f49b10b718 100644 --- a/Gemfile +++ b/Gemfile @@ -235,7 +235,6 @@ end group :development do # Automatic test runs gem "guard-cucumber", "2.1.2" - gem "guard-jshintrb", "1.1.1" gem "guard-rspec", "4.7.2" gem "guard-rubocop", "1.2.0" gem "guard", "2.14.0", require: false @@ -243,11 +242,10 @@ group :development do gem "rb-inotify", "0.9.7", require: false # Linters - gem "jshintrb", "0.3.0" gem "rubocop", "0.40.0" gem "haml_lint", "0.17.1" gem "pronto", "0.6.0" - gem "pronto-jshint", "0.6.0" + gem "pronto-eslint", "0.6.1" gem "pronto-rubocop", "0.6.2" gem "pronto-haml", "0.6.0" gem "pronto-scss", "0.6.0", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 6f05cc4f95d043e143f35f48d2686e826a05838d..8fa822ad30db632c88287222802d337a06796792 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -199,6 +199,10 @@ GEM railties (>= 4.1, <= 5) equalizer (0.0.10) erubis (2.7.0) + eslintrb (2.0.4) + execjs + multi_json (>= 1.3) + rake ethon (0.9.0) ffi (>= 1.3.0) excon (0.49.0) @@ -386,9 +390,6 @@ GEM cucumber (~> 2.0) guard-compat (~> 1.0) nenv (~> 0.1) - guard-jshintrb (1.1.1) - guard (~> 2.0) - jshintrb guard-rspec (4.7.2) guard (~> 2.1) guard-compat (~> 1.1) @@ -457,10 +458,6 @@ GEM sprockets-rails js_image_paths (0.1.0) rails (~> 4.0) - jshintrb (0.3.0) - execjs - multi_json (>= 1.3) - rake json (1.8.3) json-jwt (1.5.2) activesupport @@ -582,12 +579,12 @@ GEM octokit (~> 4.3, >= 4.1.0) rugged (~> 0.24, >= 0.23.0) thor (~> 0.19.0) + pronto-eslint (0.6.1) + eslintrb (~> 2.0, >= 2.0.0) + pronto (~> 0.6.0) pronto-haml (0.6.0) haml_lint (~> 0.16, >= 0.15.0) pronto (~> 0.6.0) - pronto-jshint (0.6.0) - jshintrb (~> 0.3.0) - pronto (~> 0.6.0) pronto-rubocop (0.6.2) pronto (~> 0.6.0) rubocop (~> 0.38, >= 0.35.0) @@ -945,7 +942,6 @@ DEPENDENCIES gon (= 6.0.1) guard (= 2.14.0) guard-cucumber (= 2.1.2) - guard-jshintrb (= 1.1.1) guard-rspec (= 4.7.2) guard-rubocop (= 1.2.0) haml_lint (= 0.17.1) @@ -959,7 +955,6 @@ DEPENDENCIES jquery-ui-rails (= 5.0.5) js-routes (= 1.2.6) js_image_paths (= 0.1.0) - jshintrb (= 0.3.0) json (= 1.8.3) json-schema (= 2.6.2) json_spec (= 1.1.4) @@ -981,8 +976,8 @@ DEPENDENCIES openid_connect (= 0.11.2) pg (= 0.18.4) pronto (= 0.6.0) + pronto-eslint (= 0.6.1) pronto-haml (= 0.6.0) - pronto-jshint (= 0.6.0) pronto-rubocop (= 0.6.2) pronto-scss (= 0.6.0) pry diff --git a/config/.jshint.json b/config/.jshint.json deleted file mode 100644 index ab9e3d70441adc047693bfb615bdeaa53d8ae7ab..0000000000000000000000000000000000000000 --- a/config/.jshint.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "bitwise": true, - "camelcase": true, - "curly": true, - "eqeqeq": true, - "forin": true, - "freeze": true, - "immed": true, - "indent": 2, - "latedef": true, - "maxlen": 120, - "newcap": true, - "noarg": true, - "noempty": true, - "nonbsp": true, - "nonew": false, - "quotmark": "double", - "undef": true, - "unused": true, - - "asi": false, - "boss": false, - "browser": true, - "devel": true, - "eqnull": true, - "evil": false, - "expr": false, - "jasmine": true, - "jquery": true, - "lastsemic": true, - "laxbreak": false, - "laxcomma": false, - "loopfunc": false, - "notypeof": false, - "scripturl": false, - "sub": false, - "supernew": true, - - "predef": [ - "_", - "autosize", - "Backbone", - "Bloodhound", - "gon", - "Handlebars", - "HandlebarsTemplates", - "ImagePaths", - "jsxc", - "L", - "MBP", - "Routes", - "OSM", - "parse_url", - "punycode", - "qq", - "blueimp", - - "loginAs", - "logout", - "spec", - "context", - "factory", - "stubView", - "exports", - "spyOn", - - "app", - "Diaspora", - "Keycodes", - "Mentions", - "PosixBracketExpressions" - ] -} diff --git a/config/.jshint_ignore b/config/.jshint_ignore deleted file mode 100644 index 42b6eb7362705e674cba831a4e8d394a06cbc905..0000000000000000000000000000000000000000 --- a/config/.jshint_ignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/assets/javascripts/**.js -lib/assets/javascripts/fileuploader-custom.js -lib/assets/javascripts/jquery.mentionsInput.js diff --git a/lib/tasks/linter.rake b/lib/tasks/linter.rake index c533ad8206c829842389753c58f9b1a310eda57b..31ff91957d88e403ac340834e8eb4918f22314c1 100644 --- a/lib/tasks/linter.rake +++ b/lib/tasks/linter.rake @@ -1,12 +1,13 @@ begin - require "jshintrb/jshinttask" - Jshintrb::JshintTask.new :jshint do |t| + require "eslintrb/eslinttask" + Eslintrb::EslintTask.new :eslint do |t| t.pattern = "{app/assets,lib/assets,spec}/javascripts/**/*.js" - t.options = :jshintrc + t.exclude_pattern = "app/assets/javascripts/{jasmine-load-all,main,mobile/mobile,templates}.js" + t.options = :eslintrc end rescue LoadError - desc "jshint rake task not available (jshintrb not installed)" - task :jshint do - abort "JSHint rake task is not available. Be sure to install jshintrb." + desc "eslint rake task not available (eslintrb not installed)" + task :eslint do + abort "ESLint rake task is not available. Be sure to install eslintrb." end end