From 2645e44d840a35543877892e08e304e824a7d381 Mon Sep 17 00:00:00 2001 From: Userbit <34487074+Userbit@users.noreply.github.com> Date: Thu, 14 Nov 2019 19:40:52 +0300 Subject: [PATCH 1/2] Get ruleName without specifying file extension --- src/rules/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rules/utils.ts b/src/rules/utils.ts index 12a03709a..70bd959ba 100644 --- a/src/rules/utils.ts +++ b/src/rules/utils.ts @@ -1,5 +1,5 @@ // TODO: rename to utils.ts when TS migration is complete -import { basename } from 'path'; +import path from 'path'; import { AST_NODE_TYPES, ESLintUtils, @@ -11,7 +11,7 @@ import { version } from '../../package.json'; const REPO_URL = 'https://github.com/jest-community/eslint-plugin-jest'; export const createRule = ESLintUtils.RuleCreator(name => { - const ruleName = basename(name, '.ts'); + const ruleName = path.parse(name).name; return `${REPO_URL}/blob/v${version}/docs/rules/${ruleName}.md`; }); From c96cbf73cb54e7387165ca457d07d4e4a890578b Mon Sep 17 00:00:00 2001 From: Userbit <34487074+Userbit@users.noreply.github.com> Date: Thu, 14 Nov 2019 20:43:09 +0300 Subject: [PATCH 2/2] fix path.parse() to parsePath() --- src/rules/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rules/utils.ts b/src/rules/utils.ts index 70bd959ba..b5cb219d4 100644 --- a/src/rules/utils.ts +++ b/src/rules/utils.ts @@ -1,5 +1,5 @@ // TODO: rename to utils.ts when TS migration is complete -import path from 'path'; +import { parse as parsePath } from 'path'; import { AST_NODE_TYPES, ESLintUtils, @@ -11,7 +11,7 @@ import { version } from '../../package.json'; const REPO_URL = 'https://github.com/jest-community/eslint-plugin-jest'; export const createRule = ESLintUtils.RuleCreator(name => { - const ruleName = path.parse(name).name; + const ruleName = parsePath(name).name; return `${REPO_URL}/blob/v${version}/docs/rules/${ruleName}.md`; });