Skip to main content

Rule

Trait Rule 

Source
pub trait Rule: Send + Sync {
    // Required methods
    fn meta(&self) -> &RuleMeta;
    fn run(
        &self,
        program: &Program<'_>,
        semantic: &Semantic<'_>,
        source_text: &str,
    ) -> Vec<RuleFinding>;

    // Provided methods
    fn fix(&self, _finding: &RuleFinding, _source_text: &str) -> Option<Fix> { ... }
    fn has_fix(&self) -> bool { ... }
}

Required Methods§

Source

fn meta(&self) -> &RuleMeta

Source

fn run( &self, program: &Program<'_>, semantic: &Semantic<'_>, source_text: &str, ) -> Vec<RuleFinding>

Provided Methods§

Source

fn fix(&self, _finding: &RuleFinding, _source_text: &str) -> Option<Fix>

If this rule supports auto-fix, return the byte span and replacement text. Default implementation returns None (no fix available).

Source

fn has_fix(&self) -> bool

Whether this rule has auto-fix capability.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Rule for AHasContent

Source§

impl Rule for AriaValid

Source§

impl Rule for ButtonHasType

Source§

impl Rule for ClickEventsHaveKeyEvents

Source§

impl Rule for Complexity

Source§

impl Rule for ConsistentComponentNaming

Source§

impl Rule for ConsistentReturn

Source§

impl Rule for ConsistentTypeImports

Source§

impl Rule for EffectDepsComplete

Source§

impl Rule for ExplicitReturnType

Source§

impl Rule for HeadingLevels

Source§

impl Rule for HookRules

Source§

impl Rule for HtmlHasLang

Source§

impl Rule for ImgAlt

Source§

impl Rule for LabelAssociated

Source§

impl Rule for LazyLoadComponents

Source§

impl Rule for MaxParams

Source§

impl Rule for NoAmbiguousLabels

Source§

impl Rule for NoAny

Source§

impl Rule for NoAutofocus

Source§

impl Rule for NoBindInJsx

Source§

impl Rule for NoCommentedCode

Source§

impl Rule for NoConsole

Source§

impl Rule for NoDangerouslySetInnerHtml

Source§

impl Rule for NoDeepNesting

Source§

impl Rule for NoDirectMutation

Source§

impl Rule for NoDuplicateProps

Source§

impl Rule for NoEmptyBlocks

Source§

impl Rule for NoEmptyInterface

Source§

impl Rule for NoEval

Source§

impl Rule for NoExplicitAny

Source§

impl Rule for NoForwardRef

Source§

impl Rule for NoHardcodedSecrets

Source§

impl Rule for NoHeadElement

Source§

impl Rule for NoHeavyComputationInRender

Source§

impl Rule for NoImgElement

Source§

impl Rule for NoIndexKey

Source§

impl Rule for NoInlineFunctions

Source§

impl Rule for NoInlineStyles

Source§

impl Rule for NoInsecureProtocol

Source§

impl Rule for NoLargeLibraries

Source§

impl Rule for NoLongFunctions

Source§

impl Rule for NoMagicNumbers

Source§

impl Rule for NoMissingKey

Source§

impl Rule for NoMultipleRenderMethods

Source§

impl Rule for NoNonNullAssertion

Source§

impl Rule for NoRefInComponentName

Source§

impl Rule for NoScriptTagInHead

Source§

impl Rule for NoScriptUrl

Source§

impl Rule for NoSetStateInEffect

Source§

impl Rule for NoSetStateInRender

Source§

impl Rule for NoShadow

Source§

impl Rule for NoSideEffectsInRender

Source§

impl Rule for NoSyncScript

Source§

impl Rule for NoTypeAssertion

Source§

impl Rule for NoUnnecessaryMemo

Source§

impl Rule for NoUnsafeIframe

Source§

impl Rule for NoUnsanitizedInput

Source§

impl Rule for NoUnusedVars

Source§

impl Rule for NoVar

Source§

impl Rule for PreferEarlyReturn

Source§

impl Rule for PreferFragments

Source§

impl Rule for PreferFunctionComponents

Source§

impl Rule for PreferInterface

Source§

impl Rule for StrictNullChecks

Source§

impl Rule for TabindexNoPositive