|
| 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 --> |
0 commit comments