From 47ea981ddd56fd780d86b220257c26457971e2b1 Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Sat, 6 Apr 2024 02:26:43 +0330 Subject: [PATCH] Fix rubocop to v1.61 & css-loader to v6 (#1606) This is to prevent linting issues with newer versions. This can prevent annoying CI failures. This is a minimal and temporary fix to prevent breaking changes in css-loader v7 --- Gemfile.development_dependencies | 2 +- lib/generators/react_on_rails/base_generator.rb | 2 +- lib/react_on_rails/git_utils.rb | 2 +- spec/react_on_rails/git_utils_spec.rb | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.development_dependencies b/Gemfile.development_dependencies index c9f370b5d..58079b398 100644 --- a/Gemfile.development_dependencies +++ b/Gemfile.development_dependencies @@ -30,7 +30,7 @@ group :development, :test do gem "pry-doc" gem "pry-rails" gem "pry-rescue" - gem "rubocop", "~>1.59", require: false + gem "rubocop", "1.61.0", require: false gem "rubocop-performance", "~>1.20.0", require: false gem "rubocop-rspec", "~>2.26", require: false gem "scss_lint", require: false diff --git a/lib/generators/react_on_rails/base_generator.rb b/lib/generators/react_on_rails/base_generator.rb index ed4da51f2..31248b49d 100644 --- a/lib/generators/react_on_rails/base_generator.rb +++ b/lib/generators/react_on_rails/base_generator.rb @@ -99,7 +99,7 @@ def add_yarn_dependencies css_minimizer_webpack_plugin_version = node_major_version >= 18 ? "" : "@<6.0.0" css_minimizer_webpack_plugin = "css-minimizer-webpack-plugin#{css_minimizer_webpack_plugin_version}" - run "yarn add css-loader '#{css_minimizer_webpack_plugin}' mini-css-extract-plugin style-loader" + run "yarn add 'css-loader@<7.0.0' '#{css_minimizer_webpack_plugin}' mini-css-extract-plugin style-loader" puts "Adding dev dependencies" run "yarn add -D @pmmmwh/react-refresh-webpack-plugin react-refresh" diff --git a/lib/react_on_rails/git_utils.rb b/lib/react_on_rails/git_utils.rb index e4bfb22a0..98364b118 100644 --- a/lib/react_on_rails/git_utils.rb +++ b/lib/react_on_rails/git_utils.rb @@ -4,7 +4,7 @@ module ReactOnRails module GitUtils - def self.uncommitted_changes?(message_handler, git_installed = true) + def self.uncommitted_changes?(message_handler, git_installed: true) return false if ENV["COVERAGE"] == "true" status = `git status --porcelain` diff --git a/spec/react_on_rails/git_utils_spec.rb b/spec/react_on_rails/git_utils_spec.rb index 8ccca49d4..4f8927437 100644 --- a/spec/react_on_rails/git_utils_spec.rb +++ b/spec/react_on_rails/git_utils_spec.rb @@ -13,7 +13,7 @@ module ReactOnRails expect(message_handler).to receive(:add_error) .with("You have uncommitted code. Please commit or stash your changes before continuing") - expect(described_class.uncommitted_changes?(message_handler, true)).to be(true) + expect(described_class.uncommitted_changes?(message_handler, git_installed: true)).to be(true) end end @@ -24,7 +24,7 @@ module ReactOnRails allow(described_class).to receive(:`).with("git status --porcelain").and_return("") expect(message_handler).not_to receive(:add_error) - expect(described_class.uncommitted_changes?(message_handler, true)).to be(false) + expect(described_class.uncommitted_changes?(message_handler, git_installed: true)).to be(false) end end @@ -36,7 +36,7 @@ module ReactOnRails expect(message_handler).to receive(:add_error) .with("You do not have Git installed. Please install Git, and commit your changes before continuing") - expect(described_class.uncommitted_changes?(message_handler, false)).to be(true) + expect(described_class.uncommitted_changes?(message_handler, git_installed: false)).to be(true) end end end