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: mark rules that suggest fixes with hasSuggestion for ESLint v8 #898

Merged
merged 1 commit into from
Sep 17, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ declare module '@typescript-eslint/experimental-utils/dist/ts-eslint/Rule' {
export interface RuleMetaDataDocs {
suggestion?: boolean;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export interface RuleMetaData<TMessageIds extends string> {
hasSuggestion?: boolean;
}
}

// copied from https://github.com/babel/babel/blob/d8da63c929f2d28c401571e2a43166678c555bc4/packages/babel-helpers/src/helpers.js#L602-L606
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-done-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default createRule({
},
schema: [],
type: 'suggestion',
hasSuggestion: true,
},
defaultOptions: [],
create(context) {
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-focused-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default createRule({
},
schema: [],
type: 'suggestion',
hasSuggestion: true,
},
defaultOptions: [],
create: context => ({
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-expect-assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default createRule<[RuleOptions], MessageIds>({
suggestRemovingExtraArguments: 'Remove extra arguments',
},
type: 'suggestion',
hasSuggestion: true,
schema: [
{
type: 'object',
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-strict-equal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default createRule({
},
type: 'suggestion',
schema: [],
hasSuggestion: true,
},
defaultOptions: [],
create(context) {
Expand Down
2 changes: 1 addition & 1 deletion tools/regenerate-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const details: RuleDetails[] = Object.keys(config.configs.all.rules)
description: rule.meta.docs.description,
fixable: rule.meta.fixable
? 'fixable'
: rule.meta.docs.suggestion
: rule.meta.hasSuggestion
? 'suggest'
: false,
requiresTypeChecking: rule.meta.docs.requiresTypeChecking ?? false,
Expand Down