Skip to content

Commit 2cfd347

Browse files
feat(eslint-plugin): remove prefer-css-prop-for-static-styles rule (elastic#8760)
1 parent c4079af commit 2cfd347

File tree

5 files changed

+3
-189
lines changed

5 files changed

+3
-189
lines changed

packages/eslint-plugin/README.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,6 @@ function MyComponent() {
128128

129129
It's worth pointing out that although the examples provided are specific to EUI components, this rule applies to all JSX elements.
130130

131-
### `@elastic/eui/prefer-css-attributes-for-eui-components`
132-
133-
This rule warns about the use of `style` attribute and encourages to replace it with `css` attribute. Using the `css` attribute ensures better integration with Emotion's styling capabilities.
134-
135-
#### Example
136-
137-
The following code:
138-
139-
```jsx
140-
<EuiCode style={{ color: '#dd4040' }}>This is a test</EuiCode>
141-
```
142-
143-
will raise an ESLint report and suggest replacing the `style` attribute with `css`:
144-
145-
```jsx
146-
<EuiCode css={{ color: '#dd4040' }}>This is a test</EuiCode>
147-
```
148-
149131
## Testing
150132

151133
### Running unit tests
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**Breaking changes**
2+
3+
- Remove `prefer-css-prop-for-static-styles` rule because it produces too many warnings. Static code analysis cannot flag dynamic styles with confidence because it doesn't run the code to asses runtime values. We will explore runtime solutions.

packages/eslint-plugin/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@
2020
import { HrefOnClick } from './rules/href_or_on_click';
2121
import { NoRestrictedEuiImports } from './rules/no_restricted_eui_imports';
2222
import { NoCssColor } from './rules/no_css_color';
23-
import { PreferCSSPropForStaticStyles } from './rules/prefer_css_prop_for_static_styles';
2423

2524
const config = {
2625
rules: {
2726
'href-or-on-click': HrefOnClick,
2827
'no-restricted-eui-imports': NoRestrictedEuiImports,
2928
'no-css-color': NoCssColor,
30-
'prefer-css-prop-for-static-styles': PreferCSSPropForStaticStyles,
3129
},
3230
configs: {
3331
recommended: {
@@ -36,7 +34,6 @@ const config = {
3634
'@elastic/eui/href-or-on-click': 'warn',
3735
'@elastic/eui/no-restricted-eui-imports': 'warn',
3836
'@elastic/eui/no-css-color': 'warn',
39-
'@elastic/eui/prefer-css-prop-for-static-styles': 'warn',
4037
},
4138
},
4239
},

packages/eslint-plugin/src/rules/prefer_css_prop_for_static_styles.test.ts

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

packages/eslint-plugin/src/rules/prefer_css_prop_for_static_styles.ts

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

0 commit comments

Comments
 (0)