Skip to content

Commit

Permalink
graphql-eslint v4 (#1813)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
dimaMachina and github-actions[bot] authored Aug 29, 2023
1 parent 2bf2868 commit 1c2d220
Show file tree
Hide file tree
Showing 294 changed files with 4,162 additions and 5,311 deletions.
9 changes: 9 additions & 0 deletions .changeset/@graphql-eslint_eslint-plugin-1792-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@graphql-eslint/eslint-plugin': patch
---

dependencies updates:

- Removed dependency
[`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6) (from
`dependencies`)
10 changes: 10 additions & 0 deletions .changeset/@graphql-eslint_eslint-plugin-1813-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@graphql-eslint/eslint-plugin": patch
---
dependencies updates:
- Updated dependency [`graphql-config@^4.5.0` ↗︎](https://www.npmjs.com/package/graphql-config/v/4.5.0) (from `^4.4.0`, in `dependencies`)
- Removed dependency [`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6) (from `dependencies`)
- Removed dependency [`chalk@^4.1.2` ↗︎](https://www.npmjs.com/package/chalk/v/4.1.2) (from `dependencies`)
- Removed dependency [`tslib@^2.4.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.4.1) (from `dependencies`)
- 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`)
- Added dependency [`eslint@>=8.44.0` ↗︎](https://www.npmjs.com/package/eslint/v/8.44.0) (to `peerDependencies`)
17 changes: 17 additions & 0 deletions .changeset/dull-scissors-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@graphql-eslint/eslint-plugin': major
---

- bring back `possible-type-extension` rule to `schema-recommended` config

- add `unique-operation-name` and `unique-fragment-name` rules to `operations-recommended` config

The concept of sibling operations provided by graphql-config's `documents` fields is based on
uniquely named operations and fragments, for omitting false-positive/negative cases when operations
and fragments are located in separate files. For this reason, these rules must be included in the
recommended config

- rename `relay` config to `schema-relay`

> To avoid confusing when users extend this config for executable definitions (operations and
> fragments)
57 changes: 57 additions & 0 deletions .changeset/few-mails-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
'@graphql-eslint/eslint-plugin': major
---

- `alphabetize` rule changes

- add `definitions: true` option for `schema-all`/`operations-all` configs
- rename `values: ['EnumTypeDefinition']` to `values: true`
- rename `variables: ['OperationDefinition']` to `variables: true`
- add `groups: ['id', '*', 'createdAt', 'updatedAt']` for `schema-all`/`operations-all` configs

- `require-id-when-available` rule changes

- rename rule to `require-selections`

- update `schema-all`/`operations-all` configs

- `require-description` rule changes

- add `rootField: true` option for `schema-recommended` config

- require `eslint` at least `>=8.44.0` as peerDependency

- `naming-convention`

- add new options for `schema-recommended` config

```json5
{
'EnumTypeDefinition,EnumTypeExtension': {
forbiddenPrefixes: ['Enum'],
forbiddenSuffixes: ['Enum']
},
'InterfaceTypeDefinition,InterfaceTypeExtension': {
forbiddenPrefixes: ['Interface'],
forbiddenSuffixes: ['Interface']
},
'UnionTypeDefinition,UnionTypeExtension': {
forbiddenPrefixes: ['Union'],
forbiddenSuffixes: ['Union']
},
'ObjectTypeDefinition,ObjectTypeExtension': {
forbiddenPrefixes: ['Type'],
forbiddenSuffixes: ['Type']
}
}
```

- remove graphql-js' `unique-enum-value-names` rule

- rename `no-case-insensitive-enum-values-duplicates` to `unique-enum-value-names`

> Since this rule reports case-insensitive enum values duplicates too
- `require-nullable-result-in-root` rule changes

Do not check subscriptions
16 changes: 16 additions & 0 deletions .changeset/itchy-ads-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@graphql-eslint/eslint-plugin': major
---

- remove `parserOptions.schema`
- remove `parserOptions.documents`
- remove `parserOptions.extensions`
- remove `parserOptions.include`
- remove `parserOptions.exclude`
- remove `parserOptions.projects`
- remove `parserOptions.schemaOptions`
- remove `parserOptions.graphQLParserOptions`
- remove `parserOptions.skipGraphQLConfig`
- remove `parserOptions.operations`

- add `parserOptions.graphQLConfig?: IGraphQLConfig` for programmatic usage
25 changes: 25 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@graphql-eslint/example-code-file": "0.0.0",
"@graphql-eslint/example-graphql-config": "0.0.0",
"@graphql-eslint/example-monorepo": "0.0.0",
"@graphql-eslint/example-multiple-projects-graphql-config": "0.0.0",
"@graphql-eslint/example-prettier": "0.0.0",
"@graphql-eslint/example-programmatic": "0.0.0",
"@graphql-eslint/example-svelte-code-file": "0.0.0",
"@graphql-eslint/example-vue-code-file": "0.0.0",
"@graphql-eslint/eslint-plugin": "3.20.1",
"@theguild/eslint-rule-tester": "0.0.0",
"website": "0.0.0"
},
"changesets": [
"@graphql-eslint_eslint-plugin-1792-dependencies",
"dull-scissors-destroy",
"few-mails-sparkle",
"itchy-ads-compete",
"rare-planes-love",
"strong-needles-compare"
]
}
5 changes: 5 additions & 0 deletions .changeset/rare-planes-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-eslint/eslint-plugin': major
---

drop support of Node.js 12/14/16, GraphQL 14/15
15 changes: 15 additions & 0 deletions .changeset/strong-needles-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'@graphql-eslint/eslint-plugin': major
---

Remove `GraphQLRuleTester` from bundle, to test your rules use regular `RuleTester` from eslint

> **Note**: with this change unnecessary dependency `@babel/code-frame` was removed too
```js
import { RuleTester } from 'eslint'

const ruleTester = new RuleTester({
parser: require.resolve('@graphql-eslint/eslint-plugin')
})
```
11 changes: 2 additions & 9 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
ignorePatterns: ['examples', 'packages/plugin/tests/__snapshots__'],
ignorePatterns: ['examples', 'packages/plugin/__tests__/__snapshots__'],
extends: [
'@theguild',
'@theguild/eslint-config/json',
Expand Down Expand Up @@ -55,7 +55,7 @@ module.exports = {
},
},
{
files: ['**/tests/mocks/**/*.{ts,js}'],
files: ['**/__tests__/mocks/**/*.{ts,js}'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
},
Expand All @@ -69,13 +69,6 @@ module.exports = {
node: true,
},
},
{
files: ['packages/plugin/src/**'],
rules: {
// remove in v4 major
'unicorn/prefer-node-protocol': 'off',
},
},
{
files: ['packages/plugin/src/rules/index.ts'],
rules: {
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: pr
name: PR
on:
pull_request:
branches:
- master
branches: [master]

jobs:
dependencies:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: release
name: Release
on:
push:
branches:
- master
branches: [master]

jobs:
stable:
Expand Down
39 changes: 6 additions & 33 deletions .github/workflows/tests.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: Test

on:
push:
Expand Down Expand Up @@ -35,30 +35,18 @@ jobs:
nodeVersion: 18
packageManager: pnpm

- name: Use GraphQL v${{matrix.graphql_version}}
run: node scripts/match-graphql.js ${{matrix.graphql_version}}

- name: Install Dependencies
run: pnpm i --no-frozen-lockfile

- name: Build
run: pnpm build

- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: packages/plugin/dist

test:
name: Node.js v${{matrix.node_version}} / GraphQL v${{matrix.graphql_version}} / ESLint v8
timeout-minutes: 60
runs-on: ubuntu-latest
needs: [typecheck]
strategy:
matrix:
node_version: [16, 18, 20]
graphql_version: [15, 16]
node_version: [18, 20]
graphql_version: [16]

steps:
- name: Checkout Master
Expand All @@ -72,26 +60,11 @@ jobs:
nodeVersion: ${{matrix.node_version}}
packageManager: pnpm

- name: Use GraphQL v${{matrix.graphql_version}}
run: node scripts/match-graphql.js ${{matrix.graphql_version}}

- name: Install Dependencies
run: pnpm i --no-frozen-lockfile

# We need build for examples.spec.ts test
# Otherwise we'll get error - Cannot find module 'node_modules/@graphql-eslint/eslint-plugin/dist/index.js'
- name: Download Build Artifact
uses: actions/download-artifact@v3
with:
name: build-artifact
path: packages/plugin/dist

- name: Test
run: pnpm test
env:
CI: true
# - name: Lint ESLint
# run: pnpm lint

- name: Type Check
run: pnpm typecheck
#
# - name: Lint Prettier
# run: pnpm lint:prettier
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Fetch
run: git fetch origin master

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

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

- name: Publish a message
- name: Publish a Message
if: always() && contains(steps.diff_result.outputs.result, 'diff')
uses: marocchino/sticky-pull-request-comment@v2
with:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: website
name: Website

on:
push:
branches:
- master
branches: [master]
pull_request:
branches:
- master
branches: [master]

jobs:
deployment:
Expand Down
Loading

0 comments on commit 1c2d220

Please sign in to comment.