Rules
id-name
Enforces identifier names assigned from 'useId' calls to be either 'id' or end with 'Id'.
Full Name in eslint-plugin-react-naming-convention
react-naming-convention/id-nameFull Name in @eslint-react/eslint-plugin
@eslint-react/naming-convention-id-namePresets
recommended
recommended-typescript
recommended-type-checked
strict
strict-typescript
strict-type-checked
Rule Details
Enforces identifier names assigned from useId calls to be either id or end with Id.
Common Violations
Invalid
const value = useId();
// ^^^ A variable assigned from `useId()` must be named 'id' or end with 'Id'.const unique = useId();
// ^^^ A variable assigned from `useId()` must be named 'id' or end with 'Id'.const foo = useId();
// ^ A variable assigned from `useId()` must be named 'id' or end with 'Id'.Valid
const id = useId();const inputId = useId();const dialogTitleId = useId();Resources
Further Reading
See Also
react-naming-convention/context-name
Enforces the context name to be a valid component name with the suffixContext.react-naming-convention/ref-name
Enforces identifier names assigned fromuseRefcalls to be eitherrefor end withRef.