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

Make an exception for some SVG attributes in vue/attribute-hyphenation #1483

Closed
rgaudy opened this issue May 2, 2021 · 1 comment
Closed

Comments

@rgaudy
Copy link
Contributor

rgaudy commented May 2, 2021

What rule do you want to change?
vue/attribute-hyphenation

Does this change cause the rule to produce more or fewer warnings?
This produces fewer warnings.

How will the change be implemented? (New option, new default behavior, etc.)?
The list of ignored attributes (currently ['data-', 'aria-', 'slot-scope']) is extended with all mixed case SVG attributes, extracted from this list.

Please provide some example code that this change will affect:

<mask
  id="mask"
  maskUnits="userSpaceOnUse"
  v-bind="dimensions"
>
...
</mask>

What does the rule currently do for this code?
It generates the warning Attribute 'maskUnits' should be hyphenated.

What will the rule do after it's changed?
It will not generate the warning anymore.

Additional context

I extracted the list of the attributes :

[
          "attributeName",
          "attributeType",
          "baseFrequency",
          "baseProfile",
          "calcMode",
          "clipPathUnits",
          "contentScriptType",
          "contentStyleType",
          "diffuseConstant",
          "edgeMode",
          "externalResourcesRequired",
          "filterRes",
          "filterUnits",
          "glyphRef",
          "gradientTransform",
          "gradientUnits",
          "kernelMatrix",
          "kernelUnitLength",
          "keyPoints",
          "keySplines",
          "keyTimes",
          "lengthAdjust",
          "limitingConeAngle",
          "markerHeight",
          "markerUnits",
          "markerWidth",
          "maskContentUnits",
          "maskUnits",
          "numOctaves",
          "pathLength",
          "patternContentUnits",
          "patternTransform",
          "patternUnits",
          "pointsAtX",
          "pointsAtY",
          "pointsAtZ",
          "preserveAlpha",
          "preserveAspectRatio",
          "primitiveUnits",
          "referrerPolicy",
          "refX",
          "refY",
          "repeatCount",
          "repeatDur",
          "requiredExtensions",
          "requiredFeatures",
          "specularConstant",
          "specularExponent",
          "spreadMethod",
          "startOffset",
          "stdDeviation",
          "stitchTiles",
          "surfaceScale",
          "systemLanguage",
          "tableValues",
          "targetX",
          "targetY",
          "textLength",
          "viewBox",
          "viewTarget",
          "xChannelSelector",
          "yChannelSelector",
          "zoomAndPan"
        ]
@rgaudy
Copy link
Contributor Author

rgaudy commented May 2, 2021

I just noticed something : if the configuration is set to only use camel case names, then the hyphenated SVG attributes will also trigger an incorrect warning. So in fact all the SVG attributes with an upper case letter, or an hyphen should be an exception for this rule.

[
  "accent-height",
  "alignment-baseline",
  "arabic-form",
  "attributeName",
  "attributeType",
  "baseFrequency",
  "baseline-shift",
  "baseProfile",
  "calcMode",
  "cap-height",
  "clipPathUnits",
  "clip-path",
  "clip-rule",
  "color-interpolation",
  "color-interpolation-filters",
  "color-profile",
  "color-rendering",
  "contentScriptType",
  "contentStyleType",
  "diffuseConstant",
  "dominant-baseline",
  "edgeMode",
  "enable-background",
  "externalResourcesRequired",
  "fill-opacity",
  "fill-rule",
  "filterRes",
  "filterUnits",
  "flood-color",
  "flood-opacity",
  "font-family",
  "font-size",
  "font-size-adjust",
  "font-stretch",
  "font-style",
  "font-variant",
  "font-weight",
  "glyph-name",
  "glyph-orientation-horizontal",
  "glyph-orientation-vertical",
  "glyphRef",
  "gradientTransform",
  "gradientUnits",
  "horiz-adv-x",
  "horiz-origin-x",
  "image-rendering",
  "kernelMatrix",
  "kernelUnitLength",
  "keyPoints",
  "keySplines",
  "keyTimes",
  "lengthAdjust",
  "letter-spacing",
  "lighting-color",
  "limitingConeAngle",
  "marker-end",
  "marker-mid",
  "marker-start",
  "markerHeight",
  "markerUnits",
  "markerWidth",
  "maskContentUnits",
  "maskUnits",
  "numOctaves",
  "overline-position",
  "overline-thickness",
  "panose-1",
  "paint-order",
  "pathLength",
  "patternContentUnits",
  "patternTransform",
  "patternUnits",
  "pointer-events",
  "pointsAtX",
  "pointsAtY",
  "pointsAtZ",
  "preserveAlpha",
  "preserveAspectRatio",
  "primitiveUnits",
  "referrerPolicy",
  "refX",
  "refY",
  "rendering-intent",
  "repeatCount",
  "repeatDur",
  "requiredExtensions",
  "requiredFeatures",
  "shape-rendering",
  "specularConstant",
  "specularExponent",
  "spreadMethod",
  "startOffset",
  "stdDeviation",
  "stitchTiles",
  "stop-color",
  "stop-opacity",
  "strikethrough-position",
  "strikethrough-thickness",
  "stroke-dasharray",
  "stroke-dashoffset",
  "stroke-linecap",
  "stroke-linejoin",
  "stroke-miterlimit",
  "stroke-opacity",
  "stroke-width",
  "surfaceScale",
  "systemLanguage",
  "tableValues",
  "targetX",
  "targetY",
  "text-anchor",
  "text-decoration",
  "text-rendering",
  "textLength",
  "transform-origin",
  "underline-position",
  "underline-thickness",
  "unicode-bidi",
  "unicode-range",
  "units-per-em",
  "v-alphabetic",
  "v-hanging",
  "v-ideographic",
  "v-mathematical",
  "vector-effect",
  "vert-adv-y",
  "vert-origin-x",
  "vert-origin-y",
  "viewBox",
  "viewTarget",
  "word-spacing",
  "writing-mode",
  "x-height",
  "xChannelSelector",
  "yChannelSelector",
  "zoomAndPan"
]

rgaudy pushed a commit to rgaudy/eslint-plugin-vue that referenced this issue May 2, 2021
ota-meshi pushed a commit that referenced this issue May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants