Skip to content

Commit

Permalink
[v4] remove parserOptions.schema/operations, add `parserOptions.gra…
Browse files Browse the repository at this point in the history
…phQLConfig` for programmatic usage (#1795)
  • Loading branch information
dimaMachina committed Aug 9, 2023
1 parent 4079167 commit 2f46a71
Show file tree
Hide file tree
Showing 116 changed files with 1,280 additions and 1,570 deletions.
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
7 changes: 3 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ jobs:

- 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
95 changes: 3 additions & 92 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,111 +1,22 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

.next/
dist/
.bob/
.idea/
out/
website/public/_redirects
website/public/sitemap.xml
website/public/robots.txt
.turbo/
3 changes: 0 additions & 3 deletions examples/code-file/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ export default [
},
languageOptions: {
parser: graphqlESLint,
parserOptions: {
schema: 'schema.graphql',
},
},
rules: {
'@graphql-eslint/no-anonymous-operations': 'error',
Expand Down
3 changes: 3 additions & 0 deletions examples/code-file/graphql.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
schema: 'schema.graphql',
};
2 changes: 0 additions & 2 deletions examples/graphql-config-code-file/.graphqlrc.yml

This file was deleted.

33 changes: 0 additions & 33 deletions examples/graphql-config-code-file/eslint.config.js

This file was deleted.

20 changes: 0 additions & 20 deletions examples/graphql-config-code-file/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions examples/graphql-config-code-file/query.js

This file was deleted.

8 changes: 0 additions & 8 deletions examples/graphql-config-code-file/schema.graphql

This file was deleted.

2 changes: 0 additions & 2 deletions examples/graphql-config/.graphqlrc.yml

This file was deleted.

4 changes: 4 additions & 0 deletions examples/graphql-config/graphql.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
schema: 'schema.graphql',
documents: 'operations/*.graphql',
};
5 changes: 0 additions & 5 deletions examples/monorepo/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as graphqlESLint from '@graphql-eslint/eslint-plugin';
import js from '@eslint/js';

const SCHEMA_PATH = 'server/**/*.gql';
const OPERATIONS_PATH = 'client/**/*.{tsx,gql}';

export default [
{
Expand Down Expand Up @@ -30,10 +29,6 @@ export default [
},
languageOptions: {
parser: graphqlESLint,
parserOptions: {
schema: SCHEMA_PATH,
operations: OPERATIONS_PATH,
},
},
},
{
Expand Down
4 changes: 4 additions & 0 deletions examples/monorepo/graphql.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
schema: 'server/**/*.gql',
documents: 'client/**/*.{tsx,gql}',
};
4 changes: 2 additions & 2 deletions examples/multiple-projects-graphql-config/graphql.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const config: IGraphQLConfig = {
documents: 'query.second-project.js',
extensions: {
// in case you want to use different names for magic comment and module identifier
pluckConfig: <GraphQLTagPluckOptions>{
pluckConfig: {
modules: [{ name: 'custom-graphql-tag', identifier: 'custom' }],
globalGqlIdentifierName: 'custom',
gqlMagicComment: 'MyGraphQL',
},
} satisfies GraphQLTagPluckOptions,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ export default [
languageOptions: {
parser: graphqlESLint,
parserOptions: {
schema: 'schema.graphql',
operations: ['query.graphql', 'fragment.graphql', 'fragment2.graphql'],
graphQLConfig: {
schema: 'schema.graphql',
documents: ['query.graphql', 'fragment.graphql', 'fragment2.graphql'],
},
},
},
rules: {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@graphql-eslint/example-basic",
"name": "@graphql-eslint/example-programmatic",
"version": "0.0.0",
"type": "module",
"repository": "https://github.com/B2o5T/graphql-eslint",
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
"ci:lint": "eslint --ignore-path .gitignore --output-file eslint_report.json --format json .",
"create-rule": "tsx scripts/create-rule.ts",
"generate:configs": "tsx scripts/generate-configs.ts",
"lint": "eslint --ignore-path .gitignore .",
"lint": "eslint --ignore-path .gitignore --cache .",
"lint:prettier": "prettier --cache --check .",
"postinstall": "tsx scripts/patch-graphql.ts",
"prebuild": "rimraf tsconfig.tsbuildinfo",
"prerelease": "NODE_ENV=production pnpm build",
"prettier": "pnpm lint:prettier --write",
"release": "changeset publish",
"test": "turbo run test --filter=!website"
"test": "turbo run test --filter=!website",
"typecheck": "turbo run typecheck"
},
"devDependencies": {
"@changesets/changelog-github": "0.4.8",
Expand Down

0 comments on commit 2f46a71

Please sign in to comment.