Skip to content

Commit c20c14c

Browse files
committed
Add docs file for new rule.
1 parent 0880d16 commit c20c14c

File tree

3 files changed

+116
-2
lines changed

3 files changed

+116
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const [editedValue, setEditedValue] = createSignal(props.value);
130130
|| | [solid/jsx-uses-vars](docs/jsx-uses-vars.md) | Prevent variables used in JSX from being marked as unused. |
131131
|| 🔧 | [solid/no-destructure](docs/no-destructure.md) | Disallow destructuring props. In Solid, props must be used with property accesses (`props.foo`) to preserve reactivity. This rule only tracks destructuring in the parameter list. |
132132
|| 🔧 | [solid/no-innerhtml](docs/no-innerhtml.md) | Disallow usage of the innerHTML attribute, which can often lead to security vulnerabilities. |
133-
|| | [solid/no-proxy-apis](docs/no-proxy-apis.md) | Disallow usage of APIs that use ES6 Proxies, to target environments that don't support them. |
133+
|| | [solid/no-proxy-apis](docs/no-proxy-apis.md) | Disallow usage of APIs that use ES6 Proxies, only to target environments that don't support them. |
134134
|| 🔧 | [solid/no-react-specific-props](docs/no-react-specific-props.md) | Disallow usage of React-specific `className`/`htmlFor` props, which were deprecated in v1.4.0. |
135135
|| | [solid/no-unknown-namespaces](docs/no-unknown-namespaces.md) | Enforce using only Solid-specific namespaced attribute names (i.e. `'on:'` in `<div on:click={...} />`). |
136136
|| 🔧 | [solid/prefer-classlist](docs/prefer-classlist.md) | Enforce using the classlist prop over importing a classnames helper. The classlist prop accepts an object `{ [class: string]: boolean }` just like classnames. |

docs/no-proxy-apis.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<!-- AUTO-GENERATED-CONTENT:START (HEADER) -->
2+
# solid/no-proxy-apis
3+
Disallow usage of APIs that use ES6 Proxies, only to target environments that don't support them.
4+
This rule is **off** by default.
5+
6+
[View source](../src/rules/no-proxy-apis.ts) · [View tests](../test/rules/no-proxy-apis.test.ts)
7+
8+
<!-- AUTO-GENERATED-CONTENT:END -->
9+
10+
<!-- AUTO-GENERATED-CONTENT:START (OPTIONS) -->
11+
12+
<!-- AUTO-GENERATED-CONTENT:END -->
13+
14+
<!-- AUTO-GENERATED-CONTENT:START (CASES) -->
15+
## Tests
16+
17+
### Invalid Examples
18+
19+
These snippets cause lint errors, and some can be auto-fixed.
20+
21+
```js
22+
let el = <div className="greeting">Hello world!</div>;
23+
// after eslint --fix:
24+
let el = <div class="greeting">Hello world!</div>;
25+
26+
let el = <div className={"greeting"}>Hello world!</div>;
27+
// after eslint --fix:
28+
let el = <div class={"greeting"}>Hello world!</div>;
29+
30+
let el = <div className="greeting" />;
31+
// after eslint --fix:
32+
let el = <div class="greeting" />;
33+
34+
let el = (
35+
<div many other attributes className="greeting">
36+
Hello world!
37+
</div>
38+
);
39+
// after eslint --fix:
40+
let el = (
41+
<div many other attributes class="greeting">
42+
Hello world!
43+
</div>
44+
);
45+
46+
let el = <PascalComponent className="greeting">Hello world!</PascalComponent>;
47+
// after eslint --fix:
48+
let el = <PascalComponent class="greeting">Hello world!</PascalComponent>;
49+
50+
let el = <label htmlFor="id">Hello world!</label>;
51+
// after eslint --fix:
52+
let el = <label for="id">Hello world!</label>;
53+
54+
let el = <label htmlFor={"id"}>Hello world!</label>;
55+
// after eslint --fix:
56+
let el = <label for={"id"}>Hello world!</label>;
57+
58+
let el = (
59+
<label many other attributes htmlFor="id">
60+
Hello world!
61+
</label>
62+
);
63+
// after eslint --fix:
64+
let el = (
65+
<label many other attributes for="id">
66+
Hello world!
67+
</label>
68+
);
69+
70+
let el = <PascalComponent htmlFor="id">Hello world!</PascalComponent>;
71+
// after eslint --fix:
72+
let el = <PascalComponent for="id">Hello world!</PascalComponent>;
73+
74+
let el = <div key={item.id} />;
75+
// after eslint --fix:
76+
let el = <div />;
77+
78+
```
79+
80+
### Valid Examples
81+
82+
These snippets don't cause lint errors.
83+
84+
```js
85+
let el = <div>Hello world!</div>;
86+
87+
let el = <div class="greeting">Hello world!</div>;
88+
89+
let el = <div class={"greeting"}>Hello world!</div>;
90+
91+
let el = (
92+
<div many other attributes class="greeting">
93+
Hello world!
94+
</div>
95+
);
96+
97+
let el = <label for="id">Hello world!</label>;
98+
99+
let el = <label for="id">Hello world!</label>;
100+
101+
let el = <label for={"id"}>Hello world!</label>;
102+
103+
let el = (
104+
<label many other attributes for="id">
105+
Hello world!
106+
</label>
107+
);
108+
109+
let el = <PascalComponent class="greeting" for="id" />;
110+
111+
let el = <PascalComponent key={item.id} />;
112+
113+
```
114+
<!-- AUTO-GENERATED-CONTENT:END -->

src/rules/no-proxy-apis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const rule: TSESLint.RuleModule<
1010
docs: {
1111
recommended: false,
1212
description:
13-
"Disallow usage of APIs that use ES6 Proxies, to target environments that don't support them.",
13+
"Disallow usage of APIs that use ES6 Proxies, only to target environments that don't support them.",
1414
url: "https://github.com/solidjs-community/eslint-plugin-solid/blob/main/docs/no-proxy-apis.md",
1515
},
1616
schema: [],

0 commit comments

Comments
 (0)