From dd0ad38835f5ca7c57e9f2a7b4ab9226e8641086 Mon Sep 17 00:00:00 2001 From: Dotan Simha Date: Sat, 3 Oct 2020 10:30:30 +0300 Subject: [PATCH] update docs, added release flow and canary flows --- .github/{future_workflows => workflows}/canary.yml | 0 .github/{future_workflows => workflows}/release.yml | 0 .../plugin/src/rules/avoid-operation-name-prefix.ts | 8 ++++++++ packages/plugin/src/rules/description-style.ts | 12 +++++++----- packages/plugin/src/rules/input-name.ts | 4 ++-- packages/plugin/src/rules/naming-convention.ts | 4 ++-- packages/plugin/src/rules/no-anonymous-operations.ts | 8 ++++++++ .../no-case-insensitive-enum-values-duplicates.ts | 7 +++++++ .../plugin/src/rules/no-operation-name-suffix.ts | 7 +++++++ packages/plugin/src/rules/prettier.ts | 5 ++++- .../plugin/src/rules/require-deprecation-reason.ts | 10 +++++++++- packages/plugin/src/rules/require-description.ts | 7 +++++++ .../plugin/src/rules/require-id-when-available.ts | 6 ++++++ packages/plugin/src/rules/validate-against-schema.ts | 5 +++++ 14 files changed, 72 insertions(+), 11 deletions(-) rename .github/{future_workflows => workflows}/canary.yml (100%) rename .github/{future_workflows => workflows}/release.yml (100%) diff --git a/.github/future_workflows/canary.yml b/.github/workflows/canary.yml similarity index 100% rename from .github/future_workflows/canary.yml rename to .github/workflows/canary.yml diff --git a/.github/future_workflows/release.yml b/.github/workflows/release.yml similarity index 100% rename from .github/future_workflows/release.yml rename to .github/workflows/release.yml diff --git a/packages/plugin/src/rules/avoid-operation-name-prefix.ts b/packages/plugin/src/rules/avoid-operation-name-prefix.ts index 92bb795c67f..0414ee5bd7d 100644 --- a/packages/plugin/src/rules/avoid-operation-name-prefix.ts +++ b/packages/plugin/src/rules/avoid-operation-name-prefix.ts @@ -46,6 +46,14 @@ function verifyRule( const rule: GraphQLESLintRule = { meta: { + type: 'suggestion', + docs: { + description: + 'Enforce/avoid operation name prefix, useful if you wish to avoid prefix in your root fields, or avoid using REST terminology in your schema', + category: 'Stylistic Issues', + recommended: false, + url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/avoid-operation-name-prefix.md', + }, messages: { [AVOID_OPERATION_NAME_PREFIX]: `Forbidden operation name prefix: "{{ invalidPrefix }}"`, }, diff --git a/packages/plugin/src/rules/description-style.ts b/packages/plugin/src/rules/description-style.ts index ffe6aa6c2de..81ed768a693 100644 --- a/packages/plugin/src/rules/description-style.ts +++ b/packages/plugin/src/rules/description-style.ts @@ -1,17 +1,19 @@ import { GraphQLESLintRule } from '../types'; -type DescriptionStyleRuleConfig = [{ - style: 'inline' | 'block'; -}]; +type DescriptionStyleRuleConfig = [ + { + style: 'inline' | 'block'; + } +]; const rule: GraphQLESLintRule = { meta: { type: 'suggestion', docs: { - description: 'Require all comments to follow the same style', + description: 'Require all comments to follow the same style (either block or inline)', category: 'Stylistic Issues', recommended: false, - url: 'https://github.com/ilyavolodin/graphql-eslint/blob/master/docs/rules/description-style.md', + url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/description-style.md', }, schema: [ { diff --git a/packages/plugin/src/rules/input-name.ts b/packages/plugin/src/rules/input-name.ts index 6fdb838278c..024055e8d11 100644 --- a/packages/plugin/src/rules/input-name.ts +++ b/packages/plugin/src/rules/input-name.ts @@ -11,10 +11,10 @@ const rule: GraphQLESLintRule = { type: 'suggestion', docs: { description: - 'require mutation argument to be always called "input" and input type to be called Mutation name + "Input"', + 'Require mutation argument to be always called "input" and input type to be called Mutation name + "Input"', category: 'Stylistic Issues', recommended: false, - url: 'https://github.com/ilyavolodin/graphql-eslint/blob/master/docs/rules/input-name.md', + url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/input-name.md', }, schema: [ { diff --git a/packages/plugin/src/rules/naming-convention.ts b/packages/plugin/src/rules/naming-convention.ts index 14b5d730168..4ed5e18c012 100644 --- a/packages/plugin/src/rules/naming-convention.ts +++ b/packages/plugin/src/rules/naming-convention.ts @@ -48,10 +48,10 @@ const rule: GraphQLESLintRule = { meta: { type: 'suggestion', docs: { - description: 'requires description around GraphQL nodes', + description: 'Requires description around GraphQL nodes', category: 'Best practices', recommended: true, - url: 'https://github.com/ilyavolodin/graphql-eslint/blob/master/docs/rules/naming-convention.md', + url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/naming-convention.md', }, schema: [ { diff --git a/packages/plugin/src/rules/no-anonymous-operations.ts b/packages/plugin/src/rules/no-anonymous-operations.ts index 9340d4a9534..e77dc720228 100644 --- a/packages/plugin/src/rules/no-anonymous-operations.ts +++ b/packages/plugin/src/rules/no-anonymous-operations.ts @@ -4,6 +4,14 @@ const NO_ANONYMOUS_OPERATIONS = 'NO_ANONYMOUS_OPERATIONS'; const rule: GraphQLESLintRule = { meta: { + type: 'suggestion', + docs: { + category: 'Best Practices', + description: + 'Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.', + recommended: true, + url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-anonymous-operations.md', + }, messages: { [NO_ANONYMOUS_OPERATIONS]: `Anonymous GraphQL operations are forbidden. Please make sure to name your {{ operation }}!`, }, diff --git a/packages/plugin/src/rules/no-case-insensitive-enum-values-duplicates.ts b/packages/plugin/src/rules/no-case-insensitive-enum-values-duplicates.ts index 832497db68f..917a7f1686d 100644 --- a/packages/plugin/src/rules/no-case-insensitive-enum-values-duplicates.ts +++ b/packages/plugin/src/rules/no-case-insensitive-enum-values-duplicates.ts @@ -4,6 +4,13 @@ const ERROR_MESSAGE_ID = 'NO_CASE_INSENSITIVE_ENUM_VALUES_DUPLICATES'; const rule: GraphQLESLintRule = { meta: { + type: 'suggestion', + docs: { + url: + 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-case-insensitive-enum-values-duplicates.md', + category: 'Best Practices', + recommended: true, + }, fixable: 'code', messages: { [ERROR_MESSAGE_ID]: `Case-insensitive enum values duplicates are not allowed! Found: "{{ found }}"`, diff --git a/packages/plugin/src/rules/no-operation-name-suffix.ts b/packages/plugin/src/rules/no-operation-name-suffix.ts index 231a2a5235f..d63f6bccebf 100644 --- a/packages/plugin/src/rules/no-operation-name-suffix.ts +++ b/packages/plugin/src/rules/no-operation-name-suffix.ts @@ -27,6 +27,13 @@ function verifyRule( const rule: GraphQLESLintRule = { meta: { fixable: 'code', + type: 'suggestion', + docs: { + category: 'Stylistic Issues', + recommended: true, + description: `Makes sure you are not adding the operation type to the name of the operation.`, + url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-operation-name-suffix.md`, + }, messages: { [NO_OPERATION_NAME_SUFFIX]: `Unnecessary "{{ invalidSuffix }}" suffix in your operation name!`, }, diff --git a/packages/plugin/src/rules/prettier.ts b/packages/plugin/src/rules/prettier.ts index 10352dfa27e..c0efda6640a 100644 --- a/packages/plugin/src/rules/prettier.ts +++ b/packages/plugin/src/rules/prettier.ts @@ -95,7 +95,10 @@ type PrettierRuleConfig = [ const rule: GraphQLESLintRule = { meta: { docs: { - url: 'https://github.com/ilyavolodin/graphql-eslint/blob/master/docs/rules/prettier.md', + description: `Having all your code follow the same styling guidelines makes it easier to read and understand the code`, + recommended: true, + category: 'Stylistic Issues', + url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/prettier.md', }, type: 'layout', fixable: 'code', diff --git a/packages/plugin/src/rules/require-deprecation-reason.ts b/packages/plugin/src/rules/require-deprecation-reason.ts index 05b60f7f7be..e790353144a 100644 --- a/packages/plugin/src/rules/require-deprecation-reason.ts +++ b/packages/plugin/src/rules/require-deprecation-reason.ts @@ -2,7 +2,15 @@ import { GraphQLESLintRule } from '../types'; import { valueFromNode } from '../estree-parser/utils'; const rule: GraphQLESLintRule = { - meta: {}, + meta: { + docs: { + description: `Require all deprecation directives to specify a reason`, + category: 'Best Practices', + url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-deprecation-reason.md`, + recommended: true, + }, + type: 'suggestion', + }, create(context) { return { Directive(node) { diff --git a/packages/plugin/src/rules/require-description.ts b/packages/plugin/src/rules/require-description.ts index f592e94fa2d..8af65fa79af 100644 --- a/packages/plugin/src/rules/require-description.ts +++ b/packages/plugin/src/rules/require-description.ts @@ -47,6 +47,13 @@ function verifyRule( const rule: GraphQLESLintRule = { meta: { + docs: { + category: 'Best Practices', + description: `Enforce descriptions in your type definitions`, + url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-description.md`, + recommended: true, + }, + type: 'suggestion', messages: { [REQUIRE_DESCRIPTION_ERROR]: `Description is required for nodes of type "{{ nodeType }}"`, }, diff --git a/packages/plugin/src/rules/require-id-when-available.ts b/packages/plugin/src/rules/require-id-when-available.ts index 4ec336edfbd..e260e15dfae 100644 --- a/packages/plugin/src/rules/require-id-when-available.ts +++ b/packages/plugin/src/rules/require-id-when-available.ts @@ -10,6 +10,12 @@ type RequireIdWhenAvailableRuleConfig = [{ fieldName: string }]; const rule: GraphQLESLintRule = { meta: { + type: 'suggestion', + docs: { + category: 'Best Practices', + description: `This rule allow you to enforce selecting specific fields when they are available on the GraphQL type.`, + url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/require-id-when-available.md`, + }, messages: { [REQUIRE_ID_WHEN_AVAILABLE]: `Field "{{ fieldName }}" must be selected when it's available on a type. Please make sure to include it in your selection set!`, }, diff --git a/packages/plugin/src/rules/validate-against-schema.ts b/packages/plugin/src/rules/validate-against-schema.ts index 7ae01fab5a2..bc18640079f 100644 --- a/packages/plugin/src/rules/validate-against-schema.ts +++ b/packages/plugin/src/rules/validate-against-schema.ts @@ -20,6 +20,11 @@ function validateDoc(context: GraphQLESlintRuleContext, schema: GraphQLSchema, d const rule: GraphQLESLintRule = { meta: { + docs: { + url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/validate-against-schema.md`, + recommended: true, + description: `This rule validates GraphQL operations against your GraphQL schema, and reflects the error as lint errors.`, + }, type: 'problem', }, create(context) {