Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-react-perf

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react-perf - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

42

docs/rules/no-new-objects-as-props.md

@@ -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 });
```

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc