How to use the tslint.hasModifier function in tslint

To help you get started, we’ve selected a few tslint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / dtslint / bin / rules / strictExportDeclareModifiersRule.js View on Github external
function isDeclare(node) {
    return Lint.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword);
}
function isExport(node) {
github 0xProject / 0x-monorepo / packages / tslint-config / rules / underscorePrivateAndProtectedRule.ts View on Github external
function memberIsPrivate(node: ts.Declaration): boolean {
    return Lint.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword, ts.SyntaxKind.ProtectedKeyword);
}
function nameIsIdentifier(node: ts.Node): node is ts.Identifier {
github microsoft / dtslint / src / rules / strictExportDeclareModifiersRule.ts View on Github external
function isExport(node: ts.Node): boolean {
    return Lint.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword);
}
github microsoft / dtslint / src / rules / strictExportDeclareModifiersRule.ts View on Github external
function isDeclare(node: ts.Node): boolean {
    return Lint.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword);
}
github buzinas / tslint-eslint-rules / src / rules / validJsdocRule.ts View on Github external
if (!tag.description && OPTIONS.requireParamDescription) {
            this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingParameterDescription(tag.name)));
          }

          if (params[tag.name]) {
            this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.duplicateParameter(tag.name)));
          }
          else if (tag.name.indexOf('.') === -1) {
            params[tag.name] = true;
          }
          break;
        case 'return':
        case 'returns':
          hasReturns = true;

          isAbstract = Lint.hasModifier(fn.node.modifiers, ts.SyntaxKind.AbstractKeyword);

          if (!isAbstract && !OPTIONS.requireReturn && !fn.returnPresent && tag.type && tag.type.name !== 'void' && tag.type.name !== 'undefined') {
            this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.unexpectedTag(tag.title)));
          }
          else {
            if (!tag.type && OPTIONS.requireReturnType) {
              this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingReturnType));
            }

            if (!this.isValidReturnType(tag) && !tag.description && OPTIONS.requireReturnDescription) {
              this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingReturnDescription));
            }
          }
          break;
        case 'constructor':
        case 'class':
github microsoft / dtslint / src / rules / noPublicRule.ts View on Github external
private check(node: ts.Node) {
		if (node.modifiers && Lint.hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword)) {
			this.addFailureAtNode(node, Rule.FAILURE_STRING);
		}
	}
}