Skip to content

Commit 261039b

Browse files
authored
Merge branch 'main' into hack-support
2 parents 6d9f1e1 + fe6baad commit 261039b

File tree

435 files changed

+40770
-30518
lines changed

Some content is hidden

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

435 files changed

+40770
-30518
lines changed

.changeset/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"access": "public",
77
"baseBranch": "main",
88
"ignore": [
9+
"example-graphiql-vite",
910
"example-graphiql-webpack",
1011
"example-monaco-graphql-nextjs",
1112
"example-monaco-graphql-react-vite",

.eslintrc.js

Lines changed: 90 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ module.exports = {
3131
'**/CHANGELOG.md',
3232
'functions/*',
3333
'packages/vscode-graphql-syntax/tests/__fixtures__/*',
34+
// symlinks
35+
'packages/graphiql-react/__mocks__/monaco-editor.ts',
36+
'packages/graphiql-plugin-doc-explorer/__mocks__/zustand.ts',
37+
'packages/graphiql-plugin-doc-explorer/__mocks__/monaco-editor.ts',
38+
'packages/graphiql-plugin-history/__mocks__/zustand.ts',
39+
'packages/graphiql-plugin-history/__mocks__/monaco-editor.ts',
3440
],
3541
overrides: [
3642
{
@@ -57,11 +63,11 @@ module.exports = {
5763
'plugin:import-x/recommended',
5864
'plugin:import-x/typescript',
5965
'plugin:react/recommended',
60-
'plugin:react-hooks/recommended',
66+
'plugin:react-hooks/recommended-legacy',
6167
'plugin:react/jsx-runtime',
6268
'prettier',
6369
],
64-
plugins: ['promise', 'sonarjs', 'unicorn', 'sonar', '@shopify'],
70+
plugins: ['promise', 'sonarjs', 'unicorn', '@shopify'],
6571
globals: {
6672
atom: false,
6773
document: false,
@@ -129,6 +135,25 @@ module.exports = {
129135
property: 'localStorage',
130136
message: 'Use `localStorage` instead',
131137
},
138+
{
139+
object: 'window',
140+
property: 'location',
141+
message: 'Use `location` instead',
142+
},
143+
{
144+
object: 'window',
145+
property: 'navigator',
146+
message: 'Use `navigator` instead',
147+
},
148+
{
149+
object: 'window',
150+
property: 'getComputedStyle',
151+
message: 'Use `getComputedStyle` instead',
152+
},
153+
{
154+
object: 'self',
155+
message: 'Use `globalThis` instead',
156+
},
132157
],
133158
'no-return-assign': 'error',
134159
'no-return-await': 'error',
@@ -158,7 +183,7 @@ module.exports = {
158183
'init-declarations': 'off',
159184
'no-catch-shadow': 'error',
160185
'no-label-var': 'error',
161-
'no-restricted-globals': 'off',
186+
'no-restricted-globals': ['error', 'stop'],
162187
'no-shadow': 'off',
163188
'@typescript-eslint/no-shadow': 'error',
164189
'no-undef-init': 'off',
@@ -167,9 +192,8 @@ module.exports = {
167192
'@typescript-eslint/no-unused-vars': [
168193
'error',
169194
{
170-
varsIgnorePattern: '^React$',
195+
varsIgnorePattern: '^(React|_)', // allow underscores in destructuring
171196
argsIgnorePattern: '^_',
172-
ignoreRestSiblings: true,
173197
},
174198
],
175199

@@ -328,8 +352,9 @@ module.exports = {
328352
'@typescript-eslint/no-unused-expressions': 'error',
329353
'sonarjs/no-small-switch': 'error',
330354
'sonarjs/no-duplicated-branches': 'error',
331-
'sonar/prefer-promise-shorthand': 'error',
332-
'sonar/no-dead-store': 'error',
355+
'sonarjs/prefer-promise-shorthand': 'error',
356+
'sonarjs/no-dead-store': 'error',
357+
'sonarjs/void-use': 'error',
333358
'unicorn/prefer-node-protocol': 'error',
334359
'import-x/no-unresolved': [
335360
'error',
@@ -348,6 +373,8 @@ module.exports = {
348373
],
349374
'unicorn/no-length-as-slice-end': 'error',
350375
'unicorn/prefer-string-replace-all': 'error',
376+
'unicorn/prefer-array-some': 'error',
377+
// '@typescript-eslint/prefer-for-of': 'error', TODO
351378
'unicorn/no-hex-escape': 'off', // TODO: enable
352379
// doesn't catch a lot of cases; we use ESLint builtin `no-restricted-syntax` to forbid `.keyCode`
353380
'unicorn/prefer-keyboard-event-key': 'off',
@@ -356,7 +383,15 @@ module.exports = {
356383
'unicorn/prefer-dom-node-text-content': 'error',
357384
quotes: ['error', 'single', { avoidEscape: true }], // Matches Prettier, but also replaces backticks with single quotes
358385
// TODO: Fix all errors for the following rules included in recommended config
359-
'@typescript-eslint/no-var-requires': 'off',
386+
'@typescript-eslint/no-require-imports': 'off',
387+
'import-x/no-named-as-default-member': 'off',
388+
},
389+
},
390+
{
391+
files: ['packages/{monaco-graphql,graphiql*}/**/*.{ts,tsx,mts,cts}'],
392+
excludedFiles: ['packages/graphiql-toolkit/**/*.{ts,tsx}'],
393+
rules: {
394+
'@typescript-eslint/no-unnecessary-condition': 'error',
360395
},
361396
},
362397
{
@@ -365,13 +400,19 @@ module.exports = {
365400
excludedFiles: ['**/*.{md,mdx}/*.{ts,tsx}'],
366401
// extends: ['plugin:@typescript-eslint/recommended-type-checked'],
367402
rules: {
403+
// '@typescript-eslint/no-redundant-type-constituents': 'error',
368404
'@typescript-eslint/prefer-optional-chain': 'error',
369405
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
370406
'@typescript-eslint/no-floating-promises': 'error',
371407
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
372408
'@typescript-eslint/consistent-type-assertions': 'error',
373409
'@typescript-eslint/no-duplicate-type-constituents': 'error',
410+
'@typescript-eslint/no-unnecessary-type-conversion': 'error',
411+
// '@typescript-eslint/await-thenable': 'error', // TODO
374412
// TODO: Fix all errors for the following rules included in recommended config
413+
'@typescript-eslint/no-deprecated': 'off',
414+
'@typescript-eslint/no-unsafe-function-type': 'off',
415+
375416
'@typescript-eslint/no-explicit-any': 'off',
376417
'@typescript-eslint/no-non-null-assertion': 'off',
377418
'@typescript-eslint/ban-ts-comment': 'off',
@@ -381,12 +422,35 @@ module.exports = {
381422
'@typescript-eslint/no-namespace': 'off',
382423
},
383424
parserOptions: {
384-
project: [
385-
'packages/*/tsconfig.json',
386-
'examples/*/tsconfig.json',
387-
'packages/graphiql/cypress/tsconfig.json',
388-
'tsconfig.eslint.json',
389-
],
425+
projectService: {
426+
allowDefaultProject: [
427+
'examples/monaco-graphql-react-vite/vite.config.ts',
428+
'packages/{codemirror-graphql,graphiql-toolkit,graphql-language-service-cli,graphql-language-service,monaco-graphql,vscode-graphql-syntax}/vitest.config.mts',
429+
430+
'packages/cm6-graphql/__tests__/test.spec.ts',
431+
'packages/graphiql/cypress.config.ts',
432+
'packages/vscode-graphql-syntax/tests/*.spec.ts',
433+
'packages/graphql-language-service-cli/src/__tests__/*.test.ts',
434+
'packages/monaco-graphql/test/monaco-editor.test.ts',
435+
436+
'packages/codemirror-graphql/setup-files.ts',
437+
'packages/codemirror-graphql/src/__tests__/testSchema.ts',
438+
'packages/codemirror-graphql/src/__tests__/*.test.ts',
439+
'packages/codemirror-graphql/src/{variables,utils,results}/__tests__/*.test.ts',
440+
441+
'packages/graphql-language-service/benchmark/index.ts',
442+
'packages/graphql-language-service/src/{utils,parser,interface}/__tests__/*.test.ts',
443+
'packages/graphql-language-service/src/parser/__tests__/OnlineParserUtils.ts',
444+
445+
'packages/graphql-language-service-server/src/__tests__/*.{spec,test}.ts',
446+
'packages/graphql-language-service-server/src/__tests__/__utils__/utils.ts',
447+
'packages/graphql-language-service-server/src/__tests__/__utils__/MockProject.ts',
448+
449+
'packages/vscode-graphql-syntax/tests/__utilities__/serializer.ts',
450+
'packages/vscode-graphql-syntax/tests/__utilities__/utilities.ts',
451+
],
452+
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 100,
453+
},
390454
},
391455
},
392456
// Cypress plugin, global, etc., only for cypress directory
@@ -454,16 +518,15 @@ module.exports = {
454518
},
455519
},
456520
{
457-
// Rule prefer await to then without React packages because it's ugly to have `async IIFE` inside `useEffect`
521+
// Rule to prefer await to then without React packages because it's ugly to have `async IIFE` inside `useEffect`
458522
files: ['packages/**'],
459523
excludedFiles: ['packages/graphiql/**', 'packages/graphiql-react/**'],
460524
rules: {
461525
'promise/prefer-await-to-then': 'error',
462526
},
463527
},
464528
{
465-
files: ['packages/graphiql-react/**'],
466-
plugins: ['react-compiler'],
529+
files: ['packages/{graphiql-react,graphiql}/**/*.{ts,tsx}'],
467530
rules: {
468531
'@typescript-eslint/no-restricted-imports': [
469532
'error',
@@ -473,7 +536,8 @@ module.exports = {
473536
importNames: ['memo', 'useCallback', 'useMemo'],
474537
},
475538
],
476-
'react-compiler/react-compiler': 'error',
539+
'react-hooks/react-compiler': 'error',
540+
'@typescript-eslint/no-deprecated': 'error',
477541
},
478542
},
479543
{
@@ -501,6 +565,12 @@ module.exports = {
501565
'mdx/code-blocks': true,
502566
},
503567
},
568+
{
569+
files: ['**/*.d.ts'],
570+
rules: {
571+
'no-var': 'off',
572+
},
573+
},
504574
{
505575
// ❗ALWAYS LAST
506576
// Rules for codeblocks inside Markdown/MDX
@@ -513,8 +583,9 @@ module.exports = {
513583
'no-undef': 'off',
514584
'react/jsx-no-undef': 'off',
515585
'react-hooks/rules-of-hooks': 'off',
516-
'sonar/no-dead-store': 'off',
586+
'sonarjs/no-dead-store': 'off',
517587
'@typescript-eslint/no-restricted-imports': 'off',
588+
'@typescript-eslint/no-unnecessary-condition': 'off',
518589
},
519590
},
520591
],

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
*.css text eol=lf
1212
*.sh text eol=lf
1313
*.yml text eol=lf
14+
15+
.yarn/releases/*.cjs export-ignore binary linguist-generated

.github/workflows/pr-graphql-compat-check.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
# only on merge to main.
55
# it's rare that this workflow would
66
# show us an error, but when it does it's important!
7-
branches:
8-
- main
7+
branches: [main]
98
# don't run this regression suite if we don't need to
109
paths-ignore:
1110
- '**.md'

.github/workflows/pr.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ jobs:
3636
name: Build
3737
runs-on: ubuntu-latest
3838
needs: [install]
39-
4039
steps:
4140
- uses: actions/checkout@v4
4241
- uses: actions/setup-node@v4
43-
4442
- id: cache-modules
4543
uses: actions/cache@v4
4644
with:
@@ -109,18 +107,15 @@ jobs:
109107
name: Vitest Unit Tests
110108
runs-on: ubuntu-latest
111109
needs: [build]
112-
113110
steps:
114111
- uses: actions/checkout@v4
115112
- uses: actions/setup-node@v4
116-
117113
- id: cache-modules
118114
uses: actions/cache@v4
119115
with:
120116
path: |
121117
**/node_modules
122118
key: modules-${{ github.sha }}
123-
124119
- uses: actions/cache@v4
125120
with:
126121
key: build-${{ github.sha }}
@@ -131,11 +126,9 @@ jobs:
131126
name: ESLint
132127
runs-on: ubuntu-latest
133128
needs: [build]
134-
135129
steps:
136130
- uses: actions/checkout@v4
137131
- uses: actions/setup-node@v4
138-
139132
- id: cache-modules
140133
uses: actions/cache@v4
141134
with:
@@ -148,11 +141,29 @@ jobs:
148141
path: ${{ env.BUILD-CACHE-LIST }}
149142
- run: yarn eslint
150143

144+
types-check:
145+
name: Types Check
146+
runs-on: ubuntu-latest
147+
needs: [build]
148+
steps:
149+
- uses: actions/checkout@v4
150+
- uses: actions/setup-node@v4
151+
- id: cache-modules
152+
uses: actions/cache@v4
153+
with:
154+
path: |
155+
**/node_modules
156+
key: modules-${{ github.sha }}
157+
- uses: actions/cache@v4
158+
with:
159+
key: build-${{ github.sha }}
160+
path: ${{ env.BUILD-CACHE-LIST }}
161+
- run: yarn types:check
162+
151163
e2e:
152164
name: Cypress
153165
runs-on: ubuntu-latest
154166
needs: [build]
155-
156167
steps:
157168
- uses: actions/checkout@v4
158169
- id: cache-modules

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
push:
5-
branches: [main, graphiql-v4]
5+
branches: [main, graphiql-5]
66
permissions: {}
77
jobs:
88
release:

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
.secrets
66
*.log
77

8+
.yarn/*
9+
!.yarn/releases/*
10+
!.yarn/plugins/*
11+
812
node_modules/
913
coverage/
1014
.nyc_output
@@ -28,6 +32,7 @@ package-lock.json
2832

2933
vite.config.d.ts
3034
vite.config.js
35+
tsconfig.vitest-temp.json
3136

3237
.next/
3338
.turbo/
@@ -41,12 +46,8 @@ packages/codemirror-graphql/*.d.ts
4146
packages/codemirror-graphql/*.map
4247
!packages/codemirror-graphql/*.config.js
4348

44-
packages/graphiql/index.html
45-
packages/graphiql/dev.html
46-
packages/graphiql/analyzer.html
47-
packages/graphiql/graphiql*.js
48-
packages/graphiql/*.css
49-
packages/graphiql/*.map
5049
packages/graphiql/cypress/screenshots/
50+
packages/graphiql/cypress/downloads/
51+
packages/graphiql/cypress/videos/
5152
packages/graphiql/typedoc/
5253
packages/graphiql/webpack/

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
"coverage.xml",
1212
"jacoco.xml",
1313
"coverage.cobertura.xml"
14-
]
14+
],
15+
"typescript.tsdk": "node_modules/typescript/lib"
1516
}

0 commit comments

Comments
 (0)