regexp()
API > @betterer/regexp > regexp
Use this test to incrementally remove RegExp
matches from your codebase.
Signature
export declare function regexp(pattern: RegExp, issueMessage?: string): BettererFileTest;
Parameters
Parameter | Type | Description |
---|---|---|
pattern | RegExp | A RegExp pattern to match. |
issueMessage | string | A message that describes the issue. Defaults to 'RegExp match'. |
Returns
Exceptions
BettererError
Will throw if the user doesn't pass pattern
.
Remarks
regexp
is a BettererFileTest
, so you can use include()
, exclude()
, only()
, and skip()
.
Example
import { regexp } from '@betterer/regexp';
export default {
'no hack comments': () =>
regexp(/(\/\/\s*HACK)/i)
.include('./src/*.ts')
};