Skip to content

Commit

Permalink
fix(utils): support immutable arrays in ReportFixFunction (#3830)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelss95 committed Sep 3, 2021
1 parent e59a17c commit 8218055
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/eslint-plugin/src/rules/no-explicit-any.ts
@@ -1,9 +1,9 @@
import {
TSESTree,
AST_NODE_TYPES,
TSESLint,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import * as util from '../util';
import { TSESLint } from '@typescript-eslint/experimental-utils';

export type Options = [
{
Expand Down Expand Up @@ -199,8 +199,8 @@ export default util.createRule<Options, MessageIds>({
};

if (fixToUnknown) {
fixOrSuggest.fix = (fixer =>
fixer.replaceText(node, 'unknown')) as TSESLint.ReportFixFunction;
fixOrSuggest.fix = (fixer): TSESLint.RuleFix =>
fixer.replaceText(node, 'unknown');
}

context.report({
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-plugin/src/rules/prefer-enum-initializers.ts
@@ -1,6 +1,5 @@
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
import * as util from '../util';
import { TSESLint } from '@typescript-eslint/experimental-utils';

type MessageIds = 'defineInitializer' | 'defineInitializerSuggestion';

Expand Down
2 changes: 1 addition & 1 deletion packages/experimental-utils/src/ts-eslint/Rule.ts
Expand Up @@ -114,7 +114,7 @@ interface RuleFixer {

type ReportFixFunction = (
fixer: RuleFixer,
) => null | RuleFix | RuleFix[] | IterableIterator<RuleFix>;
) => null | RuleFix | readonly RuleFix[] | IterableIterator<RuleFix>;
type ReportSuggestionArray<TMessageIds extends string> =
ReportDescriptorBase<TMessageIds>[];

Expand Down

0 comments on commit 8218055

Please sign in to comment.