Package com.google.javascript.jscomp
Class ConformanceRules.AbstractRule
java.lang.Object
com.google.javascript.jscomp.ConformanceRules.AbstractRule
- All Implemented Interfaces:
CheckConformance.Rule
- Direct Known Subclasses:
ConformanceRules.BanCreateDom,ConformanceRules.BanCreateElement,ConformanceRules.BanElementSetAttribute,ConformanceRules.BanExecCommand,ConformanceRules.BanForOf,ConformanceRules.BanGlobalVars,ConformanceRules.BannedEnhance,ConformanceRules.BannedModsRegex,ConformanceRules.BanNonLiteralArgsToGoogStringConstFrom,ConformanceRules.BanNullDeref,ConformanceRules.BanSettingAttributes,ConformanceRules.BanStaticThis,ConformanceRules.BanThrowOfNonErrorTypes,ConformanceRules.BanUnknownDirectThisPropsReferences,ConformanceRules.BanUnknownThis,ConformanceRules.BanUnknownTypedClassPropsReferences,ConformanceRules.BanUnresolvedType,ConformanceRules.RequireUseStrict,ConformanceRules.StrictBanUnresolvedType
- Enclosing class:
ConformanceRules
public abstract static class ConformanceRules.AbstractRule
extends Object
implements CheckConformance.Rule
A conformance rule implementation to support things common to all rules such as allowlisting
and reporting.
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractRule(AbstractCompiler compiler, com.google.javascript.jscomp.Requirement requirement) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidcheck(NodeTraversal t, Node n) Perform conformance checkprotected abstract ConformanceRules.ConformanceResultprotected voidreport(Node n, ConformanceRules.ConformanceResult result) Report a conformance warning for the given node.protected booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.javascript.jscomp.CheckConformance.Rule
getPrecondition
-
Constructor Details
-
AbstractRule
public AbstractRule(AbstractCompiler compiler, com.google.javascript.jscomp.Requirement requirement) throws CheckConformance.InvalidRequirementSpec
-
-
Method Details
-
tsIsAllowlisted
protected boolean tsIsAllowlisted() -
checkConformance
- Returns:
- Whether the code represented by the Node conforms to the rule.
-
check
Description copied from interface:CheckConformance.RulePerform conformance check- Specified by:
checkin interfaceCheckConformance.Rule
-
report
Report a conformance warning for the given node.- Parameters:
n- The node representing the violating code.result- The result representing the confidence of the violation.
-