Skip to content

Commit

Permalink
fix: rule docs links in create-eslint-rule utils (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry committed Feb 13, 2022
1 parent c4f0fc4 commit 94f6e21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
12 changes: 4 additions & 8 deletions packages/eslint-plugin-template/src/utils/create-eslint-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ import type {
ParseSourceSpan,
TmplAstElement,
} from '@angular-eslint/bundled-angular-compiler';
import type {
ESLintUtils,
TSESLint,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import { applyDefault } from '@typescript-eslint/experimental-utils/dist/eslint-utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import { ESLintUtils } from '@typescript-eslint/experimental-utils';

/**
* We need to patch the RuleCreator in order to preserve the defaultOptions
Expand All @@ -23,7 +19,7 @@ const patchedRuleCreator: typeof ESLintUtils.RuleCreator = (urlCreator) => {
}),
defaultOptions,
create(context) {
const optionsWithDefault = applyDefault(
const optionsWithDefault = ESLintUtils.applyDefault(
defaultOptions,
context.options,
);
Expand All @@ -35,7 +31,7 @@ const patchedRuleCreator: typeof ESLintUtils.RuleCreator = (urlCreator) => {

export const createESLintRule = patchedRuleCreator(
(ruleName) =>
`https://github.com/angular-eslint/angular-eslint/blob/master/packages/eslint-plugin/docs/rules/${ruleName}.md`,
`https://github.com/angular-eslint/angular-eslint/blob/master/packages/eslint-plugin-template/docs/rules/${ruleName}.md`,
);

interface ParserServices {
Expand Down
7 changes: 3 additions & 4 deletions packages/eslint-plugin/src/utils/create-eslint-rule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ESLintUtils } from '@typescript-eslint/experimental-utils';
import { applyDefault } from '@typescript-eslint/experimental-utils/dist/eslint-utils';
import { ESLintUtils } from '@typescript-eslint/experimental-utils';

/**
* We need to patch the RuleCreator in order to preserve the defaultOptions
Expand All @@ -15,7 +14,7 @@ const patchedRuleCreator: typeof ESLintUtils.RuleCreator = (urlCreator) => {
}),
defaultOptions,
create(context) {
const optionsWithDefault = applyDefault(
const optionsWithDefault = ESLintUtils.applyDefault(
defaultOptions,
context.options,
);
Expand All @@ -27,5 +26,5 @@ const patchedRuleCreator: typeof ESLintUtils.RuleCreator = (urlCreator) => {

export const createESLintRule = patchedRuleCreator(
(ruleName) =>
`https://github.com/angular-eslint/angular-eslint/blob/master/packages/eslint-plugin-template/docs/rules/${ruleName}.md`,
`https://github.com/angular-eslint/angular-eslint/blob/master/packages/eslint-plugin/docs/rules/${ruleName}.md`,
);

0 comments on commit 94f6e21

Please sign in to comment.