Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] no-invalid-html-attribute: sort HTML_ELEMENTS and messages #3182

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
* [readme] Some grammar fixes ([#3186][] @JJ)
* [Docs] [`jsx-no-target-blank`]: Improve readme ([#3169][] @apepper)
* [Docs] [`display-name`]: improve examples ([#3189][] @golopot)
* [Refactor] [`no-invalid-html-attribute`]: sort HTML_ELEMENTS and messages ([#3182][] @Primajin)

[#3190]: https://github.com/yannickcr/eslint-plugin-react/pull/3190
[#3189]: https://github.com/yannickcr/eslint-plugin-react/pull/3189
[#3186]: https://github.com/yannickcr/eslint-plugin-react/pull/3186
[#3182]: https://github.com/yannickcr/eslint-plugin-react/pull/3182
[#3174]: https://github.com/yannickcr/eslint-plugin-react/pull/3174
[#3169]: https://github.com/yannickcr/eslint-plugin-react/pull/3169
[#3167]: https://github.com/yannickcr/eslint-plugin-react/pull/3167
Expand Down
224 changes: 112 additions & 112 deletions lib/rules/no-invalid-html-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,147 +70,147 @@ const VALID_PAIR_VALUES = new Map([
* @type {Set<string>}
*/
const HTML_ELEMENTS = new Set([
'html',
'base',
'head',
'link',
'meta',
'style',
'title',
'body',
'a',
'abbr',
'acronym',
'address',
'applet',
'area',
'article',
'aside',
'footer',
'header',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'main',
'nav',
'section',
'blockquote',
'dd',
'div',
'dl',
'dt',
'figcaption',
'figure',
'hr',
'li',
'ol',
'p',
'pre',
'ul',
'a',
'abbr',
'audio',
'b',
'base',
'basefont',
'bdi',
'bdo',
'bgsound',
'big',
'blink',
'blockquote',
'body',
'br',
'button',
'canvas',
'caption',
'center',
'cite',
'code',
'col',
'colgroup',
'content',
'data',
'datalist',
'dd',
'del',
'details',
'dfn',
'dialog',
'dir',
'div',
'dl',
'dt',
'em',
'embed',
'fieldset',
'figcaption',
'figure',
'font',
'footer',
'form',
'frame',
'frameset',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'head',
'header',
'hgroup',
'hr',
'html',
'i',
'iframe',
'image',
'img',
'input',
'ins',
'kbd',
'keygen',
'label',
'legend',
'li',
'link',
'main',
'map',
'mark',
'marquee',
'math',
'menu',
'menuitem',
'meta',
'meter',
'nav',
'nobr',
'noembed',
'noframes',
'noscript',
'object',
'ol',
'optgroup',
'option',
'output',
'p',
'param',
'picture',
'plaintext',
'portal',
'pre',
'progress',
'q',
'rb',
'rp',
'rt',
'rtc',
'ruby',
's',
'samp',
'script',
'section',
'select',
'shadow',
'slot',
'small',
'source',
'spacer',
'span',
'strike',
'strong',
'style',
'sub',
'summary',
'sup',
'time',
'u',
'var',
'wbr',
'area',
'audio',
'img',
'map',
'track',
'video',
'embed',
'iframe',
'object',
'param',
'picture',
'portal',
'source',
'svg',
'math',
'canvas',
'noscript',
'script',
'del',
'ins',
'caption',
'col',
'colgroup',
'table',
'tbody',
'td',
'template',
'textarea',
'tfoot',
'th',
'thead',
'time',
'title',
'tr',
'button',
'datalist',
'fieldset',
'form',
'input',
'label',
'legend',
'meter',
'optgroup',
'option',
'output',
'progress',
'select',
'textarea',
'details',
'dialog',
'menu',
'summary',
'slot',
'template',
'acronym',
'applet',
'basefont',
'bgsound',
'big',
'blink',
'center',
'content',
'dir',
'font',
'frame',
'frameset',
'hgroup',
'image',
'keygen',
'marquee',
'menuitem',
'nobr',
'noembed',
'noframes',
'plaintext',
'rb',
'rtc',
'shadow',
'spacer',
'strike',
'track',
'tt',
'u',
'ul',
'var',
'video',
'wbr',
'xmp',
]);

Expand All @@ -222,16 +222,16 @@ const COMPONENT_ATTRIBUTE_MAP = new Map();
COMPONENT_ATTRIBUTE_MAP.set('rel', new Set(['link', 'a', 'area', 'form']));

const messages = {
onlyStrings: '“{{attributeName}}” attribute only supports strings.',
noEmpty: 'An empty “{{attributeName}}” attribute is meaningless.',
emptyIsMeaningless: 'An empty “{{attributeName}}” attribute is meaningless.',
neverValid: '“{{reportingValue}}” is never a valid “{{attributeName}}” attribute value.',
notValidFor: '“{{reportingValue}}” is not a valid “{{attributeName}}” attribute value for <{{elementName}}>.',
spaceDelimited: '”{{attributeName}}“ attribute values should be space delimited.',
noEmpty: 'An empty “{{attributeName}}” attribute is meaningless.',
noMethod: 'The ”{{attributeName}}“ attribute cannot be a method.',
onlyMeaningfulFor: 'The ”{{attributeName}}“ attribute only has meaning on the tags: {{tagNames}}',
emptyIsMeaningless: 'An empty “{{attributeName}}” attribute is meaningless.',
notAlone: '“{{reportingValue}}” must be directly followed by “{{missingValue}}”.',
notPaired: '“{{reportingValue}}” can not be directly followed by “{{secondValue}}” without “{{missingValue}}”.',
notValidFor: '“{{reportingValue}}” is not a valid “{{attributeName}}” attribute value for <{{elementName}}>.',
onlyMeaningfulFor: 'The ”{{attributeName}}“ attribute only has meaning on the tags: {{tagNames}}',
onlyStrings: '“{{attributeName}}” attribute only supports strings.',
spaceDelimited: '”{{attributeName}}“ attribute values should be space delimited.',
};

function splitIntoRangedParts(node, regex) {
Expand Down