Skip to content

Commit 0131302

Browse files
committed
remove unused code
1 parent 55806c6 commit 0131302

3 files changed

Lines changed: 22 additions & 60 deletions

File tree

packages/prettyhtml-formatter/index.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const voids = require('html-void-elements')
1212
const find = require('unist-util-find')
1313
const toString = require('hast-util-to-string')
1414
const prettier = require('prettier')
15-
const propInfo = require('property-information')
1615
const expressionParser = require('@starptech/expression-parser')
1716

1817
module.exports = format
@@ -280,48 +279,6 @@ function startsWithNewline(node) {
280279
return is('text', node) && node.value && /^\s*\n/.test(node.value)
281280
}
282281

283-
function cleanAttributeExpression(name, value) {
284-
// Some properties are handles as a list for easier accessibility
285-
if (Array.isArray(value)) {
286-
// Don't add space between template expession when we
287-
// deal with comma separated props otherwise it will fail
288-
if (
289-
propInfo.find(propInfo.html, name).commaSeparated ||
290-
propInfo.find(propInfo.svg, name).commaSeparated
291-
) {
292-
return cleanAttributeExpressionValue(value.join(space), false).split(
293-
space
294-
)
295-
}
296-
return cleanAttributeExpressionValue(value.join(space), true).split(space)
297-
}
298-
return cleanAttributeExpressionValue(value, true)
299-
}
300-
301-
function cleanAttributeExpressionValue(value, spaceSaparated) {
302-
const brackets = checkForTemplateExpression(value)
303-
if (brackets) {
304-
const result = expressionParser(value, {
305-
brackets
306-
})
307-
for (const expr of result.expressions) {
308-
let exprResult = ''
309-
if (spaceSaparated) {
310-
exprResult =
311-
brackets[0] + space + expr.text.trim() + space + brackets[1]
312-
} else {
313-
exprResult = brackets[0] + expr.text.trim() + brackets[1]
314-
}
315-
value = replaceRange(value, expr.start, expr.end, exprResult)
316-
}
317-
}
318-
return value
319-
}
320-
321-
function replaceRange(s, start, end, substitute) {
322-
return s.slice(0, start) + substitute + s.slice(end)
323-
}
324-
325282
function handleTemplateExpression(child, children) {
326283
const brackets = checkForTemplateExpression(child.value)
327284
if (brackets) {

packages/prettyhtml-formatter/package-lock.json

Lines changed: 22 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/prettyhtml-formatter/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"html-whitespace-sensitive-tag-names": "^1.0.0",
4141
"is-hidden": "^1.1.1",
4242
"prettier": "^1.15.3",
43-
"property-information": "^5.0.1",
4443
"repeat-string": "^1.6.1",
4544
"to-vfile": "^5.0.1",
4645
"unified": "^7.0.0",

0 commit comments

Comments
 (0)