Skip to content

Commit 2cf0917

Browse files
committed
[Fix] no-unknown-property add defaultChecked accepted property
1 parent f6fe7b8 commit 2cf0917

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/rules/no-unknown-property.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
211211
'autoCorrect', // https://stackoverflow.com/questions/47985384/html-autocorrect-for-text-input-is-not-working
212212
'autoSave', // https://stackoverflow.com/questions/25456396/what-is-autosave-attribute-supposed-to-do-how-do-i-use-it
213213
// React specific attributes https://reactjs.org/docs/dom-elements.html#differences-in-attributes
214-
'className', 'dangerouslySetInnerHTML', 'defaultValue', 'htmlFor', 'onChange', 'suppressContentEditableWarning', 'suppressHydrationWarning',
214+
'className', 'dangerouslySetInnerHTML', 'defaultValue', 'defaultChecked', 'htmlFor', 'onChange', 'suppressContentEditableWarning', 'suppressHydrationWarning',
215215
];
216216

217217
const DOM_PROPERTIES_IGNORE_CASE = ['charset'];

tests/lib/rules/no-unknown-property.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ ruleTester.run('no-unknown-property', rule, {
5555
{ code: '<input type="checkbox" checked={checked} disabled={disabled} id={id} onChange={onChange} />' },
5656
// React related attributes
5757
{ code: '<div onPointerDown={this.onDown} onPointerUp={this.onUp} />' },
58+
{ code: '<input type="checkbox" defaultChecked={this.state.checkbox} />' },
5859
// Case ignored attributes, for `charset` discussion see https://github.com/jsx-eslint/eslint-plugin-react/pull/1863
5960
{ code: '<meta charset="utf-8" />;' },
6061
{ code: '<meta charSet="utf-8" />;' },

0 commit comments

Comments
 (0)