Skip to content

Commit f92a366

Browse files
committed
aa
1 parent 1afa407 commit f92a366

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

.changeset/six-rice-help.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
'@graphql-eslint/eslint-plugin': minor
33
---
44

5-
feat(`require-selections` rule): introduce new option `requireAllFields` to require all values of `fieldName: string[]` option
5+
feat(`require-selections` rule): introduce new option `requireAllFields` to require all values of
6+
`fieldName: string[]` option

packages/plugin/src/rules/require-selections/index.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,27 +503,27 @@ ruleTester.run<RuleOptions, true>('require-selections', rule, {
503503
},
504504
{
505505
name: 'should require all fields with `requireAllFields` option',
506-
code: /* GraphQL */ `{ hasId { id } }`,
506+
code: '{ hasId { id } }',
507507
options: [{ requireAllFields: true, fieldName: ['name', '_id'] }],
508508
parserOptions: {
509509
graphQLConfig: {
510510
schema: TEST_SCHEMA,
511511
documents: '{ foo }',
512512
},
513513
},
514-
errors: 2
514+
errors: 2,
515515
},
516516
{
517517
name: 'should require rest of all fields with `requireAllFields` option',
518-
code: /* GraphQL */ `{ hasId { _id } }`,
518+
code: '{ hasId { _id } }',
519519
options: [{ requireAllFields: true, fieldName: ['name', '_id'] }],
520520
parserOptions: {
521521
graphQLConfig: {
522522
schema: TEST_SCHEMA,
523523
documents: '{ foo }',
524524
},
525525
},
526-
errors: 1
527-
}
526+
errors: 1,
527+
},
528528
],
529529
});

packages/plugin/src/rules/require-selections/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ const schema = {
4444
},
4545
requireAllFields: {
4646
type: 'boolean',
47-
description: 'Whether all fields of `fieldName` option must be included.'
48-
}
47+
description: 'Whether all fields of `fieldName` option must be included.',
48+
},
4949
},
5050
},
5151
} as const;
@@ -207,15 +207,14 @@ export const rule: GraphQLESLintRule<RuleOptions, true> = {
207207
return;
208208
}
209209

210-
211210
checkFragments(node as GraphQLESTreeNode<SelectionSetNode>);
212211

213212
if (requireAllFields) {
214213
for (const idName of idNames) {
215-
report([idName])
214+
report([idName]);
216215
}
217216
} else {
218-
report(idNames)
217+
report(idNames);
219218
}
220219
}
221220

@@ -258,8 +257,8 @@ export const rule: GraphQLESLintRule<RuleOptions, true> = {
258257
checkedFragmentSpreads.size === 0
259258
? ''
260259
: ` or add to used fragment${
261-
checkedFragmentSpreads.size > 1 ? 's' : ''
262-
} ${englishJoinWords([...checkedFragmentSpreads].map(name => `\`${name}\``))}`;
260+
checkedFragmentSpreads.size > 1 ? 's' : ''
261+
} ${englishJoinWords([...checkedFragmentSpreads].map(name => `\`${name}\``))}`;
263262

264263
const problem: ReportDescriptor = {
265264
loc,

0 commit comments

Comments
 (0)