Skip to content

Commit 95c869a

Browse files
committed
custom config for perfectionist/sort-objects for happy @tanstack/react-query usage
1 parent 2c29269 commit 95c869a

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

hackathon/spacecraft/.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ module.exports = {
3131
camelcase: "off", // Disable camelcase rule
3232
"perfectionist/sort-imports": "error", // Perfectionist import sorting
3333
"perfectionist/sort-interfaces": ["error"], // Perfectionist interfaces sorting
34-
"perfectionist/sort-objects": ["error", { type: "natural" }], // Perfectionist objects sorting
34+
"perfectionist/sort-objects": [
35+
"error",
36+
{
37+
ignorePattern: ["useQuery*", "queries*", "useMutation*", "mutations*"],
38+
type: "natural",
39+
},
40+
],
3541
"prettier/prettier": [
3642
"warn",
3743
{

hackathon/spacecraft/src/hooks/usePilot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export const usePilot = () => {
1010
);
1111

1212
const query = useQuery({
13-
placeholderData: keepPreviousData,
14-
queryFn: () => fetchData(page),
1513
queryKey: ["pilots", page],
14+
queryFn: () => fetchData(page),
15+
placeholderData: keepPreviousData,
1616
});
1717

1818
return { page, query, setPage };

hackathon/spacecraft/src/hooks/usePlanets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const fetchPlanets = async () => {
88

99
export const usePlanets = () => {
1010
return useQuery({
11-
queryFn: fetchPlanets,
1211
queryKey: ["planets"],
12+
queryFn: fetchPlanets,
1313
});
1414
};

hackathon/spacecraft/src/hooks/useStarships.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export const useStarships = (starships: string[]) => {
1616
const userQueries = useQueries({
1717
queries: starships.map((starship, index) => {
1818
return {
19-
queryFn: () => fetchStarshipById(starship),
2019
queryKey: ["starship", `starship-${index}`],
20+
queryFn: () => fetchStarshipById(starship),
2121
};
2222
}),
2323
});

0 commit comments

Comments
 (0)