logoESLint React
Rules

id-name

Full Name in @eslint-react/eslint-plugin

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

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

react-naming-convention/id-name

Presets

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

Description

Enforces identifier names assigned from useId calls to be either id or end with Id.

Examples

Failing

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'.

Passing

const id = useId();
const inputId = useId();
const dialogTitleId = useId();

Implementation

Further Reading

On this page