Skip to content

Commit 7dc34fa

Browse files
committed
[Dev Deps] update babel-cli, babel-core, babel-preset-airbnb, eslint, eslint-config-airbnb, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react
1 parent 8f7f42b commit 7dc34fa

File tree

3 files changed

+18
-29
lines changed

3 files changed

+18
-29
lines changed

package.json

+10-11
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
"description": "A babel plugin that optimizes and inlines SVGs for your react components.",
55
"main": "lib/index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1",
7+
"test": "npm run tests-only",
88
"pretests-only": "npm run build",
99
"tests-only": "babel-node test/sanity.js",
1010
"build": "babel src --out-dir lib",
1111
"lint": "eslint src/",
1212
"prepublish": "npm run build",
13-
"pretest": "npm run lint",
14-
"test": "npm run tests-only"
13+
"pretest": "npm run lint"
1514
},
1615
"repository": {
1716
"type": "git",
@@ -31,15 +30,15 @@
3130
},
3231
"homepage": "https://github.com/kesne/babel-plugin-inline-react-svg#readme",
3332
"devDependencies": {
34-
"babel-cli": "^6.14.0",
35-
"babel-core": "^6.14.0",
36-
"babel-preset-airbnb": "^2.0.0",
33+
"babel-cli": "^6.26.0",
34+
"babel-core": "^6.26.3",
35+
"babel-preset-airbnb": "^2.4.0",
3736
"babel-preset-react": "^6.24.1",
38-
"eslint": "^3.5.0",
39-
"eslint-config-airbnb": "^11.1.0",
40-
"eslint-plugin-import": "^1.15.0",
41-
"eslint-plugin-jsx-a11y": "^2.2.2",
42-
"eslint-plugin-react": "^6.2.2",
37+
"eslint": "^4.19.1",
38+
"eslint-config-airbnb": "^16.1.0",
39+
"eslint-plugin-import": "^2.12.0",
40+
"eslint-plugin-jsx-a11y": "^6.0.3",
41+
"eslint-plugin-react": "^7.8.2",
4342
"react": "^15.3.1"
4443
},
4544
"dependencies": {

src/index.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,7 @@ export default ({ types: t }) => ({
9090
if (prop.type === 'JSXSpreadAttribute') {
9191
keepProps.push(prop);
9292
} else {
93-
defaultProps.push(
94-
t.objectProperty(
95-
t.identifier(prop.name.name),
96-
prop.value,
97-
)
98-
);
93+
defaultProps.push(t.objectProperty(t.identifier(prop.name.name), prop.value));
9994
}
10095
});
10196

src/transformSvg.js

+7-12
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ export default t => ({
1313
// <svg xmlns:xlink="asdf">
1414
// to
1515
// <svg xmlnsXlink="asdf">
16-
path.node.name = t.jSXIdentifier(
17-
namespaceToCamel(path.node.name.namespace.name, path.node.name.name.name)
18-
);
16+
path.node.name = t.jSXIdentifier(namespaceToCamel(
17+
path.node.name.namespace.name,
18+
path.node.name.name.name,
19+
));
1920
} else if (t.isJSXIdentifier(path.node.name)) {
2021
// converts
2122
// <tag class="blah blah1"/>
@@ -33,11 +34,9 @@ export default t => ({
3334
const csso = cssToObj(path.node.value.value);
3435
const properties = Object.keys(csso).map(prop => t.objectProperty(
3536
t.identifier(hyphenToCamel(prop)),
36-
t.stringLiteral(csso[prop])
37+
t.stringLiteral(csso[prop]),
3738
));
38-
path.node.value = t.jSXExpressionContainer(
39-
t.objectExpression(properties)
40-
);
39+
path.node.value = t.jSXExpressionContainer(t.objectExpression(properties));
4140
}
4241

4342
// converts
@@ -59,11 +58,7 @@ export default t => ({
5958
JSXOpeningElement(path) {
6059
if (path.node.name.name.toLowerCase() === 'svg') {
6160
// add spread props
62-
path.node.attributes.push(
63-
t.jSXSpreadAttribute(
64-
t.identifier('props')
65-
)
66-
);
61+
path.node.attributes.push(t.jSXSpreadAttribute(t.identifier('props')));
6762
}
6863
},
6964
});

0 commit comments

Comments
 (0)