Skip to content

Commit b1a7b0c

Browse files
committed
Merge pull request #164 from mkenyon/no-unknown-event-handlers
Add event handlers to no-unknown-property
2 parents 3556264 + 8704c65 commit b1a7b0c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/rules/no-unknown-property.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ var DOM_PROPERTY_NAMES = [
2222
'cellPadding', 'cellSpacing', 'charSet', 'classID', 'className', 'colSpan', 'contentEditable', 'contextMenu',
2323
'crossOrigin', 'dateTime', 'encType', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget',
2424
'frameBorder', 'hrefLang', 'htmlFor', 'httpEquiv', 'marginHeight', 'marginWidth', 'maxLength', 'mediaGroup',
25-
'noValidate', 'radioGroup', 'readOnly', 'rowSpan', 'spellCheck', 'srcDoc', 'srcSet', 'tabIndex', 'useMap',
25+
'noValidate', 'onBlur', 'onChange', 'onClick', 'onContextMenu', 'onCopy', 'onCut', 'onDoubleClick',
26+
'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop',
27+
'onFocus', 'onInput', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onMouseDown', 'onMouseEnter', 'onMouseLeave',
28+
'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onPaste', 'onScroll', 'onSubmit', 'onTouchCancel',
29+
'onTouchEnd', 'onTouchMove', 'onTouchStart', 'onWheel',
30+
'radioGroup', 'readOnly', 'rowSpan', 'spellCheck', 'srcDoc', 'srcSet', 'tabIndex', 'useMap',
2631
'itemProp', 'itemScope', 'itemType', 'itemRef', 'itemID'
2732
];
2833

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ eslintTester.addRuleTest('lib/rules/no-unknown-property', {
4545
}, {
4646
code: '<div accesskey="bar"></div>;',
4747
errors: [{message: 'Unknown property \'accesskey\' found, use \'accessKey\' instead'}],
48+
ecmaFeatures: {jsx: true}
49+
}, {
50+
code: '<div onclick="bar"></div>;',
51+
errors: [{message: 'Unknown property \'onclick\' found, use \'onClick\' instead'}],
52+
ecmaFeatures: {jsx: true}
53+
}, {
54+
code: '<div onmousedown="bar"></div>;',
55+
errors: [{message: 'Unknown property \'onmousedown\' found, use \'onMouseDown\' instead'}],
4856
ecmaFeatures: {jsx: true}}
4957
]
5058
});

0 commit comments

Comments
 (0)