Skip to content

Commit daff904

Browse files
author
Dimitri POSTOLOV
authored
enable require-meta-docs-description rule (#620)
1 parent 2e95055 commit daff904

File tree

6 files changed

+24
-18
lines changed

6 files changed

+24
-18
lines changed

.eslintrc.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ module.exports = {
22
reportUnusedDisableDirectives: true,
33
ignorePatterns: ['examples'],
44
parser: '@typescript-eslint/parser',
5-
extends: [
6-
'eslint:recommended',
7-
'plugin:@typescript-eslint/recommended',
8-
'standard',
9-
'plugin:eslint-plugin/recommended',
10-
'prettier',
11-
],
5+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'standard', 'prettier'],
126
plugins: ['unicorn'],
137
rules: {
148
'no-empty': 'off',
@@ -29,19 +23,30 @@ module.exports = {
2923
'@typescript-eslint/ban-types': 'off',
3024
'unicorn/prefer-array-some': 'error',
3125
'unicorn/prefer-includes': 'error',
32-
'eslint-plugin/test-case-shorthand-strings': 'error',
33-
'eslint-plugin/no-only-tests': 'error',
34-
'eslint-plugin/require-meta-docs-url': [
35-
'error',
36-
{ pattern: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/{{name}}.md' },
37-
],
3826
},
3927
overrides: [
28+
{
29+
files: ['**/rules/*.ts'],
30+
extends: ['plugin:eslint-plugin/rules-recommended'],
31+
rules: {
32+
'eslint-plugin/no-deprecated-context-methods': 'error',
33+
'eslint-plugin/require-meta-docs-description': ['error', { pattern: '.+\\.' }], // force to put a point at the end
34+
'eslint-plugin/require-meta-docs-url': [
35+
'error',
36+
{ pattern: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/{{name}}.md' },
37+
],
38+
},
39+
},
4040
{
4141
files: ['*.{spec,test}.{ts,js}'],
4242
env: {
4343
jest: true,
4444
},
45+
extends: ['plugin:eslint-plugin/tests-recommended'],
46+
rules: {
47+
'eslint-plugin/no-only-tests': 'error',
48+
'eslint-plugin/test-case-shorthand-strings': 'error',
49+
},
4550
},
4651
{
4752
files: ['**/tests/mocks/*.{ts,js}'],

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ Each rule has emojis denoting:
2424
| [known-type-names](rules/known-type-names.md) | A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema. |     🔮 | |
2525
| [lone-anonymous-operation](rules/lone-anonymous-operation.md) | A GraphQL document is only valid if when it contains an anonymous operation (the query short-hand) that it contains only that one operation definition. |     🔮 | |
2626
| [lone-schema-definition](rules/lone-schema-definition.md) | A GraphQL document is only valid if it contains only one schema definition. |     🔮 | |
27-
| [match-document-filename](rules/match-document-filename.md) | This rule allows you to enforce that the file name should match the operation name |     🚀 | |
27+
| [match-document-filename](rules/match-document-filename.md) | This rule allows you to enforce that the file name should match the operation name. |     🚀 | |
2828
| [naming-convention](rules/naming-convention.md) | Require names to follow specified conventions. |     🚀 | |
2929
| [no-anonymous-operations](rules/no-anonymous-operations.md) | Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes. |     🚀 | |
30-
| [no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md) | |     🚀 | 🔧 |
30+
| [no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md) | Disallow case-insensitive enum values duplicates. |     🚀 | 🔧 |
3131
| [no-deprecated](rules/no-deprecated.md) | Enforce that deprecated fields or enum values are not in use by operations. |     🚀 | |
3232
| [no-fragment-cycles](rules/no-fragment-cycles.md) | A GraphQL fragment is only valid when it does not have cycles in fragments usage. |     🔮 | |
3333
| [no-hashtag-description](rules/no-hashtag-description.md) | Requires to use `"""` or `"` for adding a GraphQL description instead of `#`. |     🚀 | |

docs/rules/match-document-filename.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
66
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
77

8-
This rule allows you to enforce that the file name should match the operation name
8+
This rule allows you to enforce that the file name should match the operation name.
99

1010
## Usage Examples
1111

docs/rules/no-case-insensitive-enum-values-duplicates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
66
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
77

8-
8+
Disallow case-insensitive enum values duplicates.
99

1010
## Usage Examples
1111

packages/plugin/src/rules/match-document-filename.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const rule: GraphQLESLintRule<MatchDocumentFilenameRuleConfig> = {
4141
type: 'suggestion',
4242
docs: {
4343
category: 'Best Practices',
44-
description: 'This rule allows you to enforce that the file name should match the operation name',
44+
description: 'This rule allows you to enforce that the file name should match the operation name.',
4545
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/match-document-filename.md`,
4646
examples: [
4747
{

packages/plugin/src/rules/no-case-insensitive-enum-values-duplicates.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const rule: GraphQLESLintRule = {
1010
'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-case-insensitive-enum-values-duplicates.md',
1111
category: 'Best Practices',
1212
recommended: true,
13+
description: 'Disallow case-insensitive enum values duplicates.',
1314
examples: [
1415
{
1516
title: 'Incorrect',

0 commit comments

Comments
 (0)