不允许使用指定的(即用户在规则中定义的)语法。
// code-linter.json5
{
"rules": {
"@typescript-eslint/no-restricted-syntax": [
"error",
{
"selector": "FunctionExpression",
"message": "Function expressions are not allowed."
},
{
"selector": "CallExpression[callee.name='setTimeout'][arguments.length!=2]",
"message": "setTimeout must always be invoked with two arguments."
}
]
}
} /* eslint no-restricted-syntax: ["error", "ClassDeclaration"] */
export function doSomething() {
console.info('doSomething');
}