Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error report for description-style rule #741

Merged
merged 2 commits into from
Oct 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rich-cougars-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-eslint/eslint-plugin': patch
---

fix error report for `description-style` rule
3 changes: 2 additions & 1 deletion packages/plugin/src/rules/description-style.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GraphQLESLintRule } from '../types';
import { getLocation } from '../utils';

type DescriptionStyleRuleConfig = [
{
Expand Down Expand Up @@ -58,7 +59,7 @@ const rule: GraphQLESLintRule<DescriptionStyleRuleConfig> = {
'[description.type="StringValue"]': node => {
if (node.description.block !== (style === 'block')) {
context.report({
node: node.description,
loc: getLocation(node.description.loc),
message: `Unexpected ${wrongDescriptionType} description`,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[` 1`] = `
1 |
2 | enum EnumUserLanguagesSkill {
> 3 | """
| ^ Unexpected block description
| ^ Unexpected block description
4 | basic
5 | """
6 | basic
Expand All @@ -28,7 +28,7 @@ exports[` 2`] = `
5 | """
6 | basic
> 7 | """
| ^ Unexpected block description
| ^ Unexpected block description
8 | fluent
9 | """
10 | fluent
Expand All @@ -52,7 +52,7 @@ exports[` 3`] = `
9 | """
10 | fluent
> 11 | """
| ^ Unexpected block description
| ^ Unexpected block description
12 | native
13 | """
14 | native
Expand All @@ -63,7 +63,7 @@ exports[` 3`] = `
exports[` 4`] = `
1 |
> 2 | " Test "
| ^ Unexpected inline description
| ^ Unexpected inline description
3 | type CreateOneUserPayload {
4 | "Created document ID"
5 | recordId: MongoID
Expand All @@ -79,7 +79,7 @@ exports[` 5`] = `
2 | " Test "
3 | type CreateOneUserPayload {
> 4 | "Created document ID"
| ^ Unexpected inline description
| ^ Unexpected inline description
5 | recordId: MongoID
6 |
7 | "Created document"
Expand All @@ -96,7 +96,7 @@ exports[` 6`] = `
5 | recordId: MongoID
6 |
> 7 | "Created document"
| ^ Unexpected inline description
| ^ Unexpected inline description
8 | record: User
9 | }
10 |
Expand Down