logoESLint React
Rules

ref-name

Full Name in @eslint-react/eslint-plugin

@eslint-react/naming-convention/ref-name

Full Name in eslint-plugin-react-naming-convention

react-naming-convention/ref-name

Presets

recommended recommended-typescript recommended-type-checked strict strict-typescript strict-type-checked

Description

Enforces that variables assigned from useRef calls have names ending with Ref.

Examples

Failing

const count = useRef(0);
const input = useRef<HTMLInputElement>(null);
const value = useRef(null);

Passing

const countRef = useRef(0);
const inputRef = useRef<HTMLInputElement>(null);
const valueRef = useRef(null);

Implementation

On this page