tsquery()
API > @betterer/tsquery > tsquery
Use this test to incrementally remove TSQuery matches from your codebase. See the TSQuery documentation for more details about the query syntax.
Signature
export declare function tsquery(query: string, issueMessage?: string): BettererFileTest;
Parameters
Parameter | Type | Description |
---|---|---|
query | string | A TSQuery query to match. |
issueMessage | string | A message that describes the issue. Defaults to 'TSQuery match'. |
Returns
Exceptions
BettererError
Will throw if the user doesn't pass query
.
Remarks
tsquery
is a BettererFileTest
, so you can use include()
, exclude()
, only()
, and skip()
.
Example
import { tsquery } from '@betterer/tsquery';
export default {
'no raw console.log': () =>
tsquery(
'CallExpression > PropertyAccessExpression[expression.name="console"][name.name="log"]'
)
.include('./src/*.ts')
};