Skip to content

Commit 5ea74e3

Browse files
authored
setup guild eslint config (#8797)
* setup guild eslint config * remove unused eslint directives * sort imports * sort imports * sort imports
1 parent fe12b48 commit 5ea74e3

103 files changed

Lines changed: 1167 additions & 686 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.cjs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['@theguild'],
4+
rules: {
5+
'no-empty': 'off',
6+
'no-console': 'error',
7+
'no-prototype-builtins': 'off',
8+
'no-useless-constructor': 'off',
9+
'no-unused-vars': 'off',
10+
'object-shorthand': ['error', 'always'],
11+
'@typescript-eslint/explicit-module-boundary-types': 'off',
12+
'@typescript-eslint/no-unused-vars': 'off',
13+
'@typescript-eslint/no-use-before-define': 'off',
14+
'@typescript-eslint/no-namespace': 'off',
15+
'no-unreachable-loop': 'error',
16+
'@typescript-eslint/no-empty-interface': 'off',
17+
'prefer-arrow-callback': 'error',
18+
'@typescript-eslint/no-empty-function': 'off',
19+
'@typescript-eslint/no-var-requires': 'off',
20+
'@typescript-eslint/no-explicit-any': 'off',
21+
'@typescript-eslint/no-non-null-assertion': 'off',
22+
'@typescript-eslint/explicit-function-return-type': 'off',
23+
'@typescript-eslint/ban-ts-ignore': 'off',
24+
'@typescript-eslint/ban-types': 'off',
25+
'no-lonely-if': 'error',
26+
'import/no-extraneous-dependencies': [
27+
'error',
28+
{ devDependencies: ['**/*.test.ts', '**/*.spec.ts', '**/test/**/*.ts'] },
29+
],
30+
31+
// todo: enable
32+
'unicorn/prefer-node-protocol': 'off',
33+
'no-restricted-syntax': 'off',
34+
'unicorn/filename-case': 'off',
35+
'import/extensions': 'off',
36+
'no-implicit-coercion': 'off',
37+
'unicorn/numeric-separators-style': 'off',
38+
'import/no-default-export': 'off',
39+
'unicorn/no-lonely-if': 'off',
40+
'unicorn/no-useless-spread': 'off',
41+
'simple-import-sort/exports': 'off',
42+
'unicorn/no-array-push-push': 'off',
43+
'no-else-return': 'off',
44+
'no-undef': 'off',
45+
'import/first': 'off',
46+
'n/no-restricted-import': 'off',
47+
'import/no-duplicates': 'off',
48+
},
49+
env: {
50+
es6: true,
51+
node: true,
52+
},
53+
overrides: [
54+
{
55+
files: ['**/tests/**/*.ts', '**/graphql-codegen-testing/**/*.ts', '*.spec.ts'],
56+
env: {
57+
jest: true,
58+
},
59+
rules: {
60+
'no-unused-vars': 'off',
61+
'@typescript-eslint/no-unused-vars': 'off',
62+
'import/no-extraneous-dependencies': 'off',
63+
},
64+
},
65+
],
66+
ignorePatterns: ['dist', 'node_modules', 'dev-test', 'website', 'test-files', 'examples/front-end', '.bob'],
67+
};

.eslintrc.json

Lines changed: 0 additions & 53 deletions
This file was deleted.

examples/programmatic-typescript/src/gql.generated.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import type { GraphQLResolveInfo } from 'graphql';
21
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
2+
import type { GraphQLResolveInfo } from 'graphql';
3+
34
export type Maybe<T> = T | null;
45
export type InputMaybe<T> = Maybe<T>;
56
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };

examples/programmatic-typescript/src/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
/* eslint-disable no-console */
2-
32
import { promises } from 'fs';
4-
import { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';
5-
import gql from 'graphql-tag';
6-
import prettier from 'prettier';
7-
83
import { codegen } from '@graphql-codegen/core';
4+
import { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';
95
import * as typedDocumentNode from '@graphql-codegen/typed-document-node';
106
import * as typescript from '@graphql-codegen/typescript';
117
import * as typescriptOperations from '@graphql-codegen/typescript-operations';
128
import * as typescriptResolvers from '@graphql-codegen/typescript-resolvers';
139
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
1410
import { loadDocuments } from '@graphql-tools/load';
1511
import { makeExecutableSchema } from '@graphql-tools/schema';
16-
12+
import gql from 'graphql-tag';
13+
import prettier from 'prettier';
1714
import type { Resolvers } from './gql.generated.js';
1815

1916
const schema = makeExecutableSchema({

examples/typescript-esm/src/executeOperation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import * as https from 'node:https';
12
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
23
import type { ExecutionResult } from 'graphql';
34
import { print } from 'graphql';
4-
import * as https from 'node:https';
55

66
export function executeOperation<TResult, TVariables>(
77
url: string,

examples/typescript-esm/src/gql/gql.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/* eslint-disable */
2-
import * as graphql from './graphql.js';
31
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
2+
import * as graphql from './graphql.js';
43

54
const documents = {
65
'\n query AllPeopleQuery {\n allPeople(first: 5) {\n edges {\n node {\n name\n homeworld {\n name\n }\n }\n }\n }\n }\n':

examples/typescript-esm/src/gql/graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* eslint-disable */
21
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
2+
33
export type Maybe<T> = T | null;
44
export type InputMaybe<T> = Maybe<T>;
55
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };

examples/typescript-resolvers/src/type-defs.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { GraphQLResolveInfo } from 'graphql';
2+
23
export type Maybe<T> = T | null;
34
export type InputMaybe<T> = Maybe<T>;
45
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@graphql-typed-document-node/core": "3.1.1",
4040
"@reduxjs/toolkit": "1.8.5",
4141
"@tanstack/react-query": "4.2.3",
42+
"@theguild/eslint-config": "0.4.2",
4243
"@theguild/prettier-config": "0.1.1",
4344
"@types/common-tags": "1.8.1",
4445
"@types/jest": "28.1.8",

packages/graphql-cli-codegen-plugin/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { defineCommand } from '@graphql-cli/common';
22
import {
3-
CodegenExtension,
3+
buildOptions,
44
CodegenContext,
5+
CodegenExtension,
56
generate,
67
updateContextWithCliFlags,
7-
buildOptions,
88
YamlCliFlags,
99
} from '@graphql-codegen/cli';
1010

0 commit comments

Comments
 (0)