Skip to content

Commit

Permalink
fix error report for description-style rule (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri POSTOLOV committed Oct 31, 2021
1 parent 578b890 commit 46f03f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-cougars-sort.md
@@ -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
@@ -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
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

0 comments on commit 46f03f7

Please sign in to comment.