eslint-plugin-react-perf
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,5 +0,4 @@ | ||
# Enforce style prop value being an object (style-prop-object) | ||
# Prevent [...], {...} as JSX props (no-new-objects-as-props) | ||
Require that the value of the prop `style` be an object or a variable that is | ||
an object. | ||
Prevent Arrays and Objects from being created in your `render()` and used as JSX props | ||
@@ -11,42 +10,19 @@ ## Rule Details | ||
```jsx | ||
<div style="color: 'red'" /> | ||
<Item config={{}} /> | ||
<div style={true} /> | ||
<Item list={[]} /> | ||
<Hello style={true} /> | ||
<Item config={config || {}} /> | ||
const styles = true; | ||
<div style={styles} /> | ||
<Item list={list || []} /> | ||
``` | ||
```js | ||
React.createElement("div", { style: "color: 'red'" }); | ||
React.createElement("div", { style: true }); | ||
React.createElement("Hello", { style: true }); | ||
const styles = true; | ||
React.createElement("div", { style: styles }); | ||
``` | ||
The following patterns are not considered warnings: | ||
```jsx | ||
<div style={{ color: "red" }} /> | ||
<Item config={staticConfig} /> | ||
<Hello style={{ color: "red" }} /> | ||
<Item list={this.props.list} /> | ||
const styles = { color: "red" }; | ||
<div style={styles} /> | ||
<div style={{display: 'none'}} /> | ||
``` | ||
```js | ||
React.createElement("div", { style: { color: 'red' }}); | ||
React.createElement("Hello", { style: { color: 'red' }}); | ||
const styles = { height: '100px' }; | ||
React.createElement("div", { style: styles }); | ||
``` |
13
index.js
@@ -21,2 +21,15 @@ 'use strict' | ||
configs: { | ||
recommended: { | ||
plugins: [ | ||
'react-perf' | ||
], | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
}, | ||
rules: { | ||
'react-perf/no-new-objects-as-props': 2 | ||
} | ||
}, | ||
all: { | ||
@@ -23,0 +36,0 @@ plugin: [ |
{ | ||
"name": "eslint-plugin-react-perf", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Performance-minded React linting rules for ESLint", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -26,3 +26,3 @@ eslint-plugin-react-perf | ||
* [react-perf/no-new-objects-as-props](docs/rules/no-new-objects-as-props.md): Prevent new Object/Array as JSX components | ||
* [react-perf/no-new-objects-as-props](docs/rules/no-new-objects-as-props.md): Prevent [...], {...} as JSX props | ||
@@ -29,0 +29,0 @@ ## Recommended |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
538
16507