-
Notifications
You must be signed in to change notification settings - Fork 860
[#9076] [Eslint] Fix: Allow CSS keywords in no-css-color ESLint rule
#9092
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
Merged
weronikaolejniczak
merged 2 commits into
elastic:main
from
kapral18:fix/eslint-plugin/fix-no-css-color-misfire
Oct 14, 2025
Merged
[#9076] [Eslint] Fix: Allow CSS keywords in no-css-color ESLint rule
#9092
weronikaolejniczak
merged 2 commits into
elastic:main
from
kapral18:fix/eslint-plugin/fix-no-css-color-misfire
Oct 14, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The no-css-color rule was incorrectly flagging CSS keywords like 'currentcolor', 'transparent', and 'inherit' as literal color values. These keywords are semantically valid and theme-agnostic, unlike actual color literals. This fix adds a whitelist of allowed CSS keywords that won't trigger the rule: - currentcolor - transparent - inherit - initial - unset - revert - revert-layer The rule still correctly flags actual color literals like hex codes, named colors (red, blue), and rgb/rgba/hsl/hsla values. Fixes false positives for common CSS patterns like 'border: none' and 'background: transparent' which were being flagged due to cssstyle package filling in default color values during CSS parsing.
Collaborator
💚 Build Succeeded |
Collaborator
💚 Build Succeeded
|
weronikaolejniczak
approved these changes
Oct 14, 2025
Contributor
weronikaolejniczak
left a 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.
Tests are passing (we don't run them in CI 😬 soon...), the code changes look clean and I like the comments above the test cases (makes it immediately clear what the test is about). Thank you for contributing, @kapral18! 💪🏻
tsullivan
pushed a commit
that referenced
this pull request
Oct 15, 2025
acstll
added a commit
to elastic/kibana
that referenced
this pull request
Oct 23, 2025
- `@elastic/eui`: `v107.0.0` ⏩ `v107.0.1` - `@elastic/eslint-plugin-eui`: `v2.4.0` ⏩ `v2.5.0` [Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams) --- ## Changes Related to elastic/eui#9100 - Updated snapshot f90ae29 - Added missing `aria-label` for `EuiBetaBadge` - [Reporting] 6d10edd - [ML] ce58009 - Added new translation key, ran `node scripts/i18n_check` — is there anything else that should be done in this regard? ## Package updates ### `@elastic/eui` [`v107.0.1`](https://github.com/elastic/eui/releases/v107.0.1) **Bug fixes** - Fixed `prismjs` theme in `EuiCodeBlock` to improve highlighting for the `yaml` language ([#9089](elastic/eui#9089)) - Fixed a visual bug on `EuiTable` where the border for rows in dark mode wasn't applied correctly ([#9115](elastic/eui#9115)) **Dependency updates** - Updated `@elastic/prismjs-esql` to v1.1.2 ([#9102](elastic/eui#9102)) **Accessibility** - Fixed incorrect role attribute on `EuiIcon` and `EuiBetaBadge` ([#9100](elastic/eui#9100)) - Make `EuiBasicTable` respect user's reduced motion setting by not animating when in loading state. ([#9095](elastic/eui#9095)) ### `@elastic/eslint-plugin-eui` [`v2.5.0`](https://github.com/elastic/eui/blob/main/packages/eslint-plugin/changelogs/CHANGELOG_2025.md#v250) - Added new `accessible-interactive-element` rule. ([#9093](elastic/eui#9093)) - Added new `tooltip-focusable-anchor` rule. ([#9051](elastic/eui#9051)) - Excluded `EuiButtonEmpty` from the `no-unnamed-interactive-element` rule. ([#9046](elastic/eui#9046)) **Bug fixes** - Fixed `no-css-color` rule to allow CSS keywords like `currentcolor`, `transparent`, and `inherit` ([#9092](elastic/eui#9092)) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #9076
Summary
Fixes false positive warnings in the
@elastic/eui/no-css-colorESLint rule that incorrectly flagged valid CSS keywords as literal color values.Problem
The rule was triggering warnings for CSS declarations like:
border: noneborder: 0color: inheritbackground: transparentThese are valid, theme-agnostic CSS keywords that shouldn't require EUI theme colors.
Root Cause
When parsing CSS like
border: none, thecssstylepackage fills in default values per CSS spec:The rule was checking
if (Boolean(style.borderColor))which returnedtruefor "currentcolor", even though it's a CSS keyword, not an actual color literal.Solution
Added a whitelist of CSS keywords that should be allowed:
currentcolor- Inherits the computed color valuetransparent- Fully transparent colorinherit- Inherits from parentinitial- CSS initial valueunset- Removes propertyrevert- Reverts to browser defaultrevert-layer- Reverts to cascade layerThese keywords are:
Testing
Test Coverage
Before Fix (False Positives) in Kibana
After Fix