Skip to content

Commit aac97b1

Browse files
authored
refactor(shared): Refactor plugin helpers (#1279)
1 parent 3ac2201 commit aac97b1

File tree

11 files changed

+39
-30
lines changed

11 files changed

+39
-30
lines changed
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { getDocsUrl } from "@eslint-react/shared";
1+
import { WEBSITE_URL } from "@eslint-react/shared";
22
import { ESLintUtils } from "@typescript-eslint/utils";
33

4-
export const createRule = ESLintUtils.RuleCreator(getDocsUrl("debug"));
4+
function getDocsUrl(ruleName: string) {
5+
return `${WEBSITE_URL}/docs/rules/debug-${ruleName}`;
6+
}
7+
8+
export const createRule = ESLintUtils.RuleCreator(getDocsUrl);
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { getDocsUrl } from "@eslint-react/shared";
1+
import { WEBSITE_URL } from "@eslint-react/shared";
22
import { ESLintUtils } from "@typescript-eslint/utils";
33

4-
export const createRule = ESLintUtils.RuleCreator(getDocsUrl("dom"));
4+
function getDocsUrl(ruleName: string) {
5+
return `${WEBSITE_URL}/docs/rules/dom-${ruleName}`;
6+
}
7+
8+
export const createRule = ESLintUtils.RuleCreator(getDocsUrl);
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { getDocsUrl } from "@eslint-react/shared";
1+
import { WEBSITE_URL } from "@eslint-react/shared";
22
import { ESLintUtils } from "@typescript-eslint/utils";
33

4-
export const createRule = ESLintUtils.RuleCreator(getDocsUrl("hooks-extra"));
4+
function getDocsUrl(ruleName: string) {
5+
return `${WEBSITE_URL}/docs/rules/hooks-extra-${ruleName}`;
6+
}
7+
8+
export const createRule = ESLintUtils.RuleCreator(getDocsUrl);
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { getDocsUrl } from "@eslint-react/shared";
1+
import { WEBSITE_URL } from "@eslint-react/shared";
22
import { ESLintUtils } from "@typescript-eslint/utils";
33

4-
export const createRule = ESLintUtils.RuleCreator(getDocsUrl("naming-convention"));
4+
function getDocsUrl(ruleName: string) {
5+
return `${WEBSITE_URL}/docs/rules/naming-convention-${ruleName}`;
6+
}
7+
8+
export const createRule = ESLintUtils.RuleCreator(getDocsUrl);
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { getDocsUrl } from "@eslint-react/shared";
1+
import { WEBSITE_URL } from "@eslint-react/shared";
22
import { ESLintUtils } from "@typescript-eslint/utils";
33

4-
export const createRule = ESLintUtils.RuleCreator(getDocsUrl("web-api"));
4+
function getDocsUrl(ruleName: string) {
5+
return `${WEBSITE_URL}/docs/rules/web-api-${ruleName}`;
6+
}
7+
8+
export const createRule = ESLintUtils.RuleCreator(getDocsUrl);
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { getDocsUrl } from "@eslint-react/shared";
1+
import { WEBSITE_URL } from "@eslint-react/shared";
22
import { ESLintUtils } from "@typescript-eslint/utils";
33

4-
export const createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
4+
function getDocsUrl(ruleName: string) {
5+
return `${WEBSITE_URL}/docs/rules/${ruleName}`;
6+
}
7+
8+
export const createRule = ESLintUtils.RuleCreator(getDocsUrl);

packages/shared/src/get-doc-url.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/shared/src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
export * from "./_id";
22
export * from "./_require";
3+
export * from "./config-adapters";
34
export * from "./constants";
4-
export * from "./get-config-adapters";
5-
export * from "./get-doc-url";
6-
export * from "./get-react-version";
5+
export * from "./react-version";
76
export * from "./regexp";
87
export * from "./report";
98
export * from "./settings";
File renamed without changes.

0 commit comments

Comments
 (0)