pub struct NoRegexpInRenderRule { /* private fields */ }Expand description
Flags new RegExp() calls inside React component function bodies.
Creating a RegExp inside a component body means it’s re-compiled on every
render. The rule checks that the new RegExp() call is inside a component
function and NOT at module scope, and not inside useMemo/useCallback.
Implementations§
Source§impl NoRegexpInRenderRule
impl NoRegexpInRenderRule
pub fn new(config: &RuleConfig) -> Result<Self, RuleBuildError>
Trait Implementations§
Source§impl Rule for NoRegexpInRenderRule
impl Rule for NoRegexpInRenderRule
Auto Trait Implementations§
impl Freeze for NoRegexpInRenderRule
impl RefUnwindSafe for NoRegexpInRenderRule
impl Send for NoRegexpInRenderRule
impl Sync for NoRegexpInRenderRule
impl Unpin for NoRegexpInRenderRule
impl UnsafeUnpin for NoRegexpInRenderRule
impl UnwindSafe for NoRegexpInRenderRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more