-
Notifications
You must be signed in to change notification settings - Fork 61
Disable linting for CSS mode in CodeMirror editor #2457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Disable linting for CSS mode in CodeMirror editor #2457
Conversation
WalkthroughDisables CodeMirror linting for editors initialized with CSS mode by setting Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
assets/js/admin-views.js (1)
1345-1349: Broaden CSS-mode check and read the merged config, not just data-attribute.Covers cases where mode is 'text/css' or an object ({name:'css'}) and when mode comes from defaults (no data-codemirror on the textarea). Optionally removes empty lint gutter.
- // Disable linting for CSS mode as WordPress CSS editor does not support modern CSS syntax. - if ( attributeValue && 'css' === attributeValue.mode ) { - codemirrorConfig.codemirror.lint = false; - } + // Disable linting for CSS mode as WordPress CSS editor does not support modern CSS syntax. + const modeOpt = codemirrorConfig?.codemirror?.mode; + const modeName = typeof modeOpt === 'string' ? modeOpt : modeOpt?.name; + if ( modeName === 'css' || modeName === 'text/css' ) { + codemirrorConfig.codemirror.lint = false; + // Optional: drop lint gutter to avoid an empty column. + if ( Array.isArray( codemirrorConfig.codemirror.gutters ) ) { + codemirrorConfig.codemirror.gutters = + codemirrorConfig.codemirror.gutters.filter( g => g !== 'CodeMirror-lint-markers' ); + } + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
assets/js/admin-views.min.jsis excluded by!**/*.min.js
📒 Files selected for processing (1)
assets/js/admin-views.js(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test_and_package
…SS syntax in WordPress. This change ensures compatibility with the WordPress CSS editor, which does not handle modern CSS features.
4ffc051 to
a932eab
Compare
💾 Build file (a932eab).
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.