Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 87dfce7f3512
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf3c410a9abe
Choose a head ref
  • 4 commits
  • 5 files changed
  • 2 contributors

Commits on May 16, 2015

  1. Copy the full SHA
    1c4af22 View commit details
  2. Copy the full SHA
    9a361b4 View commit details
  3. Run rake lint in Travis

    vais committed May 16, 2015
    Copy the full SHA
    7e523bd View commit details
  4. Merge pull request #865 from vais/linting

    Start using JSHint
    elia committed May 16, 2015
    Copy the full SHA
    cf3c410 View commit details
Showing with 70 additions and 38 deletions.
  1. +46 −0 .jshintrc
  2. +5 −0 .travis.yml
  3. +1 −0 Rakefile
  4. +0 −38 tasks/documentation.rake
  5. +18 −0 tasks/linting.rake
46 changes: 46 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
// http://jshint.com/docs/options

"curly" : true, // Require curly braces around blocks in loops and conditionals
"eqeqeq" : true, // Prohibit the use of == and != in favor of === and !==
"es3" : true, // Adhere to ECMAScript 3 specification
"forin" : true, // Require all for in loops to filter object's items (hasOwnProperty)
"latedef" : true, // Prohibit the use of a variable before it was defined
"noarg" : true, // Prohibit the use of arguments.caller and arguments.callee
"nonbsp" : true, // Warn about "non-breaking whitespace" characters
"undef" : true, // Prohibit the use of explicitly undeclared variables
"unused" : true, // Warn when you define and never use your variables

"globals": {
"Opal": true
},

// Currently the following checks are failing:

"-W003": false, // 'variable' was used before it was defined
"-W004": false, // 'variable' is already defined
"-W018": false, // Confusing use of '!'
"-W021": false, // '$ClassName' is a function
"-W024": false, // Expected an identifier and instead saw 'eval' (a reserved word)
"-W027": false, // Unreachable ';' after 'return'
"-W032": false, // Unnecessary semicolon
"-W030": false, // Expected an assignment or function call and instead saw an expression
"-W033": false, // Missing semicolon
"-W038": false, // 'variable' used out of scope
"-W041": false, // Use '===' to compare with 'true'
"-W049": false, // Unexpected escaped character '<' in regular expression
"-W053": false, // Do not use String as a constructor
"-W058": false, // Missing '()' invoking a constructor
"-W061": false, // eval can be harmful
"-W065": false, // Missing radix parameter
"-W069": false, // ['prop'] is better written in dot notation
"-W080": false, // It's not necessary to initialize 'result' to 'undefined'
"-W083": false, // Don't make functions within a loop
"-W086": false, // Expected a 'break' statement before 'case'
"-W089": false, // The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype
"-W093": false, // Did you mean to return a conditional instead of an assignment?
"-W098": false, // 'variable' is defined but never used
"-W116": false, // Expected '===' and instead saw '=='
"-W117": false, // 'variable' is not defined
"-W120": false // You might be leaking a variable ($ClassName) here
}
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -30,6 +30,11 @@ matrix:
- rvm: jruby-head
env: RUN=rspec

- rvm: 2.2
script:
- npm install -g jshint
- bundle exec rake lint

allow_failures:
- rvm: 1.8.7
- rvm: 1.9.3
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -9,5 +9,6 @@ import 'tasks/github.rake'
import 'tasks/documenting.rake'
import 'tasks/testing.rake'
import 'tasks/building.rake'
import 'tasks/linting.rake'

task :default => [:rspec, :mspec_node, :cruby_tests]
38 changes: 0 additions & 38 deletions tasks/documentation.rake

This file was deleted.

18 changes: 18 additions & 0 deletions tasks/linting.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
directory 'tmp/lint'

desc "Build *corelib* and *stdlib* and lint the result"
task :lint => 'tmp/lint' do
require 'opal/sprockets/environment'

env = Opal::Environment.new

files = Dir['{opal,stdlib}/*.rb'].map { |lib| File.basename(lib, '.rb') }

files.each do |lib|
next if lib == 'minitest'
File.binwrite("tmp/lint/#{lib}.js", env[lib].to_s)
end

sh "jshint --verbose tmp/lint/*.js"
end