Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(utils): support immutable arrays in ReportFixFunction #3830

Merged
merged 1 commit into from Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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