Skip to content

Commit

Permalink
chore: add suggestion property to relevant rules
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jun 20, 2020
1 parent 4973139 commit f67f56f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import { join, parse } from 'path';
import globals from './globals.json';
import * as snapshotProcessor from './processors/snapshot-processor';

// can be removed once we've on v3: https://github.com/typescript-eslint/typescript-eslint/issues/2060
declare module '@typescript-eslint/experimental-utils/dist/ts-eslint/Rule' {
export interface RuleMetaDataDocs {
suggestion?: boolean;
}
}

// copied from https://github.com/babel/babel/blob/d8da63c929f2d28c401571e2a43166678c555bc4/packages/babel-helpers/src/helpers.js#L602-L606
/* istanbul ignore next */
const interopRequireDefault = (obj: any): { default: any } =>
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-test-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ export default createRule({
category: 'Best Practices',
description: 'Avoid using a callback in asynchronous tests',
recommended: false,
suggestion: true,
},
messages: {
illegalTestCallback: 'Illegal usage of test callback',
suggestWrappingInPromise: 'Wrap in `new Promise({{ callback }} => ...`',
useAwaitInsteadOfCallback:
'Use await instead of callback in async functions',
},
fixable: 'code',
schema: [],
type: 'suggestion',
},
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 @@ -69,6 +69,7 @@ export default createRule<[], MessageIds>({
description:
'Suggest using `expect.assertions()` OR `expect.hasAssertions()`',
recommended: false,
suggestion: true,
},
messages: {
hasAssertionsTakesNoArguments:
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-strict-equal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export default createRule({
category: 'Best Practices',
description: 'Suggest using toStrictEqual()',
recommended: false,
suggestion: true,
},
messages: {
useToStrictEqual: 'Use `toStrictEqual()` instead',
suggestReplaceWithStrictEqual: 'Replace with `toStrictEqual()`',
},
fixable: 'code',
type: 'suggestion',
schema: [],
},
Expand Down

0 comments on commit f67f56f

Please sign in to comment.