Skip to content

Commit 1800537

Browse files
authored
docs: Fix and standardize JSX code examples (#17591)
Fix and standardize JSX code examples
1 parent 22a5582 commit 1800537

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

docs/src/rules/jsx-quotes.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ This rule has a string option:
3737

3838
Examples of **incorrect** code for this rule with the default `"prefer-double"` option:
3939

40-
:::incorrect
40+
:::incorrect { "ecmaFeatures": { "jsx": true } }
4141

42-
```xml
42+
```jsx
4343
/*eslint jsx-quotes: ["error", "prefer-double"]*/
4444

4545
<a b='c' />
@@ -49,9 +49,9 @@ Examples of **incorrect** code for this rule with the default `"prefer-double"`
4949

5050
Examples of **correct** code for this rule with the default `"prefer-double"` option:
5151

52-
:::correct
52+
:::correct { "ecmaFeatures": { "jsx": true } }
5353

54-
```xml
54+
```jsx
5555
/*eslint jsx-quotes: ["error", "prefer-double"]*/
5656

5757
<a b="c" />
@@ -64,9 +64,9 @@ Examples of **correct** code for this rule with the default `"prefer-double"` op
6464

6565
Examples of **incorrect** code for this rule with the `"prefer-single"` option:
6666

67-
:::incorrect
67+
:::incorrect { "ecmaFeatures": { "jsx": true } }
6868

69-
```xml
69+
```jsx
7070
/*eslint jsx-quotes: ["error", "prefer-single"]*/
7171

7272
<a b="c" />
@@ -76,9 +76,9 @@ Examples of **incorrect** code for this rule with the `"prefer-single"` option:
7676

7777
Examples of **correct** code for this rule with the `"prefer-single"` option:
7878

79-
:::correct
79+
:::correct { "ecmaFeatures": { "jsx": true } }
8080

81-
```xml
81+
```jsx
8282
/*eslint jsx-quotes: ["error", "prefer-single"]*/
8383

8484
<a b='c' />

docs/src/rules/keyword-spacing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ if (foo) {
5858

5959
Examples of **correct** code for this rule with the default `{ "before": true }` option:
6060

61-
::: correct
61+
::: correct { "ecmaFeatures": { "jsx": true } }
6262

63-
```js
63+
```jsx
6464
/*eslint keyword-spacing: ["error", { "before": true }]*/
6565
/*eslint-env es6*/
6666

@@ -173,9 +173,9 @@ if(foo) {
173173

174174
Examples of **correct** code for this rule with the default `{ "after": true }` option:
175175

176-
::: correct
176+
::: correct { "ecmaFeatures": { "jsx": true } }
177177

178-
```js
178+
```jsx
179179
/*eslint keyword-spacing: ["error", { "after": true }]*/
180180

181181
if (foo) {

docs/src/rules/no-extra-parens.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ foo ? bar : (baz || qux);
214214

215215
Examples of **correct** code for this rule with the `all` and `{ "ignoreJSX": "all" }` options:
216216

217-
::: correct
217+
::: correct { "ecmaFeatures": { "jsx": true } }
218218

219-
```js
219+
```jsx
220220
/* eslint no-extra-parens: ["error", "all", { ignoreJSX: "all" }] */
221221
const Component = (<div />)
222222
const Component = (
@@ -230,9 +230,9 @@ const Component = (
230230

231231
Examples of **incorrect** code for this rule with the `all` and `{ "ignoreJSX": "multi-line" }` options:
232232

233-
::: incorrect
233+
::: incorrect { "ecmaFeatures": { "jsx": true } }
234234

235-
```js
235+
```jsx
236236
/* eslint no-extra-parens: ["error", "all", { ignoreJSX: "multi-line" }] */
237237
const Component = (<div />)
238238
const Component = (<div><p /></div>)
@@ -242,9 +242,9 @@ const Component = (<div><p /></div>)
242242

243243
Examples of **correct** code for this rule with the `all` and `{ "ignoreJSX": "multi-line" }` options:
244244

245-
::: correct
245+
::: correct { "ecmaFeatures": { "jsx": true } }
246246

247-
```js
247+
```jsx
248248
/* eslint no-extra-parens: ["error", "all", { ignoreJSX: "multi-line" }] */
249249
const Component = (
250250
<div>
@@ -262,9 +262,9 @@ const Component = (
262262

263263
Examples of **incorrect** code for this rule with the `all` and `{ "ignoreJSX": "single-line" }` options:
264264

265-
::: incorrect
265+
::: incorrect { "ecmaFeatures": { "jsx": true } }
266266

267-
```js
267+
```jsx
268268
/* eslint no-extra-parens: ["error", "all", { ignoreJSX: "single-line" }] */
269269
const Component = (
270270
<div>
@@ -282,9 +282,9 @@ const Component = (
282282

283283
Examples of **correct** code for this rule with the `all` and `{ "ignoreJSX": "single-line" }` options:
284284

285-
::: correct
285+
::: correct { "ecmaFeatures": { "jsx": true } }
286286

287-
```js
287+
```jsx
288288
/* eslint no-extra-parens: ["error", "all", { ignoreJSX: "single-line" }] */
289289
const Component = (<div />)
290290
const Component = (<div><p /></div>)

docs/src/rules/no-inline-comments.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ Comments inside the curly braces in JSX are allowed to be on the same line as th
5454

5555
Examples of **incorrect** code for this rule:
5656

57-
::: incorrect
57+
::: incorrect { "ecmaFeatures": { "jsx": true } }
5858

59-
```js
59+
```jsx
6060
/*eslint no-inline-comments: "error"*/
6161

6262
var foo = <div>{ /* On the same line with other code */ }<h1>Some heading</h1></div>;
@@ -74,9 +74,9 @@ var bar = (
7474

7575
Examples of **correct** code for this rule:
7676

77-
::: correct
77+
::: correct { "ecmaFeatures": { "jsx": true } }
7878

79-
```js
79+
```jsx
8080
/*eslint no-inline-comments: "error"*/
8181

8282
var foo = (

docs/src/rules/no-irregular-whitespace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ function thing() {
197197

198198
Examples of additional **correct** code for this rule with the `{ "skipJSXText": true }` option:
199199

200-
::: correct
200+
::: correct { "ecmaFeatures": { "jsx": true } }
201201

202-
```js
202+
```jsx
203203
/*eslint no-irregular-whitespace: ["error", { "skipJSXText": true }]*/
204204
/*eslint-env es6*/
205205

docs/src/rules/no-unused-expressions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ JSX is most-commonly used in the React ecosystem, where it is compiled to `React
251251

252252
Examples of **incorrect** code for the `{ "enforceForJSX": true }` option:
253253

254-
::: incorrect
254+
::: incorrect { "ecmaFeatures": { "jsx": true } }
255255

256256
```jsx
257257
/*eslint no-unused-expressions: ["error", { "enforceForJSX": true }]*/
@@ -265,7 +265,7 @@ Examples of **incorrect** code for the `{ "enforceForJSX": true }` option:
265265

266266
Examples of **correct** code for the `{ "enforceForJSX": true }` option:
267267

268-
::: correct
268+
::: correct { "ecmaFeatures": { "jsx": true } }
269269

270270
```jsx
271271
/*eslint no-unused-expressions: ["error", { "enforceForJSX": true }]*/

0 commit comments

Comments
 (0)