Skip to content

Commit 730ce0a

Browse files
committed
docs: React Query Eslint plugin 세션 추가
1 parent 864cf71 commit 730ce0a

File tree

2 files changed

+120
-3
lines changed

2 files changed

+120
-3
lines changed

README.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
30. [서버 로딩 중일 때 Fallback UI를 선언적으로 보여주기 위한 Suspense](#suspense)
6262
31. [앱 전체에 동일한 쿼리 함수를 공유하는 Default Query Function](#default-query-function)
6363
32. [리액트 쿼리에 타입스크립트 적용](#react-query-typescript)
64-
33. [리액트 쿼리 지원 버전](#지원-버전)
64+
33. [리액트 쿼리 ESLint 적용](#react-query-eslint-plugin)
65+
34. [리액트 쿼리 지원 버전](#지원-버전)
6566

6667
<br />
6768

@@ -1447,7 +1448,9 @@ const queryClient = new QueryClient({
14471448
});
14481449

14491450
function App() {
1450-
return <QueryClientProvider client={queryClient}>{/* ... */}</QueryClientProvider>;
1451+
return (
1452+
<QueryClientProvider client={queryClient}>{/* ... */}</QueryClientProvider>
1453+
);
14511454
}
14521455
```
14531456

@@ -1657,6 +1660,62 @@ const { data } = useQuery({
16571660

16581661
<br />
16591662

1663+
## React Query ESLint Plugin
1664+
1665+
[목차 이동](#주요-컨셉-및-가이드-목차)
1666+
1667+
- Tanstack Query는 `자체 ESLint Plugin`을 제공합니다. 해당 플러그인을 통해 모범 사례를 적용하고, 일반적인 실수를 방지할 수 있습니다.
1668+
1669+
### 설치
1670+
1671+
```bash
1672+
$ npm i -D @tanstack/eslint-plugin-query
1673+
# or
1674+
$ pnpm add -D @tanstack/eslint-plugin-query
1675+
# or
1676+
$ yarn add -D @tanstack/eslint-plugin-query
1677+
# or
1678+
$ bun add -D @tanstack/eslint-plugin-query
1679+
```
1680+
1681+
<br />
1682+
1683+
### 사용 방법(1)
1684+
1685+
- 플러그인에 대한 `권장하는 모든 rule`을 적용하려면 아래와 같이 `.eslintrc.js` 파일 `extends`배열 안에 `plugin:@tanstack/eslint-plugin-query/recommended`을 추가합니다.
1686+
1687+
```js
1688+
module.exports = {
1689+
// ...
1690+
extends: ["plugin:@tanstack/eslint-plugin-query/recommended"],
1691+
rules: {
1692+
/* 수정하고자 하는 rule 추가 가능... */
1693+
},
1694+
};
1695+
```
1696+
1697+
- 물론, rule을 변경하고 싶다면 rules에 아래 `사용방법(2)`와 같이 rule을 추가하면 됩니다.
1698+
1699+
<br />
1700+
1701+
### 사용 방법(2)
1702+
1703+
- 원하는 `rule`을 개별적으로 셋팅해서 적용하려면 아래와 같이 `.eslintrc.js` 파일 `plugins`배열 안에 `@tanstack/query`를 추가하고, 적용하고자 하는 rules에 규칙을 추가합니다.
1704+
1705+
```js
1706+
module.exports = {
1707+
// ...
1708+
plugins: ["@tanstack/query"],
1709+
rules: {
1710+
"@tanstack/query/exhaustive-deps": "error",
1711+
"@tanstack/query/no-rest-destructuring": "warn",
1712+
"@tanstack/query/stable-query-client": "error",
1713+
},
1714+
};
1715+
```
1716+
1717+
<br />
1718+
16601719
## 지원 버전
16611720

16621721
[목차 이동](#주요-컨셉-및-가이드-목차)

README.v4.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
28. [서버 로딩중일 때 Fallback UI를 선언적으로 보여주기 위한 Suspense](#suspense)
5656
29. [앱 전체에 동일한 쿼리 함수를 공유하는 Default Query Function](#default-query-function)
5757
30. [리액트 쿼리에 타입스크립트 적용](#react-query-typescript)
58-
31. [리액트 쿼리 지원 버전](#지원-버전)
58+
31. [리액트 쿼리 ESLint 적용](#react-query-eslint-plugin)
59+
32. [리액트 쿼리 지원 버전](#지원-버전)
5960

6061
<br />
6162

@@ -1547,6 +1548,63 @@ const { data } = useQuery(["groups"], fetchGroups, {
15471548
15481549
<br />
15491550
1551+
## React Query ESLint Plugin
1552+
1553+
[목차 이동](#주요-컨셉-및-가이드-목차)
1554+
1555+
- Tanstack Query는 `자체 ESLint Plugin`을 제공합니다. 해당 플러그인을 통해 모범 사례를 적용하고, 일반적인 실수를 방지할 수 있습니다.
1556+
1557+
### 설치
1558+
1559+
```bash
1560+
$ npm i -D @tanstack/eslint-plugin-query
1561+
# or
1562+
$ pnpm add -D @tanstack/eslint-plugin-query
1563+
# or
1564+
$ yarn add -D @tanstack/eslint-plugin-query
1565+
# or
1566+
$ bun add -D @tanstack/eslint-plugin-query
1567+
```
1568+
1569+
<br />
1570+
1571+
### 사용 방법(1)
1572+
1573+
- 플러그인에 대한 `권장하는 모든 rule`을 적용하려면 아래와 같이 `.eslintrc.js` 파일 `extends`배열 안에 `plugin:@tanstack/eslint-plugin-query/recommended`을 추가합니다.
1574+
1575+
```js
1576+
module.exports = {
1577+
// ...
1578+
extends: ["plugin:@tanstack/eslint-plugin-query/recommended"],
1579+
rules: {
1580+
/* 수정하고자 하는 rule 추가 가능... */
1581+
},
1582+
};
1583+
```
1584+
1585+
- 물론, rule을 변경하고 싶다면 rules에 아래 `사용방법(2)`와 같이 rule을 추가하면 됩니다.
1586+
1587+
<br />
1588+
1589+
### 사용 방법(2)
1590+
1591+
- 원하는 `rule`을 개별적으로 셋팅해서 적용하려면 아래와 같이 `.eslintrc.js` 파일 `plugins`배열 안에 `@tanstack/query`를 추가하고, 적용하고자 하는 rules에 규칙을 추가합니다.
1592+
1593+
```js
1594+
module.exports = {
1595+
// ...
1596+
plugins: ["@tanstack/query"],
1597+
rules: {
1598+
"@tanstack/query/exhaustive-deps": "error",
1599+
"@tanstack/query/no-deprecated-options": "error",
1600+
"@tanstack/query/prefer-query-object-syntax": "error",
1601+
"@tanstack/query/stable-query-client": "error",
1602+
},
1603+
};
1604+
```
1605+
1606+
<br />
1607+
15501608
## 지원 버전
15511609
15521610
[목차 이동](#주요-컨셉-및-가이드-목차)

0 commit comments

Comments
 (0)