rubocop: add linter.rake
This commit is contained in:
parent
e16f6b261f
commit
436d660112
3 changed files with 32 additions and 27 deletions
13
.rubocop.yml
13
.rubocop.yml
|
@ -4,11 +4,12 @@ AllCops:
|
|||
TargetRubyVersion: 3.2
|
||||
Include:
|
||||
- Rakefile.rb
|
||||
- rules/*.rules
|
||||
- rules/**/**/*.rules
|
||||
- lib/*.rb
|
||||
- lib/**/*.rb
|
||||
- lib/**/**.rb
|
||||
- tasks/*.rake
|
||||
- nanoc/rules/*.rules
|
||||
- nanoc/rules/**/**/*.rules
|
||||
- nanoc/lib/*.rb
|
||||
- nanoc/lib/**/*.rb
|
||||
- nanoc/lib/**/**.rb
|
||||
|
||||
##
|
||||
# Defaults: standard-rb
|
||||
|
@ -18,7 +19,7 @@ inherit_gem:
|
|||
standard: config/base.yml
|
||||
|
||||
##
|
||||
# Extra
|
||||
# Enabled
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: true
|
||||
Layout/SpaceInsideHashLiteralBraces:
|
||||
|
|
25
Rakefile.rb
25
Rakefile.rb
|
@ -3,10 +3,13 @@
|
|||
require "bundler/setup"
|
||||
require "ryo"
|
||||
require "yaml"
|
||||
|
||||
##
|
||||
# Rake tasks
|
||||
load "tasks/deploy.rake"
|
||||
load "tasks/linter.rake"
|
||||
|
||||
build_dir = Ryo.from(YAML.load_file("./nanoc.yaml")).output_dir
|
||||
|
||||
namespace :nanoc do
|
||||
task :compile do
|
||||
ENV["SASS_PATH"] = "./src/css/"
|
||||
|
@ -43,24 +46,4 @@ task :server do
|
|||
rescue Interrupt
|
||||
s.stop
|
||||
end
|
||||
|
||||
namespace :lint do
|
||||
desc "Run rubocop (Ruby)"
|
||||
task :rubocop do
|
||||
sh "bundle exec rubocop"
|
||||
end
|
||||
|
||||
desc "Run eslint (TypeScript)"
|
||||
task :eslint do
|
||||
sh "npm run eslint"
|
||||
end
|
||||
|
||||
namespace :eslint do
|
||||
desc "Run eslint with the --fix option (TypeScript)"
|
||||
task :fix do
|
||||
sh "npm run eslint-autofix"
|
||||
end
|
||||
end
|
||||
end
|
||||
task lint: ["lint:rubocop", "lint:eslint"]
|
||||
task default: "build"
|
||||
|
|
21
tasks/linter.rake
Normal file
21
tasks/linter.rake
Normal file
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
namespace :linter do
|
||||
desc "Run rubocop (Ruby)"
|
||||
task :rubocop do
|
||||
sh "bundle exec rubocop -A"
|
||||
end
|
||||
|
||||
desc "Run eslint (TypeScript)"
|
||||
task :eslint do
|
||||
sh "npm run eslint"
|
||||
end
|
||||
|
||||
desc "Run prettier (TypeScript)"
|
||||
task :prettier do
|
||||
sh "npm run prettier"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Run all linters"
|
||||
task linter: ["linter:rubocop", "linter:eslint", "linter:prettier"]
|
Loading…
Reference in a new issue