From 97ed8c94c7138113d5e4904a92d00b87eaf7ac05 Mon Sep 17 00:00:00 2001 From: alceil <47685349+alceil@users.noreply.github.com> Date: Tue, 29 Mar 2022 11:25:39 +0530 Subject: [PATCH 1/4] Update CUSTOM_RULES.md --- docs/development/CUSTOM_RULES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/CUSTOM_RULES.md b/docs/development/CUSTOM_RULES.md index a101dadbd297..144f2c4fc9b8 100644 --- a/docs/development/CUSTOM_RULES.md +++ b/docs/development/CUSTOM_RULES.md @@ -57,7 +57,7 @@ export const rule = createRule({ }, meta: { docs: { - category: 'Best Practices', + recommended: 'warn', description: 'Function declaration names should start with an upper-case letter.', }, From 8808869acaa0ae9ffa09973472b8527e6e1545a4 Mon Sep 17 00:00:00 2001 From: alceil <47685349+alceil@users.noreply.github.com> Date: Tue, 29 Mar 2022 23:21:39 +0530 Subject: [PATCH 2/4] Added the neccessary changes --- docs/development/CUSTOM_RULES.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/development/CUSTOM_RULES.md b/docs/development/CUSTOM_RULES.md index 144f2c4fc9b8..9f49bcc8544d 100644 --- a/docs/development/CUSTOM_RULES.md +++ b/docs/development/CUSTOM_RULES.md @@ -46,20 +46,22 @@ export const rule = createRule({ create(context) { return { FunctionDeclaration(node) { - if (/^[a-z]/.test(node.id.name)) { + if(node.id!=null){ + if (/^[a-z]/.test(node.id.name)) { context.report({ messageId: 'uppercase', node: node.id, }); } + } }, }; }, + name: 'rule-creator', meta: { docs: { + description:'Function declaration names should start with an upper-case letter.', recommended: 'warn', - description: - 'Function declaration names should start with an upper-case letter.', }, messages: { uppercase: 'Start this name with an upper-case letter.', @@ -67,6 +69,7 @@ export const rule = createRule({ type: 'suggestion', schema: [], }, + defaultOptions: [], }); ``` From 299bf9194bd4dfc97bd907d0bddb8d9a9faec307 Mon Sep 17 00:00:00 2001 From: alceil <47685349+alceil@users.noreply.github.com> Date: Wed, 30 Mar 2022 10:55:09 +0530 Subject: [PATCH 3/4] formated code with pretier and changed name --- docs/development/CUSTOM_RULES.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/docs/development/CUSTOM_RULES.md b/docs/development/CUSTOM_RULES.md index 9f49bcc8544d..5201a600a54d 100644 --- a/docs/development/CUSTOM_RULES.md +++ b/docs/development/CUSTOM_RULES.md @@ -35,10 +35,10 @@ It takes in a function that transforms a rule name into its documentation URL, t This rule bans function declarations that start with a lower-case letter: ```ts -import { ESLintUtils } from '@typescript-eslint/utils'; +import { ESLintUtils } from "@typescript-eslint/utils"; const createRule = ESLintUtils.RuleCreator( - name => `https://example.com/rule/${name}`, + (name) => `https://example.com/rule/${name}` ); // Type: RuleModule<"uppercase", ...> @@ -46,27 +46,28 @@ export const rule = createRule({ create(context) { return { FunctionDeclaration(node) { - if(node.id!=null){ + if (node.id != null) { if (/^[a-z]/.test(node.id.name)) { - context.report({ - messageId: 'uppercase', - node: node.id, - }); + context.report({ + messageId: "uppercase", + node: node.id, + }); + } } - } }, }; }, - name: 'rule-creator', + name: "uppercase-first-declarations", meta: { docs: { - description:'Function declaration names should start with an upper-case letter.', - recommended: 'warn', + description: + "Function declaration names should start with an upper-case letter.", + recommended: "warn", }, messages: { - uppercase: 'Start this name with an upper-case letter.', + uppercase: "Start this name with an upper-case letter.", }, - type: 'suggestion', + type: "suggestion", schema: [], }, defaultOptions: [], From 9d1afde442577664dc32bbbc9e40e563f7896ae5 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 30 Mar 2022 16:49:18 -0500 Subject: [PATCH 4/4] fix: format CUSTOM_RULES.md --- docs/development/CUSTOM_RULES.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/development/CUSTOM_RULES.md b/docs/development/CUSTOM_RULES.md index 5201a600a54d..345e42c289ec 100644 --- a/docs/development/CUSTOM_RULES.md +++ b/docs/development/CUSTOM_RULES.md @@ -35,10 +35,10 @@ It takes in a function that transforms a rule name into its documentation URL, t This rule bans function declarations that start with a lower-case letter: ```ts -import { ESLintUtils } from "@typescript-eslint/utils"; +import { ESLintUtils } from '@typescript-eslint/utils'; const createRule = ESLintUtils.RuleCreator( - (name) => `https://example.com/rule/${name}` + name => `https://example.com/rule/${name}`, ); // Type: RuleModule<"uppercase", ...> @@ -49,7 +49,7 @@ export const rule = createRule({ if (node.id != null) { if (/^[a-z]/.test(node.id.name)) { context.report({ - messageId: "uppercase", + messageId: 'uppercase', node: node.id, }); } @@ -57,17 +57,17 @@ export const rule = createRule({ }, }; }, - name: "uppercase-first-declarations", + name: 'uppercase-first-declarations', meta: { docs: { description: - "Function declaration names should start with an upper-case letter.", - recommended: "warn", + 'Function declaration names should start with an upper-case letter.', + recommended: 'warn', }, messages: { - uppercase: "Start this name with an upper-case letter.", + uppercase: 'Start this name with an upper-case letter.', }, - type: "suggestion", + type: 'suggestion', schema: [], }, defaultOptions: [], pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy