DEV: Prefer \A and \z over ^ and $ in regexes (#19936)

This commit is contained in:
Daniel Waterworth
2023-01-20 12:52:49 -06:00
committed by GitHub
parent f7907a3645
commit 666536cbd1
115 changed files with 294 additions and 291 deletions

View File

@ -200,7 +200,7 @@ class ThemeJavascriptCompiler
end
def raw_template_name(name)
name = name.sub(/\.(raw|hbr)$/, "")
name = name.sub(/\.(raw|hbr)\z/, "")
name.inspect
end
@ -228,7 +228,7 @@ class ThemeJavascriptCompiler
def append_module(script, name, include_variables: true)
original_filename = name
name = "discourse/theme-#{@theme_id}/#{name.gsub(%r{^discourse/}, "")}"
name = "discourse/theme-#{@theme_id}/#{name.gsub(%r{\Adiscourse/}, "")}"
script = "#{theme_settings}#{script}" if include_variables
transpiler = DiscourseJsProcessor::Transpiler.new