Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint, cross-env make, run all tests in 2 minutes (instead of 20) #276

Merged
merged 33 commits into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a2df205
Update make, use eslint and other QOL changes
SleeplessByte Jul 24, 2019
95267d0
Implement changes of eslint
SleeplessByte Jul 24, 2019
fe2fdfe
Use package tsc
SleeplessByte Jul 24, 2019
0318209
Fix final files
SleeplessByte Jul 24, 2019
85921ab
Only lint .example and .test
SleeplessByte Jul 24, 2019
7f8dd34
Make two-fer easier
SleeplessByte Jul 24, 2019
e60c311
Remove tslint.json
SleeplessByte Jul 24, 2019
51b275e
Use travis to run danger
SleeplessByte Jul 24, 2019
2a6baf0
Now that travis is danger-only, it should only have one version
SleeplessByte Jul 24, 2019
a9dd70d
Break example to test danger
SleeplessByte Jul 24, 2019
38cca01
Make whitespace resistant
SleeplessByte Jul 25, 2019
48c248d
Use one directory, add commentary and colours
SleeplessByte Jul 25, 2019
3f9b0e6
Cleanup final messages
SleeplessByte Jul 25, 2019
9ff4233
Fix danger
SleeplessByte Jul 25, 2019
66daaee
Remove -n flag
SleeplessByte Jul 25, 2019
9587636
Fix danger again
SleeplessByte Jul 25, 2019
f798cf0
Use right variable
SleeplessByte Jul 25, 2019
889d75e
Use relative paths
SleeplessByte Jul 25, 2019
ca88257
Danger works, fix exercise
SleeplessByte Jul 25, 2019
8f6697e
Use dangerfile dsl
SleeplessByte Jul 25, 2019
f787100
Try to force install LTS node
SleeplessByte Jul 25, 2019
330968c
Print all the files
SleeplessByte Jul 25, 2019
50a6dd2
More printing
SleeplessByte Jul 25, 2019
dd055f8
Does this give a non-relative path?
SleeplessByte Jul 25, 2019
38607c4
Hardcode travis path
SleeplessByte Jul 25, 2019
8d90b0c
Fix syntax error
SleeplessByte Jul 25, 2019
7d625b0
Fix for older ruby
SleeplessByte Jul 25, 2019
d44e2ba
load nvm onto path
SleeplessByte Jul 25, 2019
5e48411
Try nvm as one command
SleeplessByte Jul 25, 2019
6bcbf13
Try brew for node
SleeplessByte Jul 25, 2019
46521a0
Yay. Upgrade node via brew
SleeplessByte Jul 25, 2019
12e9612
macosx support
SleeplessByte Jul 25, 2019
406b3b9
Don't copy node_modules
SleeplessByte Jul 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,20 @@ node_modules
build
babel-output
lintreport.json

# These should be placed in common or maintaining. Only have them in the root
# to make editor plugins work.
/.eslintignore
/.eslintrc
/tsconfig.json

# These are artifacts from running make test. They should be removed by make.
# The correct location for these files is the maintaining folder.
/exercises/package.json
/exercises/tsconfig.json
/exercises/.eslint.track.rc
/exercises/.eslintrc
/exercises/.eslintignore
/exercises/yarn.lock
/exercises/node_modules
exercises/yarn-error.log
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "node"
- "lts/*"

cache: yarn

Expand All @@ -12,11 +12,12 @@ before_install:

before_script:
- npm install -g yarn
- node -v
- yarn -v
- ruby -v

script:
- bin/fetch-configlet
- bin/configlet lint .
- make test

after_success:
- make report
- danger
40 changes: 25 additions & 15 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'pathname';

# Ensure a clean commits history
if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}'/ }
fail('Please rebase to get rid of the merge commits in this PR')
warn('Please rebase to get rid of the merge commits in this PR, otherwise, if this PR is small, this should be squash-merged so the merge commit is squashed.')
end
can_merge = github.pr_json["mergeable"]
is_merged = github.pr_json["merged"]
Expand All @@ -17,27 +19,35 @@ warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500

#ENSURE THERE IS A SUMMARY FOR A PR
# Ensure there is a summary
warn("Please provide a summary in the Pull Request description. See more info <a href=\"http\://tinyletter.com/exercism/letters/exercism-pull-requests\">here.</a>") if github.pr_body.length < 5

# LINT Comments in for each Line
jsonpath = "lintreport.json"
contents = File.read jsonpath
require "json"
if contents.to_s == ''
contents = "[]"
contents = "[]"
end
json = JSON.parse contents

json.each do |object|
shortFile = object["name"]
shortFile = shortFile.to_s || ''
msg = object["failure"].to_s || ''
line = object["endPosition"]["line"] || 1
#only warn for files that were edited in this PR.
if git.modified_files.include? shortFile
shortFile.prepend("/") # get away from doing inline comments since they are buggy as of Sep-2016
warn(msg, file: shortFile, line: line)
else
message(msg, file: shortFile, line: line)
end
end
# TODO: use env path so it works everwhere
source_file = Pathname.new(object["filePath"])
.relative_path_from(Pathname.new('/home/travis/build/exercism/typescript/')).to_s;

(object["messages"] || []).each do |message|
danger_message = "#{message["message"].to_s} (#{message["ruleId"].to_s})"
source_line = message["line"]

# only warn for files that were edited in this PR.
if git.modified_files.include? source_file
# get away from doing inline comments since they are buggy as of Sep-2016
shortFile.prepend("/") unless source_file[0] == '/'

warn(danger_message, file: source_file, line: source_line)
else
message(danger_message, file: source_file, line: source_line)
end
end
end
Loading