Skip to content

Commit a7e6737

Browse files
committed
refactor(website): cleanup components and legacy docs
1 parent 24e4b38 commit a7e6737

File tree

13 files changed

+121
-160
lines changed

13 files changed

+121
-160
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import type { StaticImageData } from "next/image";
22
import React from "react";
33

44
import logo from "#/assets/logo.svg";
5-
import { Image } from "#/components/image";
5+
import { Image } from "./ui/image";
66

7-
export function Logo() {
7+
export function ESLintReact() {
88
return (
99
<div className="flex flex-col items-center gap-4 m-0 mx-auto p-8 w-fit">
1010
<Image src={logo as StaticImageData} alt="logo" width="150" height="150" />
Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import { Callout } from "nextra/components"
2-
3-
import { ConfigTab, ESLintConfigTabs } from "#/widgets/eslint-config-tabs";
1+
import { Callout, Tabs } from "nextra/components"
42

53
# Advanced Configuration (WIP)
64

75
<Callout type="warning">This page contains experimental features that still under development. The content may change without notice.</Callout>
86

97
## Examples
108

11-
<ESLintConfigTabs>
12-
13-
<ConfigTab>
14-
159
```ts filename="eslint.config.js"
1610
import eslintReact from "@eslint-react/eslint-plugin";
1711

@@ -80,74 +74,3 @@ export default [
8074
},
8175
];
8276
```
83-
84-
</ConfigTab>
85-
86-
<ConfigTab>
87-
88-
```js filename=".eslintrc.js"
89-
module.exports = {
90-
// ...
91-
settings: {
92-
"react-x": {
93-
importSource: "react",
94-
jsxPragma: "createElement",
95-
jsxPragmaFrag: "Fragment",
96-
additionalHooks: {
97-
useLayoutEffect: ["useIsomorphicLayoutEffect"],
98-
},
99-
additionalComponents: [
100-
{
101-
// Match all components with `html` attribute and alias it to `dangerouslySetInnerHTML`
102-
name: "*",
103-
attributes: [
104-
{ name: "html", as: "dangerouslySetInnerHTML" },
105-
],
106-
},
107-
{
108-
// Match Button component with `component="a"` attribute and alias it to `a` component with `rel="noopener noreferrer"` attribute
109-
name: "*",
110-
selector: ":has(JSXAttribute[name.name='component'][value.value='button'])",
111-
as: "button",
112-
attributes: [
113-
{ name: "type", defaultValue: "button" },
114-
],
115-
},
116-
{
117-
// Match Button component with `component="a"` attribute and alias it to `a` component with `rel="noopener noreferrer"` attribute
118-
name: "Button",
119-
selector: ":has(JSXAttribute[name.name='component'][value.value='a'])",
120-
as: "a",
121-
attributes: [
122-
{ name: "rel", defaultValue: "noopener noreferrer" },
123-
],
124-
},
125-
{
126-
// Match MUIButton component with a `href` or `to` attribute and alias it to `a` component with `rel="noopener noreferrer"` attribute
127-
name: "MUIButton",
128-
selector: ":matches(:has(JSXAttribute[name.name='href']), :has(JSXAttribute[name.name='to']))",
129-
as: "a",
130-
attributes: [
131-
{ name: "rel", defaultValue: "noopener noreferrer" },
132-
],
133-
},
134-
{
135-
// Match TextInput component with `mode="uncontrolled"` attribute and alias it to an uncontrolled input component with `content` and `onContentUpdate` pair
136-
name: "TextInput",
137-
selector: ":has(JSXAttribute[name.name='mode'][value.value='uncontrolled'])",
138-
as: "input",
139-
attributes: [
140-
{ name: "content", as: "value", controlled: false },
141-
{ name: "onContentUpdate", as: "onChange" },
142-
],
143-
},
144-
],
145-
version: "detect",
146-
},
147-
},
148-
};
149-
```
150-
151-
</ConfigTab>
152-
153-
</ESLintConfigTabs>

website/pages/docs/configurations.mdx

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { Callout } from "nextra/components"
2-
3-
import { ConfigTab, ESLintConfigTabs } from "#/widgets/eslint-config-tabs";
1+
import { Callout, Tabs } from "nextra/components"
42

53
# Configurations
64

@@ -72,10 +70,6 @@ This can be incredibly helpful for rules to understand the semantics of user-def
7270

7371
## Examples
7472

75-
<ESLintConfigTabs>
76-
77-
<ConfigTab>
78-
7973
```ts filename="eslint.config.js"
8074
import eslintReact from "@eslint-react/eslint-plugin";
8175

@@ -108,38 +102,3 @@ export default [
108102
},
109103
];
110104
```
111-
112-
</ConfigTab>
113-
114-
<ConfigTab>
115-
116-
```js filename=".eslintrc.js"
117-
module.exports = {
118-
// ...
119-
settings: {
120-
"react-x": {
121-
importSource: "react",
122-
jsxPragma: "createElement",
123-
jsxPragmaFrag: "Fragment",
124-
additionalHooks: {
125-
useLayoutEffect: ["useIsomorphicLayoutEffect"],
126-
},
127-
additionalComponents: [
128-
{
129-
name: "Link",
130-
as: "a",
131-
attributes: [
132-
{ name: "to", as: "href" },
133-
{ name: "rel", defaultValue: "noopener noreferrer" },
134-
],
135-
},
136-
],
137-
version: "detect",
138-
},
139-
},
140-
};
141-
```
142-
143-
</ConfigTab>
144-
145-
</ESLintConfigTabs>

website/pages/docs/getting-started.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
1+
import { Tabs } from "nextra/components";
2+
13
# Getting Started with TypeScript
24

35
## Install
46

7+
<Tabs items={["npm", "pnpm", "yarn"]}>
8+
9+
<Tabs.Tab>
10+
511
```sh filename="Terminal"
612
npm install --save-dev typescript-eslint @eslint-react/eslint-plugin
713
```
814

15+
</Tabs.Tab>
16+
17+
<Tabs.Tab>
18+
19+
```sh filename="Terminal"
20+
pnpm add --save-dev typescript-eslint @eslint-react/eslint-plugin
21+
```
22+
23+
</Tabs.Tab>
24+
25+
<Tabs.Tab>
26+
27+
```sh filename="Terminal"
28+
yarn add --dev typescript-eslint @eslint-react/eslint-plugin
29+
```
30+
31+
</Tabs.Tab>
32+
33+
</Tabs>
34+
935
## Setup
1036

1137
```js filename="eslint.config.js"

website/pages/docs/getting-started/javascript-with-babel.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
1+
import { Tabs } from "nextra/components";
2+
13
# Getting Started with JavaScript + Babel
24

35
## Install
46

7+
<Tabs items={["npm", "pnpm", "yarn"]}>
8+
9+
<Tabs.Tab>
10+
511
```sh copy filename="Terminal"
612
npm install --save-dev @babel/core @babel/eslint-parser @babel/preset-env @babel/preset-react @eslint-react/eslint-plugin
713
```
814

15+
</Tabs.Tab>
16+
17+
<Tabs.Tab>
18+
19+
```sh copy filename="Terminal"
20+
pnpm add --save-dev @babel/core @babel/eslint-parser @babel/preset-env @babel/preset-react @eslint-react/eslint-plugin
21+
```
22+
23+
</Tabs.Tab>
24+
25+
<Tabs.Tab>
26+
27+
```sh copy filename="Terminal"
28+
yarn add --dev @babel/core @babel/eslint-parser @babel/preset-env @babel/preset-react @eslint-react/eslint-plugin
29+
```
30+
31+
</Tabs.Tab>
32+
33+
</Tabs>
34+
935
## Setup
1036

1137
```js filename="eslint.config.js"

website/pages/docs/getting-started/javascript.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
1+
import { Tabs } from "nextra/components";
2+
13
# Getting Started with JavaScript
24

35
## Install
46

7+
<Tabs items={["npm", "pnpm", "yarn"]}>
8+
9+
<Tabs.Tab>
10+
511
```sh copy filename="Terminal"
612
npm install --save-dev @eslint-react/eslint-plugin
713
```
814

15+
</Tabs.Tab>
16+
17+
<Tabs.Tab>
18+
19+
```sh copy filename="Terminal"
20+
pnpm add --save-dev @eslint-react/eslint-plugin
21+
```
22+
23+
</Tabs.Tab>
24+
25+
<Tabs.Tab>
26+
27+
```sh copy filename="Terminal"
28+
yarn add --dev @eslint-react/eslint-plugin
29+
```
30+
31+
</Tabs.Tab>
32+
33+
</Tabs>
34+
935
## Setup
1036

1137
```js filename="eslint.config.js"

website/pages/docs/getting-started/typescript.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
1+
import { Tabs } from "nextra/components";
2+
13
# Getting Started with TypeScript
24

35
## Install
46

7+
<Tabs items={["npm", "pnpm", "yarn"]}>
8+
9+
<Tabs.Tab>
10+
511
```sh filename="Terminal"
612
npm install --save-dev typescript-eslint @eslint-react/eslint-plugin
713
```
814

15+
</Tabs.Tab>
16+
17+
<Tabs.Tab>
18+
19+
```sh filename="Terminal"
20+
pnpm add --save-dev typescript-eslint @eslint-react/eslint-plugin
21+
```
22+
23+
</Tabs.Tab>
24+
25+
<Tabs.Tab>
26+
27+
```sh filename="Terminal"
28+
yarn add --dev typescript-eslint @eslint-react/eslint-plugin
29+
```
30+
31+
</Tabs.Tab>
32+
33+
</Tabs>
34+
935
## Setup
1036

1137
```js filename="eslint.config.js"

website/pages/docs/presets.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import { Callout } from "nextra/components";
2-
3-
import { ConfigTab, ESLintConfigTabs } from "#/widgets/eslint-config-tabs";
1+
import { Callout, Tabs } from "nextra/components";
42

53
## Presets
64

75
The following presets are available in `@eslint-react/eslint-plugin`:
86

9-
<ESLintConfigTabs>
7+
<Tabs items={["Flat Config", "Legacy Config"]}>
108

11-
<ConfigTab>
9+
<Tabs.Tab>
1210

1311
<Callout type="info">These presets are for ESLint Flat Config (`eslint.config.js`) only.</Callout>
1412

@@ -51,12 +49,14 @@ The following presets are available in `@eslint-react/eslint-plugin`:
5149
| :------------------- | :-------------------------- |
5250
| Off DOM (`off-dom`) | Disable DOM (`disable-dom`) |
5351

54-
</ConfigTab>
52+
</Tabs.Tab>
5553

56-
<ConfigTab>
54+
<Tabs.Tab>
5755

5856
<Callout type="info">These presets are for ESLint Legacy Config (`.eslintrc.*`) only.</Callout>
5957

58+
<Callout type="warning">This config system is deprecated and not enabled by default in ESLint >= 9.0.0.</Callout>
59+
6060
### Bare Bones
6161

6262
- **Core** (`core-legacy`)\
@@ -96,6 +96,6 @@ The following presets are available in `@eslint-react/eslint-plugin`:
9696
| :------------------------- | :--------------------------------- |
9797
| Off DOM (`off-dom-legacy`) | Disable DOM (`disable-dom-legacy`) |
9898

99-
</ConfigTab>
99+
</Tabs.Tab>
100100

101-
</ESLintConfigTabs>
101+
</Tabs>

0 commit comments

Comments
 (0)