Skip to content

Commit

Permalink
fix require is not defined in flat configs for Vue/Svelte projects (#…
Browse files Browse the repository at this point in the history
…2466)

* yoyo

* use alpha

* use `assert` instead `with`
  • Loading branch information
dimaMachina committed Aug 3, 2024
1 parent 5d0b322 commit da608d7
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 112 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-socks-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-eslint/eslint-plugin': patch
---

fix `require is not defined` in flat configs for Vue/Svelte projects
1 change: 0 additions & 1 deletion examples/monorepo/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default [
processor: graphql.processors.graphql,
languageOptions: {
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
Expand Down
31 changes: 0 additions & 31 deletions examples/multiple-projects-graphql-config/.eslintrc.cjs

This file was deleted.

31 changes: 31 additions & 0 deletions examples/multiple-projects-graphql-config/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import js from '@eslint/js';
import * as graphql from '@graphql-eslint/eslint-plugin';

export default [
{
files: ['**/*.js'],
processor: graphql.processors.graphql,
rules: js.configs.recommended.rules,
},
{
// Setup GraphQL Parser
files: ['**/*.graphql'],
plugins: {
'@graphql-eslint': { rules: graphql.rules },
},
languageOptions: {
parser: graphql.parser,
},
},
{
files: ['schema.*.graphql'],
rules: {
...graphql.flatConfigs['schema-recommended'].rules,
'@graphql-eslint/require-description': 'off',
},
},
{
files: ['**/*.js/*.graphql'],
rules: graphql.flatConfigs['operations-recommended'].rules,
},
];
3 changes: 2 additions & 1 deletion examples/multiple-projects-graphql-config/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "@graphql-eslint/example-multiple-projects-graphql-config",
"version": "0.0.0",
"type": "module",
"author": "Dimitri POSTOLOV",
"private": true,
"scripts": {
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint --cache ."
"lint": "eslint --cache ."
},
"dependencies": {
"graphql": "16.9.0"
Expand Down
37 changes: 0 additions & 37 deletions examples/svelte-code-file/.eslintrc.cjs

This file was deleted.

40 changes: 40 additions & 0 deletions examples/svelte-code-file/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import svelteParser from 'svelte-eslint-parser';
import js from '@eslint/js';
import * as graphql from '@graphql-eslint/eslint-plugin';

export default [
{
files: ['**/*.js', '**/*.svelte'],
processor: graphql.processors.graphql,
rules: js.configs.recommended.rules,
},
{
files: ['**/*.svelte'],
languageOptions: {
parser: svelteParser,
},
},
{
files: ['**/*.graphql'],
languageOptions: {
parser: graphql.parser,
},
plugins: {
'@graphql-eslint': { rules: graphql.rules },
},
rules: {
'@graphql-eslint/no-anonymous-operations': 'error',
'@graphql-eslint/no-duplicate-fields': 'error',
'@graphql-eslint/naming-convention': [
'error',
{
OperationDefinition: {
style: 'PascalCase',
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
},
},
],
},
},
];
2 changes: 1 addition & 1 deletion examples/svelte-code-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Dimitri POSTOLOV",
"private": true,
"scripts": {
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint --cache ."
"lint": "eslint --cache ."
},
"dependencies": {
"graphql": "16.9.0"
Expand Down
37 changes: 0 additions & 37 deletions examples/vue-code-file/.eslintrc.cjs

This file was deleted.

40 changes: 40 additions & 0 deletions examples/vue-code-file/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import vueParser from 'vue-eslint-parser';
import js from '@eslint/js';
import * as graphql from '@graphql-eslint/eslint-plugin';

export default [
{
files: ['**/*.js', '**/*.vue'],
processor: graphql.processors.graphql,
rules: js.configs.recommended.rules,
},
{
files: ['**/*.vue'],
languageOptions: {
parser: vueParser,
},
},
{
files: ['**/*.graphql'],
languageOptions: {
parser: graphql.parser,
},
plugins: {
'@graphql-eslint': { rules: graphql.rules },
},
rules: {
'@graphql-eslint/no-anonymous-operations': 'error',
'@graphql-eslint/no-duplicate-fields': 'error',
'@graphql-eslint/naming-convention': [
'error',
{
OperationDefinition: {
style: 'PascalCase',
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
},
},
],
},
},
];
2 changes: 1 addition & 1 deletion examples/vue-code-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Dimitri POSTOLOV",
"private": true,
"scripts": {
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint --cache ."
"lint": "eslint --cache ."
},
"dependencies": {
"graphql": "16.9.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"dependencies": {
"@graphql-tools/code-file-loader": "^8.0.0",
"@graphql-tools/graphql-tag-pluck": "^8.0.0",
"@graphql-tools/graphql-tag-pluck": "8.3.2-alpha-20240803110708-298aeb8bb2ca4ef649bf09fc42f82fc88c6d5e13",
"@graphql-tools/utils": "^10.0.0",
"debug": "^4.3.4",
"fast-glob": "^3.2.12",
Expand Down
23 changes: 21 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit da608d7

Please sign in to comment.