Skip to content

Commit

Permalink
Fix stylelint violations
Browse files Browse the repository at this point in the history
In #1148 we introduce `stylelint`. However, the empty styles introduced
in #1145 are empty file violations. By adding comments, we avoid that
error.

Note that we need to add these comments because there's no way to
automatically fix those violations with something like `prettier`.
  • Loading branch information
stevepolitodesign committed Dec 11, 2023
1 parent cb5dff8 commit 633b919
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/generators/suspenders/styles_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ def build_directory_structure
return if is_tailwind?

create_file "app/assets/stylesheets/base.css"
append_to_file "app/assets/stylesheets/base.css", "/* Base Styles */"

create_file "app/assets/stylesheets/components.css"
append_to_file "app/assets/stylesheets/components.css", "/* Component Styles */"

create_file "app/assets/stylesheets/utilities.css"
append_to_file "app/assets/stylesheets/utilities.css", "/* Utility Styles */"
end

# Modify if https://github.com/rails/cssbundling-rails/pull/139 is merged
Expand Down
12 changes: 9 additions & 3 deletions test/generators/suspenders/styles_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,15 @@ class StylesGenerator::PostCssTest < Rails::Generators::TestCase
test "creates stylesheets" do
run_generator

assert_file app_root("app/assets/stylesheets/base.css")
assert_file app_root("app/assets/stylesheets/components.css")
assert_file app_root("app/assets/stylesheets/utilities.css")
assert_file app_root("app/assets/stylesheets/base.css") do |file|
assert_equal "/* Base Styles */", file
end
assert_file app_root("app/assets/stylesheets/components.css") do |file|
assert_equal "/* Component Styles */", file
end
assert_file app_root("app/assets/stylesheets/utilities.css") do |file|
assert_equal "/* Utility Styles */", file
end
end

private
Expand Down

0 comments on commit 633b919

Please sign in to comment.