diff --git a/.eslintrc.yml b/.eslintrc.yml index 9c90984..4b4c145 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,21 +1,40 @@ -# http://eslint.org/docs/user-guide/configuring -# http://eslint.org/docs/2.0.0/rules/ +--- +parser: esprima env: - browser: true + browser: true, jquery: true -extends: 'eslint:recommended' +settings: + ecmascript: 6 plugins: - ignore-erb -rules: + +# "off" or 0 - turn the rule off +# "warn" or 1 - turn the rule on as a warning (doesn’t affect exit code) +# "error" or 2 - turn the rule on as an error (exit code is 1 when triggered) +# usually preferring warn because error can halt the build process and trips up rapid feedback +extends: "eslint:recommended" +rules: # http://eslint.org/docs/rules/ + camelcase: warn + curly: + - warn + - all indent: - - error + - warn - 2 linebreak-style: - error - unix - no-trailing-spaces: + no-console: + # console.error and console.warn are ok, but let's + # keep console.log out of production code. - warn + - allow: + - warn + - error + no-mixed-spaces-and-tabs: + - warn + - smart-tabs + no-trailing-spaces: warn + no-underscore-dangle: warn quotes: off - semi: - - error - - always + semi: warn diff --git a/.scss-lint.yml b/.scss-lint.yml deleted file mode 100644 index 39eef5a..0000000 --- a/.scss-lint.yml +++ /dev/null @@ -1,11 +0,0 @@ -scss_files: 'app/assets/stylesheets/**/*.scss' - -linters: - StringQuotes: - enabled: false - LeadingZero: - style: 'include_zero' - SelectorFormat: - ignored_names: - QualifyingElement: - allow_element_with_attribute: true diff --git a/Gemfile b/Gemfile index 90f6e82..5447951 100644 --- a/Gemfile +++ b/Gemfile @@ -17,10 +17,11 @@ gem 'sass-rails', '~> 5.0' gem 'settingslogic', '~> 2.0.9' gem 'turbolinks', '~> 5' gem 'uglifier', '>= 1.3.0' +gem 'autoprefixer-rails', '~> 6.3' # assets -gem 'bourbon' -gem 'neat' +gem 'bourbon', '~> 4.2' +gem 'neat', '~> 1.8' # Foundation for Emails gem 'inky-rb', require: 'inky' diff --git a/Gemfile.lock b/Gemfile.lock index a9e6a8f..d1fe54f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,39 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.0.1) - actionpack (= 5.0.1) - nio4r (~> 1.2) + actioncable (5.0.2) + actionpack (= 5.0.2) + nio4r (>= 1.2, < 3.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.1) - actionpack (= 5.0.1) - actionview (= 5.0.1) - activejob (= 5.0.1) + actionmailer (5.0.2) + actionpack (= 5.0.2) + actionview (= 5.0.2) + activejob (= 5.0.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.1) - actionview (= 5.0.1) - activesupport (= 5.0.1) + actionpack (5.0.2) + actionview (= 5.0.2) + activesupport (= 5.0.2) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.1) - activesupport (= 5.0.1) + actionview (5.0.2) + activesupport (= 5.0.2) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.1) - activesupport (= 5.0.1) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.0.2) + activesupport (= 5.0.2) globalid (>= 0.3.6) - activemodel (5.0.1) - activesupport (= 5.0.1) - activerecord (5.0.1) - activemodel (= 5.0.1) - activesupport (= 5.0.1) + activemodel (5.0.2) + activesupport (= 5.0.2) + activerecord (5.0.2) + activemodel (= 5.0.2) + activesupport (= 5.0.2) arel (~> 7.0) - activesupport (5.0.1) + activesupport (5.0.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -43,6 +43,8 @@ GEM ansi (1.5.0) arel (7.1.4) ast (2.3.0) + autoprefixer-rails (6.3.6) + execjs awesome_print (1.7.0) bcrypt (3.1.11) better_errors (2.1.1) @@ -51,37 +53,37 @@ GEM rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bourbon (4.2.7) + bourbon (4.3.3) sass (~> 3.4) thor (~> 0.19) - brakeman (3.4.1) - builder (3.2.2) + brakeman (3.5.0) + builder (3.2.3) byebug (9.0.6) choice (0.2.0) coderay (1.1.1) - concurrent-ruby (1.0.4) - css_parser (1.4.7) + concurrent-ruby (1.0.5) + css_parser (1.4.9) addressable debug_inspector (0.0.2) docile (1.1.5) - domain_name (0.5.20161129) + domain_name (0.5.20170223) unf (>= 0.0.5, < 1.0.0) em-websocket (0.5.1) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) erubis (2.7.0) - eventmachine (1.2.1) + eventmachine (1.2.3) execjs (2.7.0) faker (1.7.3) i18n (~> 0.5) - ffi (1.9.14) + ffi (1.9.18) figaro (1.1.1) thor (~> 0.14) formatador (0.2.5) foundation_emails (2.2.1.0) globalid (0.3.7) activesupport (>= 4.1.0) - guard (2.14.0) + guard (2.14.1) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (~> 1.0) @@ -112,12 +114,12 @@ GEM http-cookie (1.0.3) domain_name (~> 0.5) http_parser.rb (0.6.0) - i18n (0.7.0) + i18n (0.8.1) inky-rb (1.3.7.2) foundation_emails (~> 2) nokogiri - jbuilder (2.6.1) - activesupport (>= 3.0.0, < 5.1) + jbuilder (2.6.3) + activesupport (>= 3.0.0, < 5.2) multi_json (~> 1.2) jquery-rails (4.2.2) rails-dom-testing (>= 1, < 3) @@ -155,7 +157,7 @@ GEM mime-types-data (3.2016.0521) mini_portile2 (2.1.0) minitest (5.10.1) - minitest-reporters (1.1.13) + minitest-reporters (1.1.14) ansi builder minitest (>= 5.0) @@ -167,20 +169,20 @@ GEM thor (~> 0.19) nenv (0.3.0) netrc (0.11.0) - nio4r (1.2.1) + nio4r (2.0.0) nokogiri (1.7.0.1) mini_portile2 (~> 2.1.0) notiffany (0.1.1) nenv (~> 0.1) shellany (~> 0.0) - parser (2.3.3.1) + parser (2.4.0.0) ast (~> 2.2) policy-assertions (0.0.3) activesupport (>= 3.0.0) pundit (>= 1.0.0) powerpack (0.1.1) - premailer (1.8.7) - css_parser (>= 1.4.5) + premailer (1.10.0) + css_parser (>= 1.4.9) htmlentities (>= 4.0.0) premailer-rails (1.9.5) actionmailer (>= 3, < 6) @@ -192,10 +194,10 @@ GEM pry-byebug (3.4.2) byebug (~> 9.0) pry (~> 0.10) - pry-rails (0.3.4) + pry-rails (0.3.5) pry (>= 0.9.10) public_suffix (2.0.5) - puma (3.6.2) + puma (3.7.1) pundit (1.1.0) activesupport (>= 3.0.0) rack (2.0.1) @@ -203,17 +205,17 @@ GEM rack rack-test (0.6.3) rack (>= 1.0) - rails (5.0.1) - actioncable (= 5.0.1) - actionmailer (= 5.0.1) - actionpack (= 5.0.1) - actionview (= 5.0.1) - activejob (= 5.0.1) - activemodel (= 5.0.1) - activerecord (= 5.0.1) - activesupport (= 5.0.1) + rails (5.0.2) + actioncable (= 5.0.2) + actionmailer (= 5.0.2) + actionpack (= 5.0.2) + actionview (= 5.0.2) + activejob (= 5.0.2) + activemodel (= 5.0.2) + activerecord (= 5.0.2) + activesupport (= 5.0.2) bundler (>= 1.3.0, < 2.0) - railties (= 5.0.1) + railties (= 5.0.2) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.1) actionpack (~> 5.x) @@ -229,18 +231,18 @@ GEM ruby-graphviz (~> 1.2) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (5.0.1) - actionpack (= 5.0.1) - activesupport (= 5.0.1) + railties (5.0.2) + actionpack (= 5.0.2) + activesupport (= 5.0.2) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.2.1) rake (12.0.0) rb-fsevent (0.9.8) - rb-inotify (0.9.7) + rb-inotify (0.9.8) ffi (>= 0.5.0) - rest-client (2.0.0) + rest-client (2.0.1) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) @@ -262,13 +264,13 @@ GEM tilt (>= 1.1, < 3) settingslogic (2.0.9) shellany (0.0.1) - simplecov (0.12.0) + simplecov (0.13.0) docile (~> 1.1.0) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) slop (3.6.0) - spring (2.0.0) + spring (2.0.1) activesupport (>= 4.2) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) @@ -282,25 +284,25 @@ GEM sprockets (>= 3.0.0) table_print (1.5.6) thor (0.19.4) - thread_safe (0.3.5) - tilt (2.0.5) + thread_safe (0.3.6) + tilt (2.0.6) turbolinks (5.0.1) turbolinks-source (~> 5) turbolinks-source (5.0.0) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (3.0.4) + uglifier (3.1.4) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext unf_ext (0.0.7.2) - unicode-display_width (1.1.2) + unicode-display_width (1.1.3) web-console (3.4.0) actionview (>= 5.0) activemodel (>= 5.0) debug_inspector railties (>= 5.0) - websocket-driver (0.6.4) + websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) @@ -308,11 +310,12 @@ PLATFORMS ruby DEPENDENCIES + autoprefixer-rails (~> 6.3) awesome_print bcrypt (~> 3.1.7) better_errors binding_of_caller - bourbon + bourbon (~> 4.2) brakeman byebug faker @@ -332,7 +335,7 @@ DEPENDENCIES mailjet (~> 1.3.8) minitest-reporters mysql2 (>= 0.3.18, < 0.5) - neat + neat (~> 1.8) policy-assertions premailer-rails pry-byebug diff --git a/Guardfile b/Guardfile index 305fd8e..2ebc431 100644 --- a/Guardfile +++ b/Guardfile @@ -77,6 +77,11 @@ guard :shell, all_on_start: true do system %(echo "ESLint:\033[32m #{file[0]}\033[0m") system %(./node_modules/eslint/bin/eslint.js #{file[0]}) end + + watch %r{app/assets/stylesheets/*/.*} do |file| + system %(echo "sass-lint:\033[32m #{file[0]}\033[0m") + system %(sass-lint --cache --config .sass-lint.yml '#{file[0]}' --verbose --no-exit) + end end guard :rubocop, cli: %w(-D -S -a) do diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index bd610a5..aede9d8 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -1,10 +1,10 @@ $(function(){ $("form").on('click', "[data-id=input_option_adder]", function(){ - var $new_li = $(this).siblings('li').clone(); - $new_li.attr('style', ''); - $("[data-id=input_option_list]").append($new_li); - $new_li.find('input').focus(); + var $newLi = $(this).siblings('li').clone(); + $newLi.attr('style', ''); + $("[data-id=input_option_list]").append($newLi); + $newLi.find('input').focus(); }); $("#question_input_type").on('change', function(){ diff --git a/app/assets/javascripts/live-coder/linedtextarea.js b/app/assets/javascripts/live-coder/linedtextarea.js index e1059ae..b79d63b 100644 --- a/app/assets/javascripts/live-coder/linedtextarea.js +++ b/app/assets/javascripts/live-coder/linedtextarea.js @@ -41,11 +41,11 @@ */ var fillOutLines = function(codeLines, h, lineNo){ while ( (codeLines.height() - h ) <= 0 ){ - if ( lineNo == opts.selectedLine ) + if ( lineNo == opts.selectedLine ) { codeLines.append("
" + lineNo + "
"); - else + } else { codeLines.append("
" + lineNo + "
"); - + } lineNo++; } return lineNo; diff --git a/app/assets/stylesheets/browserslist b/app/assets/stylesheets/browserslist new file mode 100644 index 0000000..99c5c02 --- /dev/null +++ b/app/assets/stylesheets/browserslist @@ -0,0 +1,4 @@ +# autoprefixer browsers list +> 1% +last 2 versions +IE > 8 diff --git a/package.json b/package.json index ed3ef70..9ed46e8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ }, "devDependencies": { "eslint": "^3.2.2", - "eslint-plugin-ignore-erb": "^0.1.0" + "eslint-plugin-ignore-erb": "^0.1.0", + "sass-lint": "^1.10.2" }, "repository": { "type": "git",