Fix format offenses

This commit is contained in:
0x1eef 2024-05-02 10:46:40 -03:00
parent 9c7ca2e7cc
commit 4f282e12f2
7 changed files with 18 additions and 14 deletions

View file

@ -7,7 +7,7 @@ require "yaml"
##
# Rake tasks
load "rake/tasks/deploy.rake"
load "rake/tasks/linter.rake"
load "rake/tasks/format.rake"
load "rake/tasks/nanoc.rake"
load "rake/tasks/submodules.rake"
@ -16,11 +16,11 @@ task :server, [:protocol] do |_t, args|
require "server"
nanoc = Ryo.from(YAML.load_file("./nanoc.yaml"))
h = args.to_h
o = if h[:protocol] == 'unix'
{unix: nanoc.server.unix.path}
else
{host: nanoc.server.tcp.host, port: nanoc.server.tcp.port}
end
o = if h[:protocol] == "unix"
{unix: nanoc.server.unix.path}
else
{host: nanoc.server.tcp.host, port: nanoc.server.tcp.port}
end
s = Server.dir(nanoc.output_dir, o)
s.start(block: true)
rescue Interrupt

2
Rules
View file

@ -43,7 +43,7 @@ end
# /sitemap.xml
compile "/sitemap.xml.erb" do
filter(:erb, locals: {locales:, name_by_id:})
filter Proc.new { _1.each_line.reject { |s| s.strip.empty? }.join }
filter proc { _1.each_line.reject { |s| s.strip.empty? }.join }
write("/sitemap.xml")
end

View file

@ -9,7 +9,7 @@ module Mixin
def app_version
@app_version ||= begin
ver = File.read File.join(Dir.getwd, "VERSION")
ver.gsub(/[^\d.]/, '')
ver.gsub(/[^\d.]/, "")
end
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Nanoc::RuleDSL
module Filter
##
@ -28,9 +30,9 @@ module Nanoc::RuleDSL
private
def random_id
name = item.identifier.to_s.gsub(%r|[./\\]|, "_")[/[A-Za-z0-9_]+/]
name = item.identifier.to_s.gsub(%r{[./\\]}, "_")[/[A-Za-z0-9_]+/]
random = SecureRandom.alphanumeric
"__nanoc_#{name}_#{random}".to_sym
:"__nanoc_#{name}_#{random}"
end
end
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Nanoc::RuleDSL
module RequireRules
##

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
namespace :linter do
namespace :format do
desc "Run rubocop (Ruby)"
task :rubocop do
sh "bundle exec rubocop -A"
@ -17,5 +17,5 @@ namespace :linter do
end
end
desc "Run all linters"
task linter: ["linter:rubocop", "linter:eslint", "linter:prettier"]
desc "Run all formats"
task format: ["format:rubocop", "format:eslint", "format:prettier"]

View file

@ -1,5 +1,5 @@
import React, { useEffect } from "react";
import type { Surah, Ayah, TLocale, TAyat } from "Quran";
import type { Surah, Ayah, TLocale } from "Quran";
import { formatNumber } from "~/lib/t";
type Maybe<T> = T | null | undefined;