Skip to content

Commit

Permalink
fix: mark rules that suggest fixes with hasSuggestion for ESLint v8 (
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Sep 17, 2021
1 parent 34b23e6 commit ec0a21b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/index.ts
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
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
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
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
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
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

0 comments on commit ec0a21b

Please sign in to comment.