/
githubmirror
/
vuetify
Обзор
Документация
Войти
/
githubmirror
/
vuetify
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
scripts/rules/jsx-prop-casing.js
34 строки
1 KB
Kael
chore: enforce JSX prop casing
09 июл 2025, 10:45
09 июл 2025, 10:45
a8716c0
Код
Авторство
О чём код?
import { camelCase } from 'lodash-es' const hyphenatedRe = /\w-\w/g // eslint-disable-next-line max-len const svgTags = new Set(['svg', 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'defs', 'desc', 'ellipse', 'filter', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'switch', 'symbol', 'text', 'textPath', 'tspan', 'use', 'view']) export default { meta: { fixable: 'code', }, create (context) { return { JSXAttribute (node) { const name = node.name.name if ( !hyphenatedRe.test(name) || name.startsWith('v-') || name.startsWith('aria-') || name.startsWith('data-') || svgTags.has(node.parent.name.name) ) return context.report({ node, message: 'JSX props should be camelCase', fix (fixer) { return fixer.replaceText(node.name, camelCase(name)) }, }) }, } }, }