From c98b63b2dd5eb6fb387b5c2b2946719eaa6659da Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Thu, 19 Sep 2024 14:50:48 +0200 Subject: [PATCH 1/2] Update development dependencies --- CHANGELOG.md | 4 ++++ package.json | 6 +++--- test/javascript/public/test/validators/confirmation.js | 2 +- test/javascript/server.rb | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bbaab9bf..899247385 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## main / unreleased + +* [ENHANCEMENT] Update QUnit to 2.22.0 + ## 22.2.0 / 2026-06-01 * [FEATURE] Allow Rails 8.0 alpha diff --git a/package.json b/package.json index 0d39cf42f..7e2231fe5 100644 --- a/package.json +++ b/package.json @@ -27,10 +27,10 @@ "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-node-resolve": "^15.2.2", "chrome-launcher": "^1.1.2", - "puppeteer-core": "^23.2.0", - "rollup": "^4.21.1", + "puppeteer-core": "^23.4.0", + "rollup": "^4.22.0", "rollup-plugin-copy": "^3.5.0", - "standard": "^17.1.0" + "standard": "^17.1.2" }, "dependencies": {}, "peerDependencies": { diff --git a/test/javascript/public/test/validators/confirmation.js b/test/javascript/public/test/validators/confirmation.js index 1ac979209..52685f4ae 100644 --- a/test/javascript/public/test/validators/confirmation.js +++ b/test/javascript/public/test/validators/confirmation.js @@ -1,7 +1,7 @@ QUnit.module('Confirmation options', { beforeEach: function () { $('#qunit-fixture') - .append('') + .append('') .append('') .append('') .append('') diff --git a/test/javascript/server.rb b/test/javascript/server.rb index ab6dcb291..5ee808aa5 100644 --- a/test/javascript/server.rb +++ b/test/javascript/server.rb @@ -30,7 +30,7 @@ def call(env) use AssetPath, urls: ['/vendor/assets/javascripts'], root: File.expand_path('../', $LOAD_PATH.find { |p| p.include?('jquery-rails') }) DEFAULT_JQUERY_VERSION = '3.7.1' -QUNIT_VERSION = '2.21.0' +QUNIT_VERSION = '2.22.0' helpers do def jquery_version From 15f0bce0829cf4ad64268e9bd2d548856b6f4a43 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Thu, 19 Sep 2024 14:57:20 +0200 Subject: [PATCH 2/2] Prefer `require_relative` for internal requires `require_relative` is preferred over `require` for files within the same project because it uses paths relative to the current file, making code more portable and less dependent on the load path. This change updates internal requires to use `require_relative` for consistency, performance, and improved portability. Ref: - rubocop/rubocop#8748 --- CHANGELOG.md | 1 + lib/client_side_validations.rb | 12 ++++++------ lib/client_side_validations/action_view.rb | 8 ++++---- lib/client_side_validations/active_model.rb | 6 +++--- lib/client_side_validations/active_record.rb | 3 +-- lib/client_side_validations/core_ext.rb | 5 +++-- lib/client_side_validations/generators.rb | 2 +- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 899247385..ed6691382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## main / unreleased * [ENHANCEMENT] Update QUnit to 2.22.0 +* [ENHANCEMENT] Prefer `require_relative` for internal requires ## 22.2.0 / 2026-06-01 diff --git a/lib/client_side_validations.rb b/lib/client_side_validations.rb index 4241790a0..6ac6ead22 100644 --- a/lib/client_side_validations.rb +++ b/lib/client_side_validations.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -require 'client_side_validations/config' -require 'client_side_validations/active_model' if defined?(ActiveModel) -require 'client_side_validations/active_record' if defined?(ActiveRecord) -require 'client_side_validations/action_view' if defined?(ActionView) +require_relative 'client_side_validations/config' +require_relative 'client_side_validations/active_model' if defined?(ActiveModel) +require_relative 'client_side_validations/active_record' if defined?(ActiveRecord) +require_relative 'client_side_validations/action_view' if defined?(ActionView) if defined?(Rails) - require 'client_side_validations/engine' - require 'client_side_validations/generators' + require_relative 'client_side_validations/engine' + require_relative 'client_side_validations/generators' end diff --git a/lib/client_side_validations/action_view.rb b/lib/client_side_validations/action_view.rb index 1d808cf7b..71a805ca1 100644 --- a/lib/client_side_validations/action_view.rb +++ b/lib/client_side_validations/action_view.rb @@ -7,14 +7,14 @@ module Helpers end end -require 'client_side_validations/core_ext' -require 'client_side_validations/action_view/form_helper' +require_relative 'core_ext' +require_relative 'action_view/form_helper' if ActionView::Helpers::FormHelper.method_defined?(:form_with) - require 'client_side_validations/action_view/form_with_helper' + require_relative 'action_view/form_with_helper' end -require 'client_side_validations/action_view/form_builder' +require_relative 'action_view/form_builder' ActiveSupport.on_load(:action_view) { include ClientSideValidations::ActionView::Helpers::FormHelper } ActionView::Helpers::FormBuilder.prepend ClientSideValidations::ActionView::Helpers::FormBuilder diff --git a/lib/client_side_validations/active_model.rb b/lib/client_side_validations/active_model.rb index a492f6dbb..d9a1bf074 100644 --- a/lib/client_side_validations/active_model.rb +++ b/lib/client_side_validations/active_model.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require 'client_side_validations/core_ext' -require 'client_side_validations/extender' -require 'client_side_validations/active_model/conditionals' +require_relative 'core_ext' +require_relative 'extender' +require_relative 'active_model/conditionals' module ClientSideValidations module ActiveModel diff --git a/lib/client_side_validations/active_record.rb b/lib/client_side_validations/active_record.rb index a5afffd97..98160fe35 100644 --- a/lib/client_side_validations/active_record.rb +++ b/lib/client_side_validations/active_record.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -require 'client_side_validations/active_model' -require 'client_side_validations/extender' +require_relative 'active_model' ActiveSupport.on_load(:active_record) { include ClientSideValidations::ActiveModel::Validations } diff --git a/lib/client_side_validations/core_ext.rb b/lib/client_side_validations/core_ext.rb index 21166651d..9cadab944 100644 --- a/lib/client_side_validations/core_ext.rb +++ b/lib/client_side_validations/core_ext.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true require 'active_support/json' -require 'client_side_validations/core_ext/range' -require 'client_side_validations/core_ext/regexp' + +require_relative 'core_ext/range' +require_relative 'core_ext/regexp' diff --git a/lib/client_side_validations/generators.rb b/lib/client_side_validations/generators.rb index 9a8d376e6..76070741f 100644 --- a/lib/client_side_validations/generators.rb +++ b/lib/client_side_validations/generators.rb @@ -14,4 +14,4 @@ def self.assets end end -require 'client_side_validations/generators/rails_validations' +require_relative 'generators/rails_validations'