Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alethes committed Mar 24, 2017
1 parent 6e1769e commit 5435411
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"ava": "^0.17.0",
"babel-cli": "^6.18.0",
"babel-core": "^6.21.0",
"babel-generator": "^6.24.0",
"babel-plugin-transform-async-to-generator": "^6.16.0",
"babel-plugin-transform-es2015-destructuring": "^6.19.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.18.0",
Expand All @@ -45,10 +46,10 @@
"dependencies": {
"babel-traverse": "^6.21.0",
"babylon": "^6.14.1",
"deasync": "^0.1.9",
"postcss": "^5.2.8",
"postcss-load-plugins": "^2.2.0",
"styled-jsx": "^0.4.0",
"deasync": "^0.1.9"
"styled-jsx": "^0.4.0"
},
"ava": {
"require": [
Expand Down
25 changes: 4 additions & 21 deletions src/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ export default function ({types: t}) {
}
}

let source = ""
let source = ''
const replacements = []
node.expressions.forEach((e, i) => {
let r = `___styledjsxexpression${i}___`
const r = `___styledjsxexpression${i}___`
source += node.quasis[i].value.cooked + r
replacements.push({
replacement: r,
initial: `$\{${generate(e).code}}`
});
});
})
})
source += node.quasis[node.quasis.length - 1].value.cooked

return {
Expand Down Expand Up @@ -134,23 +134,6 @@ export default function ({types: t}) {
}
}

function getPlaceholders(expressions) {
return expressions.map((e, id) => ({
replacement: `___styledjsxexpression${id}___`,
initial: `$\{${e.getSource()}}`
})).sort((a, b) => a.initial.length < b.initial.length)
}

function addPlaceholders(replacements, src) {
return replacements.reduce((src, currentReplacement) => {
src = src.replace(
currentReplacement.initial,
currentReplacement.replacement
)
return src
}, src)
}

function replacePlaceholders(replacements, src) {
return replacements.reduce((src, currentReplacement) => {
src = src.replace(
Expand Down

0 comments on commit 5435411

Please sign in to comment.