Skip to content

Commit ce98bed

Browse files
ihabadhamgithub-actions[bot]justin808claude
committed
Replace scss-lint with stylelint (#1825)
## Summary - Replace deprecated scss-lint with modern stylelint - Remove scss_lint gem dependency and configuration files - Add stylelint and stylelint-config-standard-scss npm packages - Create .stylelintrc.json configuration matching original scss-lint rules - Update rake tasks to use stylelint instead of scss-lint - Add stylelint to CI workflow (lint-js-and-ruby.yml) - Include SCSS linting in main rake lint task and autofix task - Add yarn script 'lint:scss' for running stylelint ## Configuration Philosophy Maintains the original minimal approach - only enables essential CSS validation rules while disabling formatting rules, matching the original scss-lint configuration philosophy. ## Test Plan - [x] Stylelint runs without errors on all SCSS files - [x] Configuration disables unwanted formatting rules - [x] Rake tasks work correctly with new linter - [x] CI integration functions properly Fixes #1688 🤖 Generated with [Claude Code](https://claude.ai/code) <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/1825) <!-- Reviewable:end --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - Chores - Migrated SCSS linting from the legacy linter to Stylelint with the standard SCSS config. - Added Stylelint dev dependencies, a lint:scss script and autofix support. - Updated lint tasks and Docker orchestration to run Stylelint alongside other linters. - Removed legacy SCSS linter configuration, development dependency and binstub. - Added ignore patterns to scope Stylelint to relevant files. - CI - Added a CI step to run SCSS linting with Stylelint. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Justin Gordon <justin808@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Justin Gordon <justin@shakacode.com>
1 parent 29f2b61 commit ce98bed

File tree

10 files changed

+630
-325
lines changed

10 files changed

+630
-325
lines changed

.github/workflows/lint-js-and-ruby.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ jobs:
134134
run: yarn run eslint --report-unused-disable-directives
135135
- name: Check formatting
136136
run: yarn start format.listDifferent
137+
- name: Lint SCSS with stylelint
138+
run: yarn run lint:scss
137139
- name: Type-check TypeScript
138140
run: yarn run type-check
139141
- name: Pack for attw and publint

.scss-lint.yml

Lines changed: 0 additions & 205 deletions
This file was deleted.

.stylelintrc.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"extends": "stylelint-config-standard-scss",
3+
"rules": {
4+
"color-named": null,
5+
"color-hex-length": "long",
6+
"selector-id-pattern": null,
7+
"scss/at-rule-no-unknown": [
8+
true,
9+
{
10+
"ignoreAtRules": [
11+
"include",
12+
"mixin",
13+
"each",
14+
"if",
15+
"else",
16+
"for",
17+
"while",
18+
"function",
19+
"return",
20+
"use",
21+
"forward"
22+
]
23+
}
24+
],
25+
"selector-class-pattern": null,
26+
"custom-property-pattern": null,
27+
"keyframes-name-pattern": null,
28+
"scss/percent-placeholder-pattern": null,
29+
"scss/dollar-variable-pattern": null,
30+
"scss/at-function-pattern": null,
31+
"scss/at-mixin-pattern": null,
32+
"import-notation": null,
33+
"at-rule-empty-line-before": null,
34+
"font-family-name-quotes": null,
35+
"rule-empty-line-before": null,
36+
"scss/dollar-variable-empty-line-before": null,
37+
"function-url-quotes": null
38+
},
39+
"ignoreFiles": [
40+
"spec/dummy/app/assets/stylesheets/application.css",
41+
"**/*.js",
42+
"**/*.jsx",
43+
"**/*.ts",
44+
"**/*.tsx"
45+
]
46+
}

Gemfile.development_dependencies

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ group :development, :test do
3838
gem "rubocop", "1.61.0", require: false
3939
gem "rubocop-performance", "~>1.20.0", require: false
4040
gem "rubocop-rspec", "~>2.26", require: false
41-
gem "scss_lint", require: false
4241
gem "spring", "~> 4.0"
4342
gem "lefthook", require: false
4443
# Added for Ruby 3.5+ compatibility to silence warnings

Gemfile.lock

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,6 @@ GEM
332332
rubocop (~> 1.40)
333333
ruby-progressbar (1.13.0)
334334
rubyzip (2.3.2)
335-
sass (3.7.4)
336-
sass-listen (~> 4.0.0)
337-
sass-listen (4.0.0)
338-
rb-fsevent (~> 0.9, >= 0.9.4)
339-
rb-inotify (~> 0.9, >= 0.9.7)
340335
sass-rails (6.0.0)
341336
sassc-rails (~> 2.1, >= 2.1.1)
342337
sassc (2.4.0)
@@ -347,8 +342,6 @@ GEM
347342
sprockets (> 3.0)
348343
sprockets-rails
349344
tilt
350-
scss_lint (0.60.0)
351-
sass (~> 3.5, >= 3.5.5)
352345
sdoc (2.6.1)
353346
rdoc (>= 5.0)
354347
securerandom (0.4.1)
@@ -473,7 +466,6 @@ DEPENDENCIES
473466
rubocop-performance (~> 1.20.0)
474467
rubocop-rspec (~> 2.26)
475468
sass-rails (~> 6.0)
476-
scss_lint
477469
sdoc
478470
selenium-webdriver (= 4.9.0)
479471
shakapacker (= 9.3.0)

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
"react-dom": "^19.0.0",
5656
"react-on-rails-rsc": "19.0.2",
5757
"redux": "^4.2.1",
58+
"stylelint": "^16.14.0",
59+
"stylelint-config-standard-scss": "^13.1.0",
5860
"swc-loader": "^0.2.6",
5961
"ts-jest": "^29.2.5",
6062
"typescript": "^5.8.3",
@@ -67,6 +69,7 @@
6769
"build": "yarn workspace react-on-rails run build && yarn workspace react-on-rails-pro run build",
6870
"build-watch": "yarn workspaces run build-watch",
6971
"lint": "nps eslint",
72+
"lint:scss": "stylelint \"spec/dummy/app/assets/stylesheets/**/*.scss\" \"spec/dummy/client/**/*.scss\"",
7073
"check": "yarn run lint && yarn workspaces run check",
7174
"type-check": "yarn workspaces run type-check",
7275
"yalc:publish": "yarn workspaces run yalc:publish",

rakelib/docker.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace :docker do
66
sh "docker-compose run lint rake lint:rubocop"
77
end
88

9-
desc "Run scss-lint linter from docker"
9+
desc "Run stylelint linter from docker"
1010
task :scss do
1111
sh "docker-compose run lint rake lint:scss"
1212
end

rakelib/lint.rake

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,47 @@
22

33
require_relative "task_helpers"
44

5-
namespace :lint do
5+
namespace :lint do # rubocop:disable Metrics/BlockLength
66
include ReactOnRails::TaskHelpers
77

88
desc "Run Rubocop as shell"
99
task :rubocop do
1010
sh_in_dir(gem_root, "bundle exec rubocop --version", "bundle exec rubocop .")
1111
end
1212

13-
desc "Run scss-lint as shell"
13+
desc "Run stylelint as shell"
1414
task :scss do
15-
sh_in_dir(gem_root, "bundle exec scss-lint spec/dummy/app/assets/stylesheets/")
15+
sh_in_dir(gem_root, stylelint_command)
1616
end
1717

1818
desc "Run eslint as shell"
1919
task :eslint do
2020
sh_in_dir(gem_root, "yarn run eslint --version", "yarn run eslint .")
2121
end
2222

23-
desc "Run all eslint & rubocop linters. Skip scss"
24-
task lint: %i[eslint rubocop] do
23+
desc "Run all eslint, rubocop & stylelint linters"
24+
task lint: %i[eslint rubocop scss] do
2525
puts "Completed all linting"
2626
end
2727

2828
desc "Auto-fix all linting violations"
2929
task :autofix do
3030
sh_in_dir(gem_root, "yarn run eslint . --fix")
3131
sh_in_dir(gem_root, "yarn run prettier --write .")
32+
sh_in_dir(gem_root, stylelint_fix_command)
3233
sh_in_dir(gem_root, "bundle exec rubocop -A")
3334
puts "Completed auto-fixing all linting violations"
3435
end
36+
37+
private
38+
39+
def stylelint_command
40+
"yarn run stylelint \"spec/dummy/app/assets/stylesheets/**/*.scss\" \"spec/dummy/client/**/*.scss\""
41+
end
42+
43+
def stylelint_fix_command
44+
"#{stylelint_command} --fix"
45+
end
3546
end
3647

3748
desc "Runs all linters. Run `rake -D lint` to see all available lint options"

0 commit comments

Comments
 (0)