Skip to content

docs: Fix CSS Modules exportLocalsConvention documentation#626

Merged
justin808 merged 7 commits into
mainfrom
justin808/fix-css-modules-docs
Oct 3, 2025
Merged

docs: Fix CSS Modules exportLocalsConvention documentation#626
justin808 merged 7 commits into
mainfrom
justin808/fix-css-modules-docs

Conversation

@justin808

@justin808 justin808 commented Oct 3, 2025

Copy link
Copy Markdown
Member

Summary

Fixes the v9 upgrade documentation to correctly specify exportLocalsConvention: 'camelCaseOnly' instead of 'camelCase' when namedExport: true is enabled.

Problem

The documentation incorrectly suggested using exportLocalsConvention: 'camelCase', but css-loader requires either 'camelCaseOnly' or 'dashesOnly' when namedExport: true is enabled. This caused build errors for users following the upgrade guide.

Changes

docs/v9_upgrade.md

  • Updated breaking changes section to specify 'camelCaseOnly' instead of 'camelCase'
  • Added warning about css-loader compatibility requirements with clear error message
  • Enhanced Step 3 to explain the difference between 'camelCase' and 'camelCaseOnly'
  • Added new troubleshooting section with detailed solution for the build error

docs/css-modules-export-mode.md

  • Added comprehensive "Important: exportLocalsConvention with namedExport" section
  • Included error message examples and correct configuration
  • Clarified the difference between 'camelCase' (both versions) and 'camelCaseOnly' (only camelCase)
  • Updated version comparison table to show 'camelCaseOnly'
  • Added troubleshooting section at the top with the build error solution

Impact

Users upgrading to v9 will now have correct configuration examples and clear guidance when they encounter the compatibility error.

Fixes #622

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated CSS Modules guidance for v9: default exportLocalsConvention is now “camelCaseOnly.”
    • Added note that with namedExport enabled, only “camelCaseOnly” or “dashesOnly” are supported; using “camelCase” triggers a build error.
    • Expanded Troubleshooting with the incompatibility error, causes, and fixes, plus a new build-error scenario and examples.
    • Clarified that “camelCaseOnly” does not export original kebab-case names and how conversions work.
    • Updated Version Comparison, migration steps, examples, and added peer dependency warning guidance for npm/yarn/pnpm/Bun.

Corrects the v9 upgrade documentation to specify 'camelCaseOnly' instead of
'camelCase' for exportLocalsConvention when namedExport: true is enabled.

Changes:
- Update v9_upgrade.md to use 'camelCaseOnly' in configuration examples
- Add warning about css-loader compatibility requirements
- Clarify difference between 'camelCase' and 'camelCaseOnly'
- Add troubleshooting section for build errors
- Update css-modules-export-mode.md with detailed explanation
- Add error message examples and solutions

This addresses the issue where users following the docs would encounter:
"exportLocalsConvention" with "camelCase" value is incompatible with
"namedExport: true" option

Fixes #622

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 3, 2025

Copy link
Copy Markdown

Warning

Rate limit exceeded

@justin808 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 4728cc1 and 60ef7ff.

📒 Files selected for processing (9)
  • CHANGELOG.md (1 hunks)
  • TODO_v9.md (2 hunks)
  • docs/css-modules-export-mode.md (6 hunks)
  • docs/v9_upgrade.md (4 hunks)
  • lib/shakapacker/doctor.rb (2 hunks)
  • package/utils/getStyleRule.ts (2 hunks)
  • spec/shakapacker/css_modules_spec.rb (2 hunks)
  • spec/shakapacker/doctor_spec.rb (1 hunks)
  • tools/README.md (2 hunks)

Walkthrough

Documentation updates clarify CSS Modules behavior in v9: default exportLocalsConvention is changed to 'camelCaseOnly', constraints when namedExport is true are documented, error scenarios and troubleshooting are added, and examples/migration guidance are expanded in css-modules and v9 upgrade docs.

Changes

Cohort / File(s) Summary
CSS Modules docs
docs/css-modules-export-mode.md
Adds guidance on using namedExport with exportLocalsConvention ('camelCaseOnly' or 'dashesOnly'), clarifies camelCase vs camelCaseOnly behavior, updates version comparison, provides error message example and resolutions, and adds migration examples/codemod notes.
v9 upgrade guide
docs/v9_upgrade.md
Revises default to exportLocalsConvention: 'camelCaseOnly', adds required pairing with namedExport, updates examples and warnings, introduces troubleshooting for incompatibility error, and expands peer dependency warning guidance.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • tomdracz

Poem

A nibble of docs, a hop through v9 lands,
CamelCaseOnly footprints in the sands.
Named exports aligned, no dashes astray,
Errors now mapped, we bound them away.
Thump-thump! says the build, green lights aglow—
This bunny ships truth in every row. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The changes correctly document the requirement for exportLocalsConvention to be camelCaseOnly or dashesOnly with namedExport, explain the difference between camelCase and camelCaseOnly, and add a troubleshooting section with the exact error and recommended fixes, but there is no example patch for overriding the Shakapacker default in commonWebpackConfig.js as specified in issue #622. Include an example in the documentation showing how to override the default Shakapacker webpack configuration by patching commonWebpackConfig.js to fully satisfy issue #622.
Out of Scope Changes Check ⚠️ Warning The pull request expands the Unexpected Peer Dependency Warnings section with detailed npm/yarn/pnpm/Bun guidance, which falls outside the scope of the CSS Modules exportLocalsConvention documentation fixes required by issue #622. Separate or remove the peer dependency warnings enhancements into a dedicated documentation update, keeping this PR focused solely on the exportLocalsConvention changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit's high-level summary is enabled.
Title Check ✅ Passed The pull request title succinctly and accurately describes the main change of fixing the CSS Modules exportLocalsConvention documentation, matching the content and scope of the updates.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

PR Review: CSS Modules exportLocalsConvention Documentation Fix

Summary

This PR correctly fixes a critical documentation error where the v9 upgrade guide incorrectly specified exportLocalsConvention: 'camelCase' when it should be 'camelCaseOnly' for use with namedExport: true. This was causing build errors for users upgrading to v9.


✅ Strengths

  1. Addresses a Real User Pain Point: The PR fixes issue Documentation: CSS Modules exportLocalsConvention requirement not documented in v9 upgrade guide #622, which documents an actual build error users encounter when following the v9 upgrade guide.

  2. Comprehensive Documentation Updates:

    • Both docs/v9_upgrade.md and docs/css-modules-export-mode.md are updated
    • Clear explanations of the difference between 'camelCase' and 'camelCaseOnly'
    • Helpful error messages and troubleshooting sections added
  3. Well-Structured Troubleshooting: The new troubleshooting sections include:

    • The exact error message users will see
    • Clear cause and solution
    • Alternative approaches for different needs
  4. Proper Cross-Referencing: Good use of documentation links between files for users who need more details.


🔍 Issues & Concerns

1. Critical: TODO_v9.md Not Updated

The file TODO_v9.md:23 still contains the incorrect value:

exportLocalsConvention: 'camelCase'  // ❌ Should be 'camelCaseOnly'

This file should be updated for consistency, or clarified if it's documenting historical/planned behavior.

File location: TODO_v9.md:23

2. Potential Inconsistency: CHANGELOG.md

The CHANGELOG.md:96 states:

Configured with namedExport: true and exportLocalsConvention: 'camelCase'

This appears to be the same documentation error. Should this also be corrected to 'camelCaseOnly'?

File location: CHANGELOG.md:96

3. Actual Code Configuration Unclear

The actual webpack configuration in package/utils/getStyleRule.ts:35-37 only shows:

modules: {
  auto: true
}

Questions:

  • Where is namedExport: true and exportLocalsConvention: 'camelCaseOnly' actually configured?
  • Is there a separate v9-specific configuration file that sets these defaults?
  • If the code doesn't actually set these values, is this documentation aspirational or is there missing implementation?

4. Missing Test Coverage

There don't appear to be any automated tests validating:

  • That the CSS loader is actually configured with namedExport: true and exportLocalsConvention: 'camelCaseOnly'
  • That builds fail with the expected error when using 'camelCase' with namedExport: true
  • That the documented configurations actually work

While spec/shakapacker/css_modules_spec.rb exists and mentions these concepts, it would be valuable to add integration tests that verify the actual webpack/rspack configuration matches the documentation.


📝 Suggestions

  1. Update TODO_v9.md to use 'camelCaseOnly' for consistency
  2. Update CHANGELOG.md:96 to correct the historical record
  3. Add a comment or documentation explaining where namedExport and exportLocalsConvention are actually configured in the codebase
  4. Consider adding integration tests that validate the CSS modules configuration produces the expected behavior

🔒 Security

No security concerns identified. This is purely a documentation fix.


⚡ Performance

No performance impact - documentation only.


📊 Test Coverage Assessment

  • ✅ The documentation changes are clear and helpful
  • ⚠️ Missing automated tests to verify the configuration actually works as documented
  • ⚠️ No validation that the actual code implements what the docs claim

Final Recommendation

Approve with requested changes - The documentation fixes are valuable and correct, but the following should be addressed:

Must Fix:

  1. Update TODO_v9.md:23 to use 'camelCaseOnly'
  2. Update CHANGELOG.md:96 to use 'camelCaseOnly'
  3. Verify/document where namedExport and exportLocalsConvention are actually set in the code

Nice to Have:
4. Add integration tests validating the CSS modules configuration

Great work identifying and fixing this documentation bug! This will save users from frustrating build errors. 👍

@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Code Review: Documentation Fix for CSS Modules exportLocalsConvention

Summary

This PR addresses issue #622 by correcting the documentation around the exportLocalsConvention configuration requirement when namedExport: true is enabled in v9. The changes are documentation-only and provide crucial guidance to prevent build errors during upgrades.

✅ Strengths

1. Comprehensive Coverage

  • Updates both the v9 upgrade guide and the detailed CSS modules documentation
  • Addresses the root cause with clear explanations of the difference between 'camelCase' and 'camelCaseOnly'
  • Adds troubleshooting sections with the exact error message users will encounter

2. User-Focused Improvements

  • Includes actual error messages users will see, making it easy to search/find the solution
  • Provides clear "Important" callouts at critical decision points
  • Shows both the incorrect configuration (with ❌) and correct configuration (with ✅)
  • Explains the "why" behind the requirement

3. Well-Structured

  • Logical placement of information (breaking changes section, migration steps, troubleshooting)
  • Consistent formatting and terminology throughout both files
  • Good use of code examples showing before/after

📋 Code Quality Assessment

Documentation Standards: ✅ Excellent

  • Clear, concise language
  • Proper markdown formatting
  • Code examples are syntactically correct
  • Consistent terminology

Accuracy: ✅ Verified

  • The technical details about css-loader requirements are correct
  • The difference between 'camelCase' and 'camelCaseOnly' is accurately explained
  • Configuration examples align with css-loader documentation

🔍 Detailed Observations

docs/v9_upgrade.md

  • Line 22: Good addition of the Important warning right at the breaking changes section
  • Lines 208-213: The explanation of why 'camelCaseOnly' doesn't export kebab-case names is valuable
  • Lines 260-277: The new troubleshooting section provides exactly what users need when they hit the error

docs/css-modules-export-mode.md

  • Lines 35-66: Excellent placement of the compatibility section early in the document
  • Lines 60-63: The side-by-side comparison of 'camelCase' vs 'camelCaseOnly' is very clear
  • Line 247: Good update from the incorrect 'camelCase' to 'camelCaseOnly' in the migration guide
  • Line 293: Important clarification that original kebab-case names are NOT exported

⚠️ Minor Observations (Not Blocking)

1. Table Formatting Inconsistency
In docs/css-modules-export-mode.md at lines 300-303, the version comparison table has inconsistent spacing in the original file (shown in diff):

| Feature | v8 (and earlier) | v9 |
|---------|-----------------|----| 

The diff shows this being "fixed" but I notice the alignment is preserved. This is fine, just noting for consistency.

2. Repetition is Intentional (Good)
The information about the 'camelCaseOnly' requirement appears in multiple places (breaking changes, migration steps, troubleshooting). This is actually good practice for documentation as users may jump to different sections.

🛡️ Security & Performance

Security: ✅ No concerns

  • Documentation changes only, no code execution
  • No secrets or sensitive information

Performance: ✅ N/A

  • Documentation changes have no runtime impact

🧪 Test Coverage

Documentation Testing:

  • ✅ Markdown syntax appears valid
  • ⚠️ Recommendation: Verify all code examples are tested (if you have automated docs testing)
  • ⚠️ Recommendation: Consider adding a note about which Shakapacker version introduced this change (appears to be 9.0.0-beta.4+)

📝 Suggestions for Enhancement (Optional)

  1. Version Specificity: Consider adding which beta version introduced this breaking change:

    > **Note:** This requirement was introduced in Shakapacker 9.0.0-beta.4 with the switch to namedExport by default.
  2. Link Cross-References: The two files reference each other well, but you could add a link in the error message section pointing to the other doc for more context.

  3. Migration Codemod: The codemod example in docs/css-modules-export-mode.md (lines 268-290) is incomplete (has // ... codemod implementation). Either complete it or note it's pseudocode.

✨ Final Assessment

Overall Quality: ⭐⭐⭐⭐⭐ Excellent

Recommendation: ✅ APPROVE - This PR should be merged.

This is a high-quality documentation fix that directly addresses a real user pain point. The changes are:

  • Technically accurate
  • Well-written and clear
  • Appropriately placed
  • Include helpful examples and troubleshooting guidance

The documentation now provides users with exactly what they need to successfully upgrade to v9 without encountering the cryptic css-loader error.

Impact: This will save users significant debugging time and reduce support requests around CSS modules configuration in v9.


Review generated with assistance from Claude Code

This commit addresses critical inconsistencies between documentation and
implementation for CSS modules configuration in v9.

Changes:

1. **Implemented actual CSS modules configuration** (package/utils/getStyleRule.ts)
   - Added `namedExport: true` to css-loader options
   - Added `exportLocalsConvention: 'camelCaseOnly'` to css-loader options
   - Previously only had `auto: true`, so the v9 defaults were not actually applied
   - Added explanatory comments about css-loader compatibility requirements

2. **Fixed documentation inconsistencies**
   - Updated TODO_v9.md: Changed 'camelCase' to 'camelCaseOnly'
   - Updated CHANGELOG.md: Changed 'camelCase' to 'camelCaseOnly'
   - Updated tools/README.md: Changed 'camelCase' to 'camelCaseOnly'
   - Added note explaining css-loader compatibility requirements

3. **Updated test expectations** (spec/shakapacker/css_modules_spec.rb)
   - Changed expected value from 'camelCase' to 'camelCaseOnly'
   - All tests passing

Key Issue Resolved:
- Documentation claimed v9 uses `exportLocalsConvention: 'camelCase'`
- css-loader actually requires 'camelCaseOnly' or 'dashesOnly' when namedExport: true
- Using 'camelCase' with namedExport: true causes build error
- Implementation was missing both namedExport and exportLocalsConvention settings

This ensures the code matches the documentation and prevents the build error
described in issue #622.

Related to #622

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Code Review: CSS Modules exportLocalsConvention Documentation Fix

Summary

This PR successfully addresses issue #622 by correcting the documentation to specify 'camelCaseOnly' instead of 'camelCase' for the exportLocalsConvention setting when namedExport: true is enabled. The changes are well-structured and comprehensive.


✅ Strengths

1. Accurate Technical Content

  • Correctly identifies the difference between 'camelCase' (both original and camelCase) and 'camelCaseOnly' (only camelCase)
  • Properly documents the css-loader compatibility requirement
  • Includes the exact error message users will encounter, making it easy to search for solutions

2. Comprehensive Coverage

  • Updates both primary documentation files (v9_upgrade.md and css-modules-export-mode.md)
  • Adds troubleshooting sections in appropriate locations
  • Provides clear warning callouts about the incompatibility

3. User-Friendly Approach

  • Includes concrete code examples with ✅/❌ indicators
  • Explains the "why" behind the requirement
  • Offers clear solutions and alternatives

4. Consistent Formatting

  • Uses proper markdown formatting throughout
  • Maintains consistency with existing documentation style
  • Tables are properly aligned

⚠️ Issues Found

1. Critical: Test Spec Contains Incorrect Value

The test spec at spec/shakapacker/css_modules_spec.rb:189 and spec/shakapacker/css_modules_spec.rb:196 still references 'camelCase' instead of 'camelCaseOnly':

# Line 189
{ namedExport: true, exportLocalsConvention: "camelCase", description: "v9 mode" }

This test will fail with the actual v9 configuration since 'camelCase' is incompatible with namedExport: true.

Recommendation: Update the test to use 'camelCaseOnly':

{ namedExport: true, exportLocalsConvention: "camelCaseOnly", description: "v9 mode" }

2. Minor: Inconsistent Documentation in One Location

In docs/css-modules-export-mode.md:247, there's still a reference to the old incorrect value in a comment/header:

Line 247: With v9's exportLocalsConvention: 'camelCase'

While the PR does update this to 'camelCaseOnly' in line 247, please verify this change is complete.


📋 Suggestions for Improvement

1. Consider Adding a Version Note

In the "Important: exportLocalsConvention with namedExport" section, consider adding when this requirement was introduced:

### Important: exportLocalsConvention with namedExport (v9.0+)

This helps users quickly identify if the section applies to their version.

2. Clarify the Reversion Instructions

In docs/v9_upgrade.md:228, when explaining how to use 'camelCase', the phrasing could be clearer:

Current:

If you want to use 'camelCase' (which exports both original and camelCase versions), you must set namedExport: false

Suggested:

If you need both the original kebab-case AND camelCase versions exported (the 'camelCase' option), you must revert to v8 behavior by setting namedExport: false

3. Add Cross-Reference

In the troubleshooting section of v9_upgrade.md, consider adding a direct link to the detailed explanation:

See the [CSS Modules Export Mode documentation](./css-modules-export-mode.md#important-exportlocalsconvention-with-namedexport) for a detailed explanation.

🔒 Security Considerations

✅ No security concerns - documentation-only changes


⚡ Performance Considerations

✅ No performance impact - documentation-only changes


🧪 Test Coverage

Current State:

Recommendations:

  1. Update spec/shakapacker/css_modules_spec.rb to use 'camelCaseOnly'
  2. Consider adding a test that validates the documentation examples are syntactically correct
  3. Run the full test suite to ensure no regressions: bundle exec rspec

📝 Code Quality & Best Practices

Adherence to CLAUDE.md Guidelines:

  • ✅ Files end with trailing newlines
  • ✅ Follows existing documentation conventions
  • ✅ Changes are focused and minimal
  • ✅ No unnecessary content added

Documentation Best Practices:

  • ✅ Clear and concise explanations
  • ✅ Proper use of code blocks with syntax highlighting
  • ✅ Consistent formatting throughout
  • ✅ Progressive disclosure (simple first, details later)

🎯 Final Recommendation

Status: Approve with minor changes required

Required Actions Before Merge:

  1. ⚠️ MUST FIX: Update test spec to use 'camelCaseOnly' instead of 'camelCase'
  2. ⚠️ MUST RUN: Execute bundle exec rspec to verify tests pass

Optional Improvements:
3. Consider the suggestions above for enhanced clarity
4. Add cross-references between related documentation sections


💡 Additional Notes

This PR effectively solves a real pain point for users upgrading to v9. The documentation is thorough and will significantly reduce confusion. Great work on identifying this discrepancy and providing comprehensive documentation!

The error message inclusion is particularly valuable - users searching for the error will find this documentation immediately.


Reviewed with: Claude Code
Review Date: 2025-10-03

@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Code Review - PR #626: Fix CSS Modules exportLocalsConvention Documentation

Summary

This PR correctly fixes a critical documentation bug where exportLocalsConvention: 'camelCase' was incorrectly recommended with namedExport: true, which causes a build error in css-loader. The fix changes all references to use 'camelCaseOnly' instead.


✅ Code Quality & Best Practices

Strengths:

  • Accurate and comprehensive: The PR thoroughly addresses the issue across all relevant files (docs, code, tests, and tools)
  • Clear explanations: Excellent use of warning blocks, error message examples, and troubleshooting sections
  • Consistent naming: All references updated from 'camelCase' to 'camelCaseOnly' consistently
  • Good code comments: The implementation in getStyleRule.ts:37-39 includes helpful comments explaining the constraint
  • Follows project conventions: Adheres to CLAUDE.md guidelines (trailing newlines, focused changes)

Code Implementation (package/utils/getStyleRule.ts:35-42):

modules: {
  auto: true,
  // v9 defaults: Use named exports with camelCase conversion
  // Note: css-loader requires 'camelCaseOnly' or 'dashesOnly' when namedExport is true
  // Using 'camelCase' with namedExport: true causes a build error
  namedExport: true,
  exportLocalsConvention: 'camelCaseOnly'
}

✅ Correct implementation with clear documentation


✅ Bug Prevention & Accuracy

Critical Fix:
The PR correctly identifies and fixes the incompatibility between css-loader's namedExport: true and exportLocalsConvention: 'camelCase'. The distinction is important:

  • 'camelCase': Exports both original AND camelCase versions → Only works with namedExport: false
  • 'camelCaseOnly': Exports ONLY camelCase version → Required for namedExport: true
  • 'dashesOnly': Exports ONLY original dash-case version → Also compatible with namedExport: true

Proper Error Handling:
The documentation now includes:

  • Clear error message examples
  • Root cause explanations
  • Multiple solution paths (change to 'camelCaseOnly' OR revert to v8 behavior)

✅ Documentation Quality

Excellent additions:

  1. Troubleshooting section (docs/css-modules-export-mode.md:404-421): New dedicated section for the build error with cause and solution
  2. Warning callouts (docs/v9_upgrade.md:24-25): Prominent placement of the compatibility requirement
  3. Migration guidance (docs/v9_upgrade.md:216): Important note about the limitation of 'camelCaseOnly'
  4. Comprehensive coverage: Updated 7 files consistently

Minor suggestion for improvement:
Consider adding a note about the 'dashesOnly' option as an alternative, since it's also compatible with namedExport: true. Some users might prefer keeping kebab-case names. Example:

// Alternative if you want to keep kebab-case in JS:
exportLocalsConvention: 'dashesOnly'  // exports 'my-button', not 'myButton'

✅ Test Coverage

Test Updates (spec/shakapacker/css_modules_spec.rb:186-201):

configs = [
  { namedExport: false, description: "v8 mode" },
  { namedExport: true, exportLocalsConvention: "camelCaseOnly", description: "v9 mode" }
]

✅ Test correctly updated to validate 'camelCaseOnly' for v9 mode
✅ Maintains v8 compatibility testing

Recommendation:
Consider adding an integration test that actually triggers the error with 'camelCase' to ensure the validation works. This would catch any regressions.


✅ Performance Considerations

No performance impact. This is purely a configuration and documentation fix.


✅ Security Concerns

No security issues identified. The changes are limited to:

  • Documentation corrections
  • Configuration value updates
  • Test data updates

✅ Breaking Changes & Migration

Well handled:

  • Clear migration path documented
  • Backward compatibility option (revert to v8 mode) clearly explained
  • Codemod tool reference maintained in tools/README.md:107

📋 Pre-merge Checklist

Before merging, please verify:

  • Linting: Run yarn lint to ensure TypeScript/JS files pass
  • Ruby linting: Run bundle exec rubocop to ensure Ruby files follow style guide
  • Tests: Run bundle exec rspec spec/shakapacker/css_modules_spec.rb to verify test updates
  • Manual verification: Test that the error still occurs with 'camelCase' and is resolved with 'camelCaseOnly'

🎯 Overall Assessment

Rating: Excellent ✅

This is a high-quality PR that:

  • Fixes a critical bug affecting users upgrading to v9
  • Provides comprehensive documentation with clear troubleshooting
  • Updates all relevant files consistently
  • Maintains test coverage
  • Follows project conventions

Recommendation: Approve and merge after running the linting/testing checklist above.


💡 Minor Enhancements (Optional)

  1. Consider mentioning 'dashesOnly' as an alternative for users who prefer kebab-case
  2. Add an integration test that verifies the error occurs with incorrect config
  3. Consider adding a migration script/tool to automatically fix webpack configs in user projects

Great work! This will help many users avoid the build error when upgrading. 🎉

@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Code Review - PR #626

Overview

This PR fixes a critical documentation issue for CSS Modules in v9, addressing issue #622.

Critical Issues Found

1. Missing Trailing Newlines (BLOCKER)
Per CLAUDE.md requirements, these files MUST end with newlines:

  • package/utils/getStyleRule.ts
  • docs/css-modules-export-mode.md
  • TODO_v9.md
  • tools/README.md

2. Implementation Verification Needed
Please verify getStyleRule.ts changes are properly committed.

3. Test Inconsistency
Line 189 of css_modules_spec.rb still references old 'camelCase' value in config definition.

Strengths

  • Excellent documentation improvements
  • Clear troubleshooting sections
  • Addresses real user pain point
  • Good code comments

Pre-Merge Requirements

  • Add trailing newlines to all files
  • Run: bundle exec rubocop
  • Run: yarn lint
  • Run: bundle exec rspec spec/shakapacker/css_modules_spec.rb
  • Verify getStyleRule.ts implementation

Assessment

⚠️ Needs fixes before merge - Great work, but linting requirements must be met per CLAUDE.md.

justin808 and others added 2 commits October 2, 2025 21:45
Enhances CSS modules documentation to include the 'dashesOnly' option as
an alternative to 'camelCaseOnly' for users who prefer to keep kebab-case
class names in their JavaScript code.

Changes:
- Added dashesOnly option explanation to v9_upgrade.md
- Added dashesOnly usage examples with import syntax
- Enhanced css-modules-export-mode.md with detailed comparison
- Clarified when to use each exportLocalsConvention option
- Added practical examples showing both camelCaseOnly and dashesOnly usage

Users can now choose between:
- 'camelCaseOnly' (default): Converts my-button to myButton
- 'dashesOnly': Preserves my-button as-is

This gives users more flexibility based on their naming preferences.

Related to #622

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Adds comprehensive tests to ensure the CSS modules configuration stays
correct and prevents regressions.

Changes:
- Added test validating 'camelCase' is incompatible with namedExport: true
- Added test documenting valid configuration alternatives
- Added test ensuring getStyleRule.ts uses valid configuration
- Tests verify implementation matches documentation

The new tests:
1. Document the exact error case (namedExport: true + camelCase)
2. Validate all three valid configuration combinations
3. Verify the actual source code has the correct configuration
4. Check for explanatory comments in the code

This prevents regressions where someone might accidentally change the
configuration back to the invalid 'camelCase' value.

All tests passing (16 examples, 0 failures, 5 pending)

Related to #622

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Code Review: Fix CSS Modules exportLocalsConvention Documentation

Summary

This PR correctly fixes a critical documentation bug where exportLocalsConvention: 'camelCase' was incorrectly documented instead of 'camelCaseOnly', which caused build errors for users upgrading to v9. The changes are thorough, accurate, and well-structured.

✅ Strengths

1. Comprehensive Documentation Coverage

  • Updates all relevant files: CHANGELOG.md, v9_upgrade.md, css-modules-export-mode.md, TODO_v9.md
  • Consistent terminology across all documentation
  • Clear error messages and troubleshooting sections added

2. Code Implementation (package/utils/getStyleRule.ts:35-42)

  • ✅ Correctly implements namedExport: true with exportLocalsConvention: 'camelCaseOnly'
  • ✅ Excellent inline comments explaining the css-loader requirement
  • ✅ Provides context about why 'camelCase' causes a build error

3. Test Coverage (spec/shakapacker/css_modules_spec.rb)

  • ✅ New test validates the invalid configuration (lines 145-176)
  • ✅ Test ensures getStyleRule.ts uses valid configuration (lines 178-194)
  • ✅ Updated existing tests to reflect 'camelCaseOnly' instead of 'camelCase'

4. User Experience Improvements

  • Clear troubleshooting section with exact error messages
  • Both 'camelCaseOnly' and 'dashesOnly' alternatives documented
  • Migration path for different use cases clearly explained
  • Helpful examples showing when to use each option

📝 Code Quality Observations

Excellent Practices:

  1. Consistent naming - All 16 occurrences of 'camelCase' correctly changed to 'camelCaseOnly'
  2. Contextual explanations - Each change includes rationale and alternatives
  3. Error-first documentation - Troubleshooting sections placed prominently
  4. Real error messages - Shows actual css-loader error text users will see

🔍 Minor Suggestions

1. Test File Consistency (spec/shakapacker/css_modules_spec.rb:145)

The new test at line 145 documents behavior but doesn't actually execute validation:

it "validates that 'camelCase' is incompatible with namedExport: true" do
  # This test documents the exact error that would occur with incorrect configuration
  # css-loader will reject this configuration with an error

Suggestion: Consider adding a skip message or renaming to clarify this is documentation:

it "documents that 'camelCase' is incompatible with namedExport: true" do
  # This test documents the css-loader compatibility requirement

This makes it clearer that it's a documentation test rather than an integration test.

2. Documentation Formatting (Minor)

In docs/css-modules-export-mode.md:283-331, the Option A and Option B structure is excellent. Consider using the same structure consistently in v9_upgrade.md for parallel consistency.

🔒 Security Considerations

✅ No security concerns - documentation-only changes with proper code implementation

⚡ Performance Considerations

✅ No performance impact - configuration change doesn't affect runtime performance
✅ The 'camelCaseOnly' option may slightly reduce bundle size vs 'camelCase' since it exports fewer keys

🧪 Test Coverage Assessment

  • ✅ Spec tests cover the configuration validation
  • ✅ Test verifies actual source file content
  • ✅ Integration tests marked with appropriate skip messages
  • ⚠️ Consider running actual webpack build test if feasible (though marked as skip which is reasonable)

📋 Checklist Compliance

Per CLAUDE.md project guidelines:

  • ✅ All files end with trailing newlines
  • ✅ Code style follows existing conventions
  • ✅ Changes are focused and minimal
  • ⚠️ Recommendation: Run bundle exec rubocop before merge (Ruby style check)
  • ⚠️ Recommendation: Run yarn lint before merge (JS/TS style check)
  • ⚠️ Recommendation: Run bundle exec rspec to ensure all tests pass

🎯 Overall Assessment

Verdict: Approved with minor suggestions

This is an excellent documentation fix that:

  1. Solves a real user pain point (Documentation: CSS Modules exportLocalsConvention requirement not documented in v9 upgrade guide #622)
  2. Provides comprehensive guidance and troubleshooting
  3. Includes proper code implementation
  4. Has good test coverage
  5. Maintains consistency across all documentation

The changes are accurate, well-explained, and will significantly improve the upgrade experience for v9 users.

Recommended Pre-Merge Actions

# Verify linting passes
bundle exec rubocop
yarn lint

# Run full test suite
bundle exec rspec

# Verify the actual error can be reproduced (optional validation)
# This would require a test project setup

Great work on this comprehensive documentation fix! 🎉

Enhances the doctor command to detect and warn about CSS modules
configuration issues, helping developers catch the incompatible
configuration before build failures occur.

New checks added:

1. Invalid configuration detection
   - Detects namedExport: true with exportLocalsConvention: 'camelCase'
   - Reports as critical issue with clear fix instructions
   - References docs/v9_upgrade.md for detailed guidance

2. Missing configuration detection
   - Warns when CSS module files exist without explicit configuration
   - Informs about v9 defaults (namedExport: true, camelCaseOnly)

3. V8-style import pattern detection
   - Scans JavaScript/TypeScript files for v8 default import patterns
   - Warns about needed migration to v9 named exports
   - Provides migration examples in warning message

Implementation details:
- Checks webpack config files (webpack.config.js, commonWebpackConfig.js)
- Scans first 50 JS/TS files for import patterns (performance optimization)
- Graceful error handling - doesn't fail doctor on check errors
- Only runs when CSS module files (*.module.css/scss/sass) exist

Test coverage:
- Tests for invalid configuration detection
- Tests for valid configurations (camelCaseOnly, dashesOnly)
- Tests for missing configuration
- Tests for v8/v9 import pattern detection
- All 73 tests passing

Example doctor output:
  ❌ CSS Modules: Invalid configuration detected in config/webpack/webpack.config.js
    Using exportLocalsConvention: 'camelCase' with namedExport: true will cause build errors
    Change to 'camelCaseOnly' or 'dashesOnly'. See docs/v9_upgrade.md for details

Related to #622

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Code Review: CSS Modules exportLocalsConvention Documentation Fix

Overall Assessment

Excellent PR - This is a critical documentation fix that addresses a real pain point for users upgrading to v9. The changes are comprehensive, well-documented, and include proper testing and validation.


Strengths

1. Comprehensive Documentation Coverage

  • ✅ Updated all relevant documentation files (CHANGELOG, v9_upgrade.md, css-modules-export-mode.md, TODO_v9.md)
  • ✅ Clear error messages and troubleshooting sections added
  • ✅ Includes both the problem explanation AND multiple solutions

2. Correct Technical Implementation

  • ✅ Fixed package/utils/getStyleRule.ts to use 'camelCaseOnly' instead of 'camelCase'
  • ✅ Added helpful inline comments explaining the css-loader requirement
  • ✅ Proper differentiation between 'camelCase', 'camelCaseOnly', and 'dashesOnly'

3. Excellent Testing

  • ✅ Added comprehensive test coverage in spec/shakapacker/css_modules_spec.rb
  • ✅ Added validation tests in spec/shakapacker/doctor_spec.rb
  • ✅ Tests document the exact error condition and valid alternatives

4. Proactive Error Detection

  • ✅ Enhanced lib/shakapacker/doctor.rb with CSS modules configuration checks
  • ✅ Detects invalid configuration before build fails
  • ✅ Provides helpful warnings for v8-style import patterns

Suggestions & Observations

1. Doctor.rb Implementation (lib/shakapacker/doctor.rb:444-491)

The new check_css_modules_configuration method is excellent! A few minor notes:

Performance consideration:

css_module_files = Dir.glob(File.join(source_path, "**/*.module.{css,scss,sass}"))

This could be slow on large projects. Consider adding a limit or early return if you find just one file:

# Just check if ANY CSS module files exist
css_module_exists = Dir.glob(File.join(source_path, "**/*.module.{css,scss,sass}"), File::FNM_CASEFOLD).first
return unless css_module_exists

Regex safety:
The regex patterns look good, but consider edge cases with whitespace variations:

config_content.match(/namedExport\s*:\s*true/)

This handles most cases well. ✅

2. Documentation Clarity (docs/css-modules-export-mode.md:35-72)

The "Important: exportLocalsConvention with namedExport" section is excellent. It clearly shows:

  • ❌ What doesn't work (with error message)
  • ✅ What does work (with examples)
  • 📝 When to use each option

This is exactly what users need when encountering this error!

3. Test Coverage (spec/shakapacker/css_modules_spec.rb:144-177)

Love the meta-test that validates the actual source code:

it "ensures getStyleRule.ts uses valid configuration" do
  style_rule_content = File.read("package/utils/getStyleRule.ts")
  expect(style_rule_content).to include("exportLocalsConvention: 'camelCaseOnly'")
end

This is a great pattern for ensuring docs and code stay in sync! ✅

4. Minor: File Endings

According to CLAUDE.md, all files must end with a trailing newline. Please verify all modified files have this (particularly the TypeScript and Ruby files).


Security & Performance

No security concerns - Documentation and configuration changes only
No performance regressions - The doctor checks are appropriately scoped and have error handling
Backward compatibility - Users can still override to v8 behavior if needed


Code Quality

Follows project conventions - Consistent with existing Shakapacker patterns
Clear comments - Explains the "why" not just the "what"
Error handling - Doctor checks include proper rescue blocks
DRY principle - Reuses existing patterns from the codebase


Test Coverage Assessment

Excellent coverage across:

  • ✅ Configuration validation (valid and invalid combinations)
  • ✅ Import pattern detection
  • ✅ Multiple webpack config file locations
  • ✅ Edge cases (no CSS modules, no config files)
  • ✅ Meta-tests for source code validation

Suggestion: Consider adding an integration test that actually runs webpack with the invalid config to verify the error message, but this may be overkill given the comprehensive unit tests.


Potential Issues Found

None - This is a well-crafted PR. The only minor items:

  1. Verify trailing newlines on all files (per CLAUDE.md)
  2. Consider the performance optimization in doctor.rb mentioned above (optional)
  3. Run bundle exec rubocop before merging (per CLAUDE.md)
  4. Run yarn lint before merging (per CLAUDE.md)

Recommendation

✅ APPROVE with minor pre-merge checklist:

  • Run bundle exec rubocop to verify Ruby code style
  • Run yarn lint to verify TypeScript/JS code style
  • Verify all files end with trailing newlines
  • Consider performance optimization in doctor.rb (optional)

This PR excellently addresses issue #622 and will save users significant frustration during the v8→v9 upgrade. The comprehensive documentation, proactive error detection, and thorough testing make this a model PR.

Great work! 🎉

@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Code Review - PR #626: Fix CSS Modules exportLocalsConvention Documentation

Overall Assessment

This is an excellent PR that addresses a critical documentation issue (#622) and goes beyond by adding proactive tooling to prevent users from encountering the error. The changes are well-structured, thoroughly tested, and significantly improve the developer experience.


Code Quality & Best Practices

Strengths:

  • Comprehensive documentation updates - Both v9_upgrade.md and css-modules-export-mode.md are updated with clear explanations, examples, and troubleshooting guidance
  • Proactive error detection - The new check_css_modules_configuration method in doctor.rb will catch the configuration error before users hit it during build
  • Well-tested - Excellent test coverage with 137 new lines in doctor_spec.rb covering multiple scenarios
  • Follows project conventions - Code follows existing patterns in the doctor.rb file
  • TypeScript implementation fix - getStyleRule.ts is updated with the correct configuration and helpful comments

The implementation is clean and follows Ruby best practices with defensive programming, early returns for performance, clear separation of concerns, and limited file scanning (first 50 files) to avoid performance issues.


Potential Issues & Suggestions

1. Error Handling - Minor Risk

Issue: Broad exception catching with rescue suppresses all errors. While this prevents doctor from crashing, it might hide unexpected bugs.

Recommendation: Be more specific about expected exceptions to differentiate between file access errors and unexpected bugs.

2. Import Pattern Detection - False Positives

Issue: The regex might match commented-out code or strings, leading to false warnings.

Example: Comment like "Old approach: import styles from styles.module.css" would trigger the warning

Recommendation: Add a check to skip comments before pattern matching.

3. Test Documentation Gap

The test "validates that camelCase is incompatible with namedExport: true" does not actually validate the error - it just documents valid/invalid configurations. Consider renaming to better reflect its purpose.


Security Considerations

Status: No security concerns identified

  • File reading is limited to the project directory
  • No external input is executed
  • Regex patterns are safe from ReDoS attacks
  • No sensitive data is exposed in error messages

Performance Considerations

Strengths:

  • Limited file scanning (first 50 JS files) prevents performance degradation
  • Early returns optimize execution
  • Pattern matching is efficient

Potential Optimization: For very large files, consider adding file size limits to skip files over 1MB.


Test Coverage

Excellent coverage:

  • Invalid configuration detection (namedExport: true + camelCase)
  • Valid configuration scenarios (camelCaseOnly, dashesOnly)
  • Missing configuration detection
  • Import pattern detection (v8 vs v9 style)
  • Integration test for getStyleRule.ts configuration
  • 137 new test lines in doctor_spec.rb
  • 54 new test lines in css_modules_spec.rb

Documentation Quality

Outstanding improvements:

  • Clear error messages with actionable solutions
  • Side-by-side comparisons of v8 vs v9 behavior
  • Troubleshooting sections in both upgrade guide and export mode docs
  • Excellent use of code examples

Recommendations Summary

Priority: High

  1. Run bundle exec rubocop on Ruby files
  2. Run yarn lint on TypeScript files
  3. Run bundle exec rspec to verify all tests pass

Priority: Medium

  1. Consider more specific error handling
  2. Add comment detection to avoid false positives
  3. Add file size limits for performance

Priority: Low

  1. Rename test to better reflect its purpose
  2. Add performance edge case tests
  3. Enhance documentation with when to choose guidance

Conclusion

This is a high-quality PR that effectively solves the reported issue and adds valuable tooling to prevent future occurrences. The combination of documentation fixes, proactive error detection, and comprehensive testing makes this a significant improvement to the v9 migration experience.

Recommendation: APPROVE with minor suggestions

The suggested improvements are optional enhancements that do not block merging. The current implementation is solid and will significantly help users avoid the configuration error.

Great work!

Performance optimization:
- Changed CSS module file detection from globbing all files to early exit
- Uses Dir.glob().first instead of collecting all matches
- Significantly faster on large projects with many CSS module files

File formatting fixes:
- Added trailing newlines to all modified files per CLAUDE.md requirement:
  - package/utils/getStyleRule.ts
  - docs/css-modules-export-mode.md
  - TODO_v9.md
  - tools/README.md

All tests passing (89 examples, 0 failures)
All linting passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Code Review - PR #626

Overview

This PR fixes critical documentation errors regarding CSS Modules configuration in v9, specifically correcting exportLocalsConvention from camelCase to camelCaseOnly when namedExport true is enabled. This is an important fix that addresses issue #622.


✅ Strengths

1. Thorough Documentation Updates

  • Comprehensive updates across all relevant documentation files
  • Clear explanation of the incompatibility between camelCase and namedExport true
  • Excellent troubleshooting sections added with error messages and solutions

2. Code Implementation

  • package/utils/getStyleRule.ts: Correctly implements the fix with proper defaults and helpful comments explaining the constraint
  • Configuration is now aligned with documentation

3. Enhanced Doctor Diagnostics

  • lib/shakapacker/doctor.rb: Excellent proactive addition of validation checks
  • Detects invalid configuration combinations
  • Warns about v8-style import patterns
  • Performance-conscious implementation (checks first 50 files, uses .first for early returns)

4. Test Coverage

  • spec/shakapacker/css_modules_spec.rb: Documents the incompatibility clearly
  • spec/shakapacker/doctor_spec.rb: Comprehensive test coverage for all new doctor checks
  • Tests verify both invalid and valid configurations

🔍 Issues & Suggestions

Critical Issues

None - The code is solid and well-implemented.

Minor Issues & Improvements

1. File Endings (REQUIRED by CLAUDE.md)

Several files are missing trailing newlines, which will fail linting:

  • TODO_v9.md:87
  • docs/css-modules-export-mode.md:502
  • docs/v9_upgrade.md:311
  • tools/README.md:124

Action Required: Add trailing newlines to all files before merge.

2. Doctor Performance Consideration

In lib/shakapacker/doctor.rb:492-508, the import pattern check reads up to 50 JavaScript files. Consider using lazy evaluation to avoid loading all files into memory at once.

3. Regex Pattern Robustness

In lib/shakapacker/doctor.rb:452, the regex patterns could potentially match inside comments or strings, though this is probably fine for most real-world cases.

4. Documentation Enhancement

The migration guide could benefit from a quick reference table showing the differences between configuration options at a glance.


🛡️ Security Concerns

None identified - This is a documentation and configuration fix with no security implications.


⚡ Performance Considerations

  1. Doctor checks are well-optimized: Uses .first for early termination, limits file scanning to first 50 files
  2. No runtime performance impact: Changes only affect build-time configuration

🧪 Test Coverage

Excellent Coverage ✅

  • spec/shakapacker/css_modules_spec.rb: Validates configuration combinations
  • spec/shakapacker/doctor_spec.rb: Tests all new doctor check scenarios

📋 Best Practices Compliance

✅ Follows Project Guidelines (CLAUDE.md)

  • Uses appropriate code conventions
  • Focused, minimal changes
  • Tests updated for Ruby changes
  • MUST FIX: Missing trailing newlines in several files

🎯 Recommended Actions Before Merge

Must Fix

  1. Add trailing newlines to: TODO_v9.md, docs/css-modules-export-mode.md, docs/v9_upgrade.md, tools/README.md

Should Consider

  1. Run linting checks: bundle exec rubocop and yarn lint
  2. Run full test suite: bundle exec rspec

📊 Overall Assessment

Recommendation: Approve with minor fixes

This is an excellent PR that:

  • ✅ Fixes a critical documentation bug that would cause build failures
  • ✅ Adds proactive validation to catch the issue early
  • ✅ Provides comprehensive guidance for users
  • ✅ Includes thorough test coverage
  • ✅ Maintains backward compatibility guidance

The only blocking issue is the missing trailing newlines, which is a project requirement. Once those are added and linting passes, this is ready to merge.

Impact: High value - prevents user build failures and provides clear migration path.

Code Quality: Excellent - well-tested, well-documented, and thoughtfully implemented.

Great work! 🎉

Performance improvements:
- Replaced eager file loading with lazy evaluation in import pattern check
- Uses .lazy.take(50) to avoid loading all file paths into memory
- Extracts regex pattern to variable for better readability and reuse
- Stops immediately after finding first v8-style import

Documentation enhancements:
- Added comprehensive quick reference tables to v9_upgrade.md
- Added configuration comparison table to css-modules-export-mode.md
- Tables clearly show valid vs invalid configuration combinations
- Visual indicators (✅/❌) for quick scanning
- Shows practical examples of what each configuration exports

Tables include:
- namedExport values
- exportLocalsConvention options
- Export behavior for kebab-case class names
- Use cases for each configuration
- Compatibility status

All tests passing (89 examples, 0 failures)
All linting passing
All files have required trailing newlines

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude

claude Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Pull Request Review

Score: 9/10 - Excellent PR ✅ APPROVED

Summary

This PR fixes a critical documentation issue where v9 upgrade docs incorrectly specified 'camelCase' instead of 'camelCaseOnly' for exportLocalsConvention with namedExport: true. Great comprehensive fix!

Strengths

  1. Comprehensive Documentation - Updated docs/v9_upgrade.md, docs/css-modules-export-mode.md, and CHANGELOG with clear tables and examples
  2. Proactive Error Detection - Added check_css_modules_configuration in lib/shakapacker/doctor.rb to detect invalid configs
  3. Excellent Test Coverage - Comprehensive specs in doctor_spec.rb and css_modules_spec.rb covering all scenarios
  4. Clear Implementation - package/utils/getStyleRule.ts has correct defaults with helpful comments

Minor Issues (Consider for Future)

1. Regex Precision (lib/shakapacker/doctor.rb:470)
Pattern could be more precise to avoid false positives matching 'camelCaseOnly' in comments. Consider adding word boundary or negative lookahead.

2. Silent Error Handling (lib/shakapacker/doctor.rb:511-513)
Rescue block swallows errors silently. Consider adding warning message like in check_css_modules_configuration.

3. Performance Optimization (lib/shakapacker/doctor.rb:498)
Reading entire file contents could be slow. Since imports are at file top, consider reading only first ~5KB.

4. Multiple Config Files (lib/shakapacker/doctor.rb:464-481)
If multiple webpack configs have issues, all should be reported separately.

Security & Performance

✅ No security concerns - file reads are scoped, no injection risks
✅ Good performance optimizations - early returns, lazy evaluation, limited file scanning

Test Coverage

Excellent! Covers invalid configs, valid configs, v8/v9 imports, and implementation validation.

Suggested additions:

  • Multiple webpack config files scenario
  • Commented-out invalid configurations
  • Performance test with >50 files

Final Verdict

Ready to merge! Minor suggestions are optimizations, not blockers. This addresses a critical user pain point with excellent documentation and proactive detection.

Great work! 🎉


Reviewed by Claude Code following CLAUDE.md guidelines

@justin808 justin808 merged commit 38b0d28 into main Oct 3, 2025
54 checks passed
@justin808 justin808 deleted the justin808/fix-css-modules-docs branch October 3, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation: CSS Modules exportLocalsConvention requirement not documented in v9 upgrade guide

1 participant