-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy patheslint-remote-tester.config.ts
135 lines (129 loc) · 4.06 KB
/
eslint-remote-tester.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* eslint-disable import/no-default-export */
import { Config } from 'eslint-remote-tester';
const JSExtensions = ['.js', '.jsx', '.cjs', '.mjs', '.cjsx', '.mjsx'] as const;
const TSExtensions = ['.ts', '.tsx', '.cts', '.mts', '.ctsx', '.mtsx'] as const;
enum Repo {
// Ecosystem
Hive = 'kamilkisiela/graphql-hive',
Yoga = 'dotansimha/graphql-yoga',
Envelop = 'n1ru4l/envelop',
Inspector = 'kamilkisiela/graphql-inspector',
CodeGenerator = 'dotansimha/graphql-code-generator',
Mesh = 'urigo/graphql-mesh',
Tools = 'ardatan/graphql-tools',
Modules = 'urigo/graphql-modules',
ESLint = 'b2o5t/graphql-eslint',
Config = 'kamilkisiela/graphql-config',
Scalars = 'urigo/graphql-scalars',
Shield = 'dimatill/graphql-shield',
Swift = 'maticzav/swift-graphql',
CLI = 'urigo/graphql-cli',
SOFA = 'urigo/sofa',
Stencil = 'ardatan/stencil-apollo',
Angular = 'kamilkisiela/apollo-angular',
WhatsApp = 'urigo/whatsapp-clone-tutorial',
// Another Guild's repos
Components = 'the-guild-org/the-guild-components',
Website = 'the-guild-org/the-guild-website',
SharedConfigs = 'the-guild-org/shared-config',
TimeAgo = 'n1ru4l/react-time-ago',
Bob = 'kamilkisiela/bob',
DataLoader = 'graphql/dataloader',
LiveQuery = 'n1ru4l/graphql-live-query',
GraphiQL = 'graphql/graphiql',
GraphQLOrg = 'graphql/graphql.github.io',
GraphQLHTTP = 'graphql/graphql-http',
GraphQLWS = 'enisdenjo/graphql-ws',
GraphQLSSE = 'enisdenjo/graphql-sse',
// Other
Nextra = 'shuding/nextra',
Satori = 'vercel/satori',
NextJS = 'vercel/next.js',
}
const overrideConfig: Config['eslintrc'] = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
env: {
node: true,
browser: true,
},
overrides: [
{
files: '**/tests/**',
env: {
jest: true,
},
},
],
plugins: [
'sonarjs',
'unicorn',
'import',
'react',
'@typescript-eslint',
'@shopify',
'n',
'promise',
],
rules: {
'no-restricted-syntax': [
'error',
{
// ❌ process.browser
selector:
'ExpressionStatement[expression.object.name=process][expression.property.name=browser]',
message: '`process.browser` is deprecated, use `!!globalThis.window`',
},
{
// ❌ let { foo: {bar} } = baz
selector:
'VariableDeclarator[init.type!=AwaitExpression] > ObjectPattern[properties.length=1][properties.0.value.type=ObjectPattern]',
message: 'Do not use nested destructuring.',
},
{
// ❌ useMemo(…, [])
selector:
'CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]',
message:
"`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead.",
},
],
},
};
const config: Config = {
cache: true,
extensions: [...JSExtensions, ...TSExtensions],
repositories: Object.values(Repo),
eslintrc: overrideConfig,
pathIgnorePattern: `(${[
'dev-test/githunt/flow.flow.js', // codegen
'dev-test/test-schema/flow-types.flow.js', // codegen
'packages/load/tests/loaders/schema/test-files/error.ts', // tools
'action/index.js', // inspector
'.yarn/releases/yarn-berry.cjs', // shield
// swift
'.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs',
'.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs',
'.yarn/plugins/@yarnpkg/plugin-typescript.cjs',
// next.js
'packages/next/src/compiled/babel/bundle.js',
'packages/next/src/compiled/mini-css-extract-plugin/loader.js',
'packages/next/src/compiled/undici/index.js',
'packages/next/src/compiled/ws/index.js',
'test/development/basic/hmr/components/parse-error.js',
// dataloader
'flow-typed/npm/jest_v24.x.x.js',
'src/__tests__/abuse.test.js',
'src/__tests__/browser.test.js',
'src/__tests__/dataloader.test.js',
'src/__tests__/oldbrowser.test.js',
'src/__tests__/unhandled.test.js',
].join('|')})`,
rulesUnderTesting: () => true,
};
export default config;