You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You may want to forbid usage of certain elements in favor of others, (e.g. forbid all `<div />` and use `<Box />` instead). This rule allows you to configure a list of forbidden elements and to specify their desired replacements.
4
+
5
+
## Rule Details
6
+
7
+
This rule checks all JSX elements and `React.createElement` calls and verifies that no forbidden elements are used. This rule is off by default. If on, no elements are forbidden by default.
This rule forbids using another component's prop types unless they are explicitly imported/exported. This allows people who want to use [babel-plugin-transform-react-remove-prop-types](https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types) to remove propTypes from their components in production builds, to do so safely.
4
+
5
+
In order to ensure that imports are explicitly exported it is recommended to use the ["named" rule in eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md) in conjunction with this rule.
6
+
7
+
## Rule Details
8
+
9
+
This rule checks all objects and ensures that the `propTypes` property is not used.
10
+
11
+
The following patterns are considered warnings:
12
+
13
+
```js
14
+
importSomeComponentfrom'./SomeComponent';
15
+
SomeComponent.propTypes;
16
+
17
+
var { propTypes } = SomeComponent;
18
+
19
+
SomeComponent['propTypes'];
20
+
```
21
+
22
+
The following patterns are not considered warnings:
This rule aims to make a certain production optimization, removing prop types, less prone to error. This rule may not be relevant to you if you do not wish to make use of this optimization.
Copy file name to clipboardExpand all lines: docs/rules/jsx-max-props-per-line.md
+30-4
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,16 @@ Limiting the maximum of props on a single line can improve readability.
4
4
5
5
## Rule Details
6
6
7
-
This rule checks all JSX elements and verifies that the number of props per line do not exceed the maximum allowed. A spread attribute counts as one prop. This rule is off by default and when on the default maximum of props on one line is `1`.
7
+
This rule checks all JSX elements and verifies that the number of props per line do not exceed the maximum allowed. Props are considered to be in a new line if there is a line break between the start of the prop and the end of the previous prop. A spread attribute counts as one prop. This rule is off by default and when on the default maximum of props on one line is `1`.
8
8
9
9
The following patterns are considered warnings:
10
10
11
11
```jsx
12
12
<Hello lastName="Smith" firstName="John"/>;
13
+
14
+
<Hello foo={{
15
+
bar
16
+
}} baz />;
13
17
```
14
18
15
19
The following patterns are not considered warnings:
@@ -31,7 +35,7 @@ The following patterns are not considered warnings:
0 commit comments