Fix inline JavaScript HAML linter not working
What does this MR do and why?
In https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28570, we
moved the haml_lint
directory out of an auto-load path to avoid a
startup failure in production (gitlab-foss#62125 (closed)). However,
inline_javascript.rb
used require_dependency
, which is meant for
auto-loading and should not be mixed with require
. As a result, the
linter registry was being reset twice: once for the require_dependency
call and once for the require
call. This effectively dropped the
inline JavaScript linter.
https://guides.rubyonrails.org/v5.2/autoloading_and_reloading_constants.html#autoloading-and-require says:
Just follow the flow and use constant autoloading always, never mix autoloading and
require
.
All these problems are solved in zeitwerk mode, it just works as expected, and
require_dependency
should not be used anymore, it is no longer needed.
Closes #342479 (closed)
Screenshots or screen recordings
See #342479 (closed).
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.