@bastidood/oxlint-config-tanstack-query 0.0.0-stage → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +37 -2
- package/dist/react.d.mts +33 -0
- package/dist/react.mjs +35 -0
- package/package.json +40 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Basti Ortiz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@bastidood/oxlint-config-tanstack-query`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TanStack Query entries for `@bastidood/oxlint-config`, including the rules of `@tanstack/eslint-plugin-query`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add --save-dev @bastidood/oxlint-config-tanstack-query eslint typescript
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The plugin loads `eslint` and `typescript` at runtime, so both must be installed even though Oxlint runs the rules.
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// oxlint.config.ts
|
|
17
|
+
import { compose } from '@bastidood/oxlint-config';
|
|
18
|
+
import { TANSTACK_REACT_QUERY } from '@bastidood/oxlint-config-tanstack-query/react';
|
|
19
|
+
import { CORE } from '@bastidood/oxlint-config/core';
|
|
20
|
+
import { REACT } from '@bastidood/oxlint-config/react';
|
|
21
|
+
import { TANSTACK_QUERY } from '@bastidood/oxlint-config/tanstack/query';
|
|
22
|
+
import { defineConfig } from 'oxlint';
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
extends: [compose(CORE, REACT, TANSTACK_QUERY, TANSTACK_REACT_QUERY)],
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Entry Points
|
|
30
|
+
|
|
31
|
+
| Entry point | Contents |
|
|
32
|
+
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
33
|
+
| `@bastidood/oxlint-config-tanstack-query/react` | Enables `@tanstack/eslint-plugin-query` except `no-void-query-fn`, which needs type information; bans `useQueryClient` and keeping the whole `useMutation` result |
|
|
34
|
+
|
|
35
|
+
## Limitations
|
|
36
|
+
|
|
37
|
+
- Rules are not configurable.
|
|
38
|
+
- `no-void-query-fn` is off because Oxlint does not give type information to JS plugins.
|
package/dist/react.d.mts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TanStack React Query rules from `@tanstack/eslint-plugin-query`. `no-void-query-fn` is off because it needs type
|
|
3
|
+
* information, which Oxlint does not give to JS plugins. The plugin specifier resolves from this package, so that the
|
|
4
|
+
* consumer does not install the plugin itself.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TANSTACK_REACT_QUERY: {
|
|
7
|
+
config: {
|
|
8
|
+
jsPlugins: {
|
|
9
|
+
name: string;
|
|
10
|
+
specifier: string;
|
|
11
|
+
}[];
|
|
12
|
+
rules: {
|
|
13
|
+
'@tanstack/query/exhaustive-deps': "error";
|
|
14
|
+
'@tanstack/query/infinite-query-property-order': "error";
|
|
15
|
+
'@tanstack/query/mutation-property-order': "error";
|
|
16
|
+
'@tanstack/query/no-rest-destructuring': "error";
|
|
17
|
+
'@tanstack/query/no-unstable-deps': "error";
|
|
18
|
+
'@tanstack/query/prefer-query-options': "error";
|
|
19
|
+
'@tanstack/query/stable-query-client': "error";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
restrictions: {
|
|
23
|
+
importPaths: {
|
|
24
|
+
name: string;
|
|
25
|
+
importNames: string[];
|
|
26
|
+
message: string;
|
|
27
|
+
}[];
|
|
28
|
+
syntax: {
|
|
29
|
+
selector: string;
|
|
30
|
+
message: string;
|
|
31
|
+
}[];
|
|
32
|
+
};
|
|
33
|
+
};
|
package/dist/react.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/react.ts
|
|
2
|
+
/**
|
|
3
|
+
* TanStack React Query rules from `@tanstack/eslint-plugin-query`. `no-void-query-fn` is off because it needs type
|
|
4
|
+
* information, which Oxlint does not give to JS plugins. The plugin specifier resolves from this package, so that the
|
|
5
|
+
* consumer does not install the plugin itself.
|
|
6
|
+
*/
|
|
7
|
+
const TANSTACK_REACT_QUERY = {
|
|
8
|
+
config: {
|
|
9
|
+
jsPlugins: [{
|
|
10
|
+
name: "@tanstack/query",
|
|
11
|
+
specifier: import.meta.resolve("@tanstack/eslint-plugin-query")
|
|
12
|
+
}],
|
|
13
|
+
rules: {
|
|
14
|
+
"@tanstack/query/exhaustive-deps": "error",
|
|
15
|
+
"@tanstack/query/infinite-query-property-order": "error",
|
|
16
|
+
"@tanstack/query/mutation-property-order": "error",
|
|
17
|
+
"@tanstack/query/no-rest-destructuring": "error",
|
|
18
|
+
"@tanstack/query/no-unstable-deps": "error",
|
|
19
|
+
"@tanstack/query/prefer-query-options": "error",
|
|
20
|
+
"@tanstack/query/stable-query-client": "error"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
restrictions: {
|
|
24
|
+
importPaths: [{
|
|
25
|
+
name: "@tanstack/react-query",
|
|
26
|
+
importNames: ["useQueryClient"],
|
|
27
|
+
message: "Perform client actions in mutation success or failure hooks, which receive the query client in context, instead of capturing `useQueryClient`. Suppress this only to call `prefetchQuery` on hover or `ensureQueryData` in an event handler, and name that use in the suppression reason."
|
|
28
|
+
}],
|
|
29
|
+
syntax: [{
|
|
30
|
+
selector: "VariableDeclarator[id.type=\"Identifier\"] > CallExpression[callee.name=\"useMutation\"]",
|
|
31
|
+
message: "Destructure the fields that you use from `useMutation(...)`. The result object changes identity on every render, so keeping it whole makes it an unstable dependency."
|
|
32
|
+
}]
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export { TANSTACK_REACT_QUERY };
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastidood/oxlint-config-tanstack-query",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "TanStack Query rules for @bastidood/oxlint-config, including @tanstack/eslint-plugin-query.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/BastiDood/slopstopper",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/BastiDood/slopstopper.git",
|
|
10
|
+
"directory": "configs/oxlint-tanstack-query"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"exports": {
|
|
14
|
+
"./react": "./dist/react.mjs"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@tanstack/eslint-plugin-query": "^5.106.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@bastidood/oxlint-config": "0.6.1",
|
|
27
|
+
"@bastidood/tsconfig": "0.1.1",
|
|
28
|
+
"@types/node": "^26.6.6",
|
|
29
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
30
|
+
"oxlint": "^1.92.0",
|
|
31
|
+
"tsdown": "0.23.5",
|
|
32
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@bastidood/oxlint-config": "^0.6.1",
|
|
36
|
+
"eslint": "^10.0.0",
|
|
37
|
+
"oxlint": "^1.92.0",
|
|
38
|
+
"typescript": ">=4.8.4 <6.1.0"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"check": "tsc"
|
|
42
|
+
}
|
|
6
43
|
}
|