Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions packages/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,6 @@ function MyComponent() {

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

### `@elastic/eui/prefer-css-attributes-for-eui-components`

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.

#### Example

The following code:

```jsx
<EuiCode style={{ color: '#dd4040' }}>This is a test</EuiCode>
```

will raise an ESLint report and suggest replacing the `style` attribute with `css`:

```jsx
<EuiCode css={{ color: '#dd4040' }}>This is a test</EuiCode>
```

## Testing

### Running unit tests
Expand Down
3 changes: 3 additions & 0 deletions packages/eslint-plugin/changelogs/upcoming/8760.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Breaking changes**

- 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[no action required] I first thought this was too long, but after reading it several times I think it's good to have all this information here (you can understand right away the reason why the rule is being removed, and if you need more context, there will be the link to the PR, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, following what @JasonStoltz proposed to make the breaking changes more clear.

3 changes: 0 additions & 3 deletions packages/eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
import { HrefOnClick } from './rules/href_or_on_click';
import { NoRestrictedEuiImports } from './rules/no_restricted_eui_imports';
import { NoCssColor } from './rules/no_css_color';
import { PreferCSSPropForStaticStyles } from './rules/prefer_css_prop_for_static_styles';

const config = {
rules: {
'href-or-on-click': HrefOnClick,
'no-restricted-eui-imports': NoRestrictedEuiImports,
'no-css-color': NoCssColor,
'prefer-css-prop-for-static-styles': PreferCSSPropForStaticStyles,
},
configs: {
recommended: {
Expand All @@ -36,7 +34,6 @@ const config = {
'@elastic/eui/href-or-on-click': 'warn',
'@elastic/eui/no-restricted-eui-imports': 'warn',
'@elastic/eui/no-css-color': 'warn',
'@elastic/eui/prefer-css-prop-for-static-styles': 'warn',
},
},
},
Expand Down

This file was deleted.

This file was deleted.