Skip to content

Commit f1e7963

Browse files
committed
Remove superfluous raw fields
1 parent 1a26c9f commit f1e7963

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

index.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,7 @@ function element(node, context) {
154154
shorthand: false,
155155
computed: false,
156156
key: {type: 'Identifier', name: cssProp},
157-
value: {
158-
type: 'Literal',
159-
value: String(value[cssProp]),
160-
raw: JSON.stringify(String(value[cssProp]))
161-
},
157+
value: {type: 'Literal', value: String(value[cssProp])},
162158
kind: 'init'
163159
})
164160
}
@@ -168,11 +164,7 @@ function element(node, context) {
168164
expression: {type: 'ObjectExpression', properties: cssProperties}
169165
}
170166
} else {
171-
value = {
172-
type: 'Literal',
173-
value: String(value),
174-
raw: JSON.stringify(String(value))
175-
}
167+
value = {type: 'Literal', value: String(value)}
176168
}
177169

178170
attributes.push({
@@ -276,11 +268,7 @@ function mdxJsxElement(node, context) {
276268
}
277269
// Anything else.
278270
else {
279-
value = {
280-
type: 'Literal',
281-
value: String(value),
282-
raw: JSON.stringify(String(value))
283-
}
271+
value = {type: 'Literal', value: String(value)}
284272
}
285273

286274
attributes.push(
@@ -390,11 +378,7 @@ function text(node) {
390378

391379
return create(node, {
392380
type: 'JSXExpressionContainer',
393-
expression: inherit(node, {
394-
type: 'Literal',
395-
value: value,
396-
raw: JSON.stringify(value)
397-
})
381+
expression: inherit(node, {type: 'Literal', value: value})
398382
})
399383
}
400384

test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,7 @@ function acornClean(node) {
10011001
return JSON.parse(JSON.stringify(node))
10021002

10031003
function enter(node) {
1004+
delete node.raw
10041005
delete node.start
10051006
delete node.end
10061007
}

0 commit comments

Comments
 (0)