stylelint-taro-rn
Version:
A collection of React Native specific rules for stylelint
1 lines • 2.3 kB
Source Map (JSON)
{"version":3,"file":"index.js","sources":["../../../src/rules/line-height-no-value-without-unit/index.js"],"sourcesContent":["import stylelint from 'stylelint'\nimport declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs'\n\nimport { namespace } from '../../utils/index.js'\n\nexport const ruleName = namespace('line-height-no-value-without-unit')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (height) =>\n `Unexpected line-height \"${height}\", expect a value with units`\n})\n\nconst lengthRe = /^(0$|(?:[+-]?(?:\\d*\\.)?\\d+(?:[Ee][+-]?\\d+)?)(?=px|PX|rem$))/\nconst viewportUnitRe = /^([+-]?[0-9.]+)(vh|vw|vmin|vmax)$/\n\nexport default function (actual) {\n return function (root, result) {\n const validOptions = stylelint.utils.validateOptions(result, ruleName, {\n actual\n })\n\n if (!validOptions) {\n return\n }\n\n root.walkDecls(/^line-height$/i, (decl) => {\n if (lengthRe.test(decl.value) || viewportUnitRe.test(decl.value)) {\n return\n }\n\n const valueOffset = decl.value.indexOf(decl.value)\n const index = declarationValueIndex(decl) + valueOffset\n\n stylelint.utils.report({\n message: messages.rejected(decl.value),\n node: decl,\n result,\n ruleName,\n index\n })\n })\n }\n}\n"],"names":[],"mappings":";;;;MAKa,QAAQ,GAAG,SAAS,CAAC,mCAAmC;AAExD,MAAA,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;IAC7D,QAAQ,EAAE,CAAC,MAAM,KACf,CAAA,wBAAA,EAA2B,MAAM,CAA8B,4BAAA;AAClE,CAAA;AAED,MAAM,QAAQ,GAAG,6DAA6D;AAC9E,MAAM,cAAc,GAAG,mCAAmC;AAE5C,qCAAA,EAAW,MAAM,EAAA;IAC7B,OAAO,UAAU,IAAI,EAAE,MAAM,EAAA;QAC3B,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE;YACrE;AACD,SAAA,CAAC;QAEF,IAAI,CAAC,YAAY,EAAE;YACjB;;QAGF,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC,IAAI,KAAI;AACxC,YAAA,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;gBAChE;;AAGF,YAAA,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAClD,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,GAAG,WAAW;AAEvD,YAAA,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;gBACrB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;AACtC,gBAAA,IAAI,EAAE,IAAI;gBACV,MAAM;gBACN,QAAQ;gBACR;AACD,aAAA,CAAC;AACJ,SAAC,CAAC;AACJ,KAAC;AACH;;;;"}