This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

add tslint to the Fastfile (#658)

* add tslint to the Fastfile

* add typescript lint checks to pre-commit hook

* Added to precommit and rake bootstrap

* Fix pre commit to only run ts lint if there are ts files modified

* use npm lint in fastfile
  • Loading branch information...
nakhbari committed Apr 13, 2018
1 parent 5e0e941 commit def085f74db34978721d4aadcdf2b7a6b48e2645
Showing with 27 additions and 7 deletions.
  1. +17 −5 .pre-commit
  2. +1 −0 Rakefile
  3. +6 −0 fastlane/Fastfile
  4. +2 −1 package.json
  5. +1 −1 web/app/models/project_summary.ts
View
@@ -7,13 +7,25 @@ changed_files = `git status --porcelain`
.split(/\n/)
.select { |file_name_with_status| file_name_with_status =~ ADDED_OR_MODIFIED }
.map { |file_name_with_status| file_name_with_status.split(" ")[1] }
.select { |file_name| File.extname(file_name) == ".rb" or OTHER_RUBY_FILES.include?(file_name) }
.join(" ")
changed_ruby_files = changed_files
.select { |file_name| File.extname(file_name) == ".rb" or OTHER_RUBY_FILES.include?(file_name) }
.join(" ")
changed_typescript_files = changed_files
.select { |file_name| File.extname(file_name) == ".ts" }
.join(" ")
exit(0) if changed_files.empty?
exit(0) if system("rubocop #{changed_files}")
unless changed_ruby_files.empty? or system("rubocop #{changed_ruby_files}")
puts("\n\n💥 Fix ruby linting errors with `rubocop -a` and stage changed,"\
" or bypass hook with `git commit --no-verify`")
exit($?.exitstatus)
end
puts("\n\n💥 Fix linting errors with `rubocop -a` and stage changed, or bypass hook with `git commit --no-verify`")
unless changed_typescript_files.empty? or system("npm run lint")
puts("\n\n💥 Fix js linting errors with `npm run lintfix` and stage changed,"\
" or bypass hook with `git commit --no-verify`")
exit($?.exitstatus)
end
exit($?.exitstatus)
exit(0)
View
@@ -8,6 +8,7 @@ end
task :devbootstrap do
sh "bundle install"
sh("brew install node") unless sh("npm -v")
sh "npm install"
sh "ln -sf ../../.pre-commit .git/hooks/pre-commit"
end
View
@@ -10,3 +10,9 @@ lane :rubocop do
sh("cd ..;bundle install")
sh("cd ..;bundle exec rubocop")
end
lane :tslint do
desc "TSLint the whole project to ensure no style violations"
sh("cd ..;npm install")
sh("cd ..;npm run lint")
end
View
@@ -7,7 +7,8 @@
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint"
"lint": "ng lint",
"lintfix": "ng lint --fix"
},
"private": true,
"dependencies": {
@@ -1,4 +1,4 @@
import {BuildStatus, buildStatusToIcon, FastlaneStatus, fastlaneStatusToEnum} from '../common/constants'
import {BuildStatus, buildStatusToIcon, FastlaneStatus, fastlaneStatusToEnum} from '../common/constants';
export interface ProjectSummaryResponse {
id: string;

0 comments on commit def085f

Please sign in to comment.