Skip to content

Commit 7789983

Browse files
authored
chore(style-guide): add @automatta/style-guide (#9)
1 parent 9861e0f commit 7789983

15 files changed

+3843
-508
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

eslint.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import base from '@automatta/style-guide/eslint/base';
2+
3+
export default [
4+
...base,
5+
{
6+
ignores: ['**/dist/**'],
7+
},
8+
{
9+
languageOptions: {
10+
parserOptions: {
11+
tsconfigRootDir: import.meta.dirname,
12+
project: './tsconfig.eslint.json',
13+
},
14+
},
15+
},
16+
];

package.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "relay-result",
33
"description": "Relay Result",
44
"author": "Automatta.io <[email protected]>",
5+
"type": "module",
56
"private": true,
67
"packageManager": "[email protected]",
78
"repository": {
@@ -14,15 +15,24 @@
1415
"homepage": "https://github.com/automatta-io/relay-result#readme",
1516
"license": "MIT",
1617
"scripts": {
18+
"format": "prettier --write .",
19+
"lint": "turbo lint",
1720
"build": "turbo build",
1821
"publish-packages": "pnpm build && changeset version && changeset publish",
1922
"type-check": "turbo type-check"
2023
},
24+
"prettier": "@automatta/style-guide/prettier",
2125
"devDependencies": {
26+
"@automatta/style-guide": "^0.0.2",
2227
"@changesets/cli": "^2.27.7",
2328
"@types/node": "^20.11.24",
29+
"eslint": "^9.19.0",
30+
"eslint-plugin-import": "^2.31.0",
31+
"eslint-plugin-unused-imports": "^4.1.4",
32+
"prettier": "^3.4.2",
2433
"tsup": "^8.2.4",
2534
"turbo": "^2.0.1",
26-
"typescript": "^5.3.3"
35+
"typescript": "^5.3.3",
36+
"typescript-eslint": "^8.22.0"
2737
}
2838
}

packages/graphql-relay-result/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"homepage": "https://github.com/automatta-io/relay-result#readme",
2626
"scripts": {
2727
"build": "tsup",
28+
"lint": "eslint .",
2829
"type-check": "bun --bun tsc"
2930
},
3031
"devDependencies": {

packages/graphql-relay-result/pnpm-lock.yaml

+10-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
{
2+
"extends": "../../tsconfig.base.json",
23
"compilerOptions": {
3-
"target": "ESNext",
4-
"module": "ESNext",
5-
"moduleResolution": "Node",
6-
"lib": ["ESNext"],
7-
"noEmit": true,
8-
"strict": true,
9-
"noImplicitThis": true,
10-
"noUnusedLocals": true,
11-
"noUnusedParameters": true,
12-
"noImplicitReturns": true,
13-
"noFallthroughCasesInSwitch": true,
14-
"noUncheckedIndexedAccess": true,
15-
"resolveJsonModule": true,
16-
"esModuleInterop": true,
17-
"skipLibCheck": true,
18-
"verbatimModuleSyntax": true
4+
"incremental": false
195
}
206
}

packages/react-relay-result/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"homepage": "https://github.com/automatta-io/relay-result#readme",
2727
"scripts": {
2828
"build": "tsup",
29+
"lint": "eslint .",
2930
"type-check": "bun --bun tsc"
3031
},
3132
"devDependencies": {

packages/react-relay-result/pnpm-lock.yaml

+92-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-relay-result/src/index.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ type UseMutationResultArgs<
4646
> = {
4747
mutation: GraphQLTaggedNode;
4848
name: keyof TMutation['response'];
49-
disableToast?: boolean;
5049
} & UseMutationExecuteArgs<TMutation, N>;
5150

5251
export const useMutationResult = <
@@ -55,7 +54,6 @@ export const useMutationResult = <
5554
>({
5655
name,
5756
mutation,
58-
disableToast = false,
5957
...args
6058
}: UseMutationResultArgs<TMutation, N>) => {
6159
const [execute, isPending] = useMutation<TMutation>(mutation);
@@ -69,7 +67,7 @@ export const useMutationResult = <
6967
onCompleted: (response: TMutation['response']) => {
7068
const result = response[name];
7169

72-
if (!result.hasOwnProperty('__typename')) {
70+
if (!Object.hasOwn(result, '__typename')) {
7371
return;
7472
}
7573

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
{
2+
"extends": "../../tsconfig.base.json",
23
"compilerOptions": {
3-
"target": "ESNext",
4-
"module": "ESNext",
5-
"moduleResolution": "Node",
64
"lib": ["ESNext", "DOM"],
7-
"noEmit": true,
8-
"strict": true,
9-
"noImplicitThis": true,
10-
"noUnusedLocals": true,
11-
"noUnusedParameters": true,
12-
"noImplicitReturns": true,
13-
"noFallthroughCasesInSwitch": true,
14-
"noUncheckedIndexedAccess": true,
15-
"resolveJsonModule": true,
16-
"esModuleInterop": true,
17-
"skipLibCheck": true,
18-
"verbatimModuleSyntax": true
5+
"jsx": "react-jsx",
6+
"incremental": false
197
}
208
}

0 commit comments

Comments
 (0)