Skip to content

Commit 1c2d220

Browse files
graphql-eslint v4 (graphql-hive#1813)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 2bf2868 commit 1c2d220

File tree

294 files changed

+4162
-5311
lines changed

Some content is hidden

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

294 files changed

+4162
-5311
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': patch
3+
---
4+
5+
dependencies updates:
6+
7+
- Removed dependency
8+
[`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6) (from
9+
`dependencies`)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@graphql-eslint/eslint-plugin": patch
3+
---
4+
dependencies updates:
5+
- Updated dependency [`graphql-config@^4.5.0` ↗︎](https://www.npmjs.com/package/graphql-config/v/4.5.0) (from `^4.4.0`, in `dependencies`)
6+
- Removed dependency [`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6) (from `dependencies`)
7+
- Removed dependency [`chalk@^4.1.2` ↗︎](https://www.npmjs.com/package/chalk/v/4.1.2) (from `dependencies`)
8+
- Removed dependency [`tslib@^2.4.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.4.1) (from `dependencies`)
9+
- Updated dependency [`graphql@^16` ↗︎](https://www.npmjs.com/package/graphql/v/16.0.0) (from `^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0`, in `peerDependencies`)
10+
- Added dependency [`eslint@>=8.44.0` ↗︎](https://www.npmjs.com/package/eslint/v/8.44.0) (to `peerDependencies`)

.changeset/dull-scissors-destroy.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': major
3+
---
4+
5+
- bring back `possible-type-extension` rule to `schema-recommended` config
6+
7+
- add `unique-operation-name` and `unique-fragment-name` rules to `operations-recommended` config
8+
9+
The concept of sibling operations provided by graphql-config's `documents` fields is based on
10+
uniquely named operations and fragments, for omitting false-positive/negative cases when operations
11+
and fragments are located in separate files. For this reason, these rules must be included in the
12+
recommended config
13+
14+
- rename `relay` config to `schema-relay`
15+
16+
> To avoid confusing when users extend this config for executable definitions (operations and
17+
> fragments)

.changeset/few-mails-sparkle.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': major
3+
---
4+
5+
- `alphabetize` rule changes
6+
7+
- add `definitions: true` option for `schema-all`/`operations-all` configs
8+
- rename `values: ['EnumTypeDefinition']` to `values: true`
9+
- rename `variables: ['OperationDefinition']` to `variables: true`
10+
- add `groups: ['id', '*', 'createdAt', 'updatedAt']` for `schema-all`/`operations-all` configs
11+
12+
- `require-id-when-available` rule changes
13+
14+
- rename rule to `require-selections`
15+
16+
- update `schema-all`/`operations-all` configs
17+
18+
- `require-description` rule changes
19+
20+
- add `rootField: true` option for `schema-recommended` config
21+
22+
- require `eslint` at least `>=8.44.0` as peerDependency
23+
24+
- `naming-convention`
25+
26+
- add new options for `schema-recommended` config
27+
28+
```json5
29+
{
30+
'EnumTypeDefinition,EnumTypeExtension': {
31+
forbiddenPrefixes: ['Enum'],
32+
forbiddenSuffixes: ['Enum']
33+
},
34+
'InterfaceTypeDefinition,InterfaceTypeExtension': {
35+
forbiddenPrefixes: ['Interface'],
36+
forbiddenSuffixes: ['Interface']
37+
},
38+
'UnionTypeDefinition,UnionTypeExtension': {
39+
forbiddenPrefixes: ['Union'],
40+
forbiddenSuffixes: ['Union']
41+
},
42+
'ObjectTypeDefinition,ObjectTypeExtension': {
43+
forbiddenPrefixes: ['Type'],
44+
forbiddenSuffixes: ['Type']
45+
}
46+
}
47+
```
48+
49+
- remove graphql-js' `unique-enum-value-names` rule
50+
51+
- rename `no-case-insensitive-enum-values-duplicates` to `unique-enum-value-names`
52+
53+
> Since this rule reports case-insensitive enum values duplicates too
54+
55+
- `require-nullable-result-in-root` rule changes
56+
57+
Do not check subscriptions

.changeset/itchy-ads-compete.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': major
3+
---
4+
5+
- remove `parserOptions.schema`
6+
- remove `parserOptions.documents`
7+
- remove `parserOptions.extensions`
8+
- remove `parserOptions.include`
9+
- remove `parserOptions.exclude`
10+
- remove `parserOptions.projects`
11+
- remove `parserOptions.schemaOptions`
12+
- remove `parserOptions.graphQLParserOptions`
13+
- remove `parserOptions.skipGraphQLConfig`
14+
- remove `parserOptions.operations`
15+
16+
- add `parserOptions.graphQLConfig?: IGraphQLConfig` for programmatic usage

.changeset/pre.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"mode": "pre",
3+
"tag": "alpha",
4+
"initialVersions": {
5+
"@graphql-eslint/example-code-file": "0.0.0",
6+
"@graphql-eslint/example-graphql-config": "0.0.0",
7+
"@graphql-eslint/example-monorepo": "0.0.0",
8+
"@graphql-eslint/example-multiple-projects-graphql-config": "0.0.0",
9+
"@graphql-eslint/example-prettier": "0.0.0",
10+
"@graphql-eslint/example-programmatic": "0.0.0",
11+
"@graphql-eslint/example-svelte-code-file": "0.0.0",
12+
"@graphql-eslint/example-vue-code-file": "0.0.0",
13+
"@graphql-eslint/eslint-plugin": "3.20.1",
14+
"@theguild/eslint-rule-tester": "0.0.0",
15+
"website": "0.0.0"
16+
},
17+
"changesets": [
18+
"@graphql-eslint_eslint-plugin-1792-dependencies",
19+
"dull-scissors-destroy",
20+
"few-mails-sparkle",
21+
"itchy-ads-compete",
22+
"rare-planes-love",
23+
"strong-needles-compare"
24+
]
25+
}

.changeset/rare-planes-love.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': major
3+
---
4+
5+
drop support of Node.js 12/14/16, GraphQL 14/15

.changeset/strong-needles-compare.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': major
3+
---
4+
5+
Remove `GraphQLRuleTester` from bundle, to test your rules use regular `RuleTester` from eslint
6+
7+
> **Note**: with this change unnecessary dependency `@babel/code-frame` was removed too
8+
9+
```js
10+
import { RuleTester } from 'eslint'
11+
12+
const ruleTester = new RuleTester({
13+
parser: require.resolve('@graphql-eslint/eslint-plugin')
14+
})
15+
```

.eslintrc.cjs

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
ignorePatterns: ['examples', 'packages/plugin/tests/__snapshots__'],
2+
ignorePatterns: ['examples', 'packages/plugin/__tests__/__snapshots__'],
33
extends: [
44
'@theguild',
55
'@theguild/eslint-config/json',
@@ -55,7 +55,7 @@ module.exports = {
5555
},
5656
},
5757
{
58-
files: ['**/tests/mocks/**/*.{ts,js}'],
58+
files: ['**/__tests__/mocks/**/*.{ts,js}'],
5959
rules: {
6060
'@typescript-eslint/no-unused-vars': 'off',
6161
},
@@ -69,13 +69,6 @@ module.exports = {
6969
node: true,
7070
},
7171
},
72-
{
73-
files: ['packages/plugin/src/**'],
74-
rules: {
75-
// remove in v4 major
76-
'unicorn/prefer-node-protocol': 'off',
77-
},
78-
},
7972
{
8073
files: ['packages/plugin/src/rules/index.ts'],
8174
rules: {

.github/workflows/pr.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
name: pr
1+
name: PR
22
on:
33
pull_request:
4-
branches:
5-
- master
4+
branches: [master]
65

76
jobs:
87
dependencies:

.github/workflows/release.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
name: release
1+
name: Release
22
on:
33
push:
4-
branches:
5-
- master
4+
branches: [master]
65

76
jobs:
87
stable:

.github/workflows/tests.yml .github/workflows/test.yml

+6-33
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test
1+
name: Test
22

33
on:
44
push:
@@ -35,30 +35,18 @@ jobs:
3535
nodeVersion: 18
3636
packageManager: pnpm
3737

38-
- name: Use GraphQL v${{matrix.graphql_version}}
39-
run: node scripts/match-graphql.js ${{matrix.graphql_version}}
40-
41-
- name: Install Dependencies
42-
run: pnpm i --no-frozen-lockfile
43-
4438
- name: Build
4539
run: pnpm build
4640

47-
- name: Upload Build Artifact
48-
uses: actions/upload-artifact@v3
49-
with:
50-
name: build-artifact
51-
path: packages/plugin/dist
52-
5341
test:
5442
name: Node.js v${{matrix.node_version}} / GraphQL v${{matrix.graphql_version}} / ESLint v8
5543
timeout-minutes: 60
5644
runs-on: ubuntu-latest
5745
needs: [typecheck]
5846
strategy:
5947
matrix:
60-
node_version: [16, 18, 20]
61-
graphql_version: [15, 16]
48+
node_version: [18, 20]
49+
graphql_version: [16]
6250

6351
steps:
6452
- name: Checkout Master
@@ -72,26 +60,11 @@ jobs:
7260
nodeVersion: ${{matrix.node_version}}
7361
packageManager: pnpm
7462

75-
- name: Use GraphQL v${{matrix.graphql_version}}
76-
run: node scripts/match-graphql.js ${{matrix.graphql_version}}
77-
78-
- name: Install Dependencies
79-
run: pnpm i --no-frozen-lockfile
80-
81-
# We need build for examples.spec.ts test
82-
# Otherwise we'll get error - Cannot find module 'node_modules/@graphql-eslint/eslint-plugin/dist/index.js'
83-
- name: Download Build Artifact
84-
uses: actions/download-artifact@v3
85-
with:
86-
name: build-artifact
87-
path: packages/plugin/dist
88-
8963
- name: Test
9064
run: pnpm test
91-
env:
92-
CI: true
93-
# - name: Lint ESLint
94-
# run: pnpm lint
65+
66+
- name: Type Check
67+
run: pnpm typecheck
9568
#
9669
# - name: Lint Prettier
9770
# run: pnpm lint:prettier

.github/workflows/website-integrity.yml .github/workflows/website-integrity.yml.backup

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Fetch
1414
run: git fetch origin master
1515

16-
- name: Setup env
16+
- name: Setup ENV
1717
uses: the-guild-org/shared-config/setup@main
1818
with:
1919
nodeVersion: 18
@@ -28,15 +28,15 @@ jobs:
2828
- name: Compare
2929
run: git diff origin/${{ github.base_ref }}.. -- website/route-lockfile.txt
3030

31-
- name: Diff to file
31+
- name: Diff to File
3232
if: always()
3333
id: diff_result
3434
run: |
3535
echo "result<<EOF" >> $GITHUB_OUTPUT
3636
echo "$(git diff origin/${{ github.base_ref }}.. -- website/route-lockfile.txt)" >> $GITHUB_OUTPUT
3737
echo EOF >> $GITHUB_OUTPUT
3838

39-
- name: Publish a message
39+
- name: Publish a Message
4040
if: always() && contains(steps.diff_result.outputs.result, 'diff')
4141
uses: marocchino/sticky-pull-request-comment@v2
4242
with:

.github/workflows/website.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
name: website
1+
name: Website
22

33
on:
44
push:
5-
branches:
6-
- master
5+
branches: [master]
76
pull_request:
8-
branches:
9-
- master
7+
branches: [master]
108

119
jobs:
1210
deployment:

0 commit comments

Comments
 (0)