From 665178cf6111616390d7bb411c253b7212c3a812 Mon Sep 17 00:00:00 2001 From: Steve Polito Date: Fri, 22 Mar 2024 12:20:46 -0400 Subject: [PATCH] Lint Generator: Introduce `.prettierignore` (#1170) The upcoming `suspenders:ci` generator caches Ruby dependencies in `vendor/bundle`. This commit ensures we ignore that path. --- lib/generators/suspenders/lint_generator.rb | 1 + lib/generators/templates/lint/prettierignore | 1 + test/generators/suspenders/lint_generator_test.rb | 8 ++++++++ 3 files changed, 10 insertions(+) create mode 100644 lib/generators/templates/lint/prettierignore diff --git a/lib/generators/suspenders/lint_generator.rb b/lib/generators/suspenders/lint_generator.rb index bd71a5e3b..af81b5731 100644 --- a/lib/generators/suspenders/lint_generator.rb +++ b/lib/generators/suspenders/lint_generator.rb @@ -30,6 +30,7 @@ def configure_eslint def configure_prettier copy_file "prettierrc", ".prettierrc" + copy_file "prettierignore", ".prettierignore" end def configure_erb_lint diff --git a/lib/generators/templates/lint/prettierignore b/lib/generators/templates/lint/prettierignore new file mode 100644 index 000000000..f2056e58e --- /dev/null +++ b/lib/generators/templates/lint/prettierignore @@ -0,0 +1 @@ +vendor/bundle/** diff --git a/test/generators/suspenders/lint_generator_test.rb b/test/generators/suspenders/lint_generator_test.rb index 2bed402ff..7bc82f6ec 100644 --- a/test/generators/suspenders/lint_generator_test.rb +++ b/test/generators/suspenders/lint_generator_test.rb @@ -91,6 +91,14 @@ class LintGeneratorTest < Rails::Generators::TestCase assert_file app_root(".prettierrc") do |file| assert_equal expected_content, file end + + assert_file app_root(".prettierignore") do |file| + expected = <<~TEXT + vendor/bundle/** + TEXT + + assert_equal expected, file + end end test "configures erb-lint" do