# Token utilities
# isArrowToken / isNotArrowToken
utils.isArrowToken(token);
utils.isNotArrowToken(token);
Check whether a given token is a =>
token or not.
# Examples
const { isArrowToken } = require("eslint-utils")
module.exports = {
meta: {},
create(context) {
const sourceCode = context.getSourceCode()
return {
ArrowFunctionExpression(node) {
const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken)
},
}
},
}
# isClosingBraceToken / isNotClosingBraceToken
utils.isClosingBraceToken(token);
utils.isNotClosingBraceToken(token);
Check whether a given token is a }
token or not.
# isClosingBracketToken / isNotClosingBracketToken
utils.isClosingBracketToken(token);
utils.isNotClosingBracketToken(token);
Check whether a given token is a ]
token or not.
# isClosingParenToken / isNotClosingParenToken
utils.isClosingParenToken(token);
utils.isNotClosingParenToken(token);
Check whether a given token is a )
token or not.
# isColonToken / isNotColonToken
utils.isColonToken(token);
utils.isNotColonToken(token);
Check whether a given token is a :
token or not.
# isCommaToken / isNotCommaToken
utils.isCommaToken(token);
utils.isNotCommaToken(token);
Check whether a given token is a ,
token or not.
# isCommentToken / isNotCommentToken
utils.isCommentToken(token);
utils.isNotCommentToken(token);
Check whether a given token is a comment token or not.
# isOpeningBraceToken / isNotOpeningBraceToken
utils.isOpeningBraceToken(token);
utils.isNotOpeningBraceToken(token);
Check whether a given token is a {
token or not.
# isOpeningBracketToken / isNotOpeningBracketToken
utils.isOpeningBracketToken(token);
utils.isNotOpeningBracketToken(token);
Check whether a given token is a [
token or not.
# isOpeningParenToken / isNotOpeningParenToken
utils.isOpeningParenToken(token);
utils.isNotOpeningParenToken(token);
Check whether a given token is a (
token or not.
# isSemicolonToken / isNotSemicolonToken
utils.isSemicolonToken(token);
utils.isNotSemicolonToken(token);
Check whether a given token is a ;
token or not.