Skip to content

Commit

Permalink
Merge pull request #164 from mkenyon/no-unknown-event-handlers
Browse files Browse the repository at this point in the history
Add event handlers to no-unknown-property
  • Loading branch information
yannickcr committed Jul 27, 2015
2 parents 3556264 + 8704c65 commit b1a7b0c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ var DOM_PROPERTY_NAMES = [
'cellPadding', 'cellSpacing', 'charSet', 'classID', 'className', 'colSpan', 'contentEditable', 'contextMenu',
'crossOrigin', 'dateTime', 'encType', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget',
'frameBorder', 'hrefLang', 'htmlFor', 'httpEquiv', 'marginHeight', 'marginWidth', 'maxLength', 'mediaGroup',
'noValidate', 'radioGroup', 'readOnly', 'rowSpan', 'spellCheck', 'srcDoc', 'srcSet', 'tabIndex', 'useMap',
'noValidate', 'onBlur', 'onChange', 'onClick', 'onContextMenu', 'onCopy', 'onCut', 'onDoubleClick',
'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop',
'onFocus', 'onInput', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onMouseDown', 'onMouseEnter', 'onMouseLeave',
'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onPaste', 'onScroll', 'onSubmit', 'onTouchCancel',
'onTouchEnd', 'onTouchMove', 'onTouchStart', 'onWheel',
'radioGroup', 'readOnly', 'rowSpan', 'spellCheck', 'srcDoc', 'srcSet', 'tabIndex', 'useMap',
'itemProp', 'itemScope', 'itemType', 'itemRef', 'itemID'
];

Expand Down
8 changes: 8 additions & 0 deletions tests/lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ eslintTester.addRuleTest('lib/rules/no-unknown-property', {
}, {
code: '<div accesskey="bar"></div>;',
errors: [{message: 'Unknown property \'accesskey\' found, use \'accessKey\' instead'}],
ecmaFeatures: {jsx: true}
}, {
code: '<div onclick="bar"></div>;',
errors: [{message: 'Unknown property \'onclick\' found, use \'onClick\' instead'}],
ecmaFeatures: {jsx: true}
}, {
code: '<div onmousedown="bar"></div>;',
errors: [{message: 'Unknown property \'onmousedown\' found, use \'onMouseDown\' instead'}],
ecmaFeatures: {jsx: true}}
]
});

0 comments on commit b1a7b0c

Please sign in to comment.