Skip to content

Commit cb44a09

Browse files
authored
Merge pull request #3 from erikras/prettier
Formatted with prettier
2 parents f92f932 + c39390c commit cb44a09

File tree

8 files changed

+26
-20
lines changed

8 files changed

+26
-20
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![NPM Downloads](https://img.shields.io/npm/dm/styled-components-theme.svg?style=flat-square)](https://www.npmjs.com/package/styled-components-theme)
77
[![Build Status](https://img.shields.io/travis/erikras/styled-components-theme/master.svg?style=flat-square)](https://travis-ci.org/erikras/styled-components-theme)
88
[![codecov.io](https://codecov.io/github/erikras/styled-components-theme/coverage.svg?branch=master)](https://codecov.io/github/erikras/styled-components-theme?branch=master)
9+
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
910

1011
[`styled-components-theme`](https://github.com/erikras/styled-components-theme) generates
1112
selectors for colors in your

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"build:lib": "babel src --out-dir lib",
1515
"build:umd": "cross-env NODE_ENV=development webpack src/index.js dist/styled-components-theme.js",
1616
"build:umd:min": "cross-env NODE_ENV=production webpack src/index.js dist/styled-components-theme.min.js",
17+
"format": "prettier-eslint \"src/**/*.js\" --write --no-semi --single-quote --trailingComma=none",
1718
"clean": "rimraf dist lib",
1819
"lint": "eslint src",
1920
"prepublish": "npm run test && npm run lint && npm run clean && npm run build",
@@ -54,6 +55,8 @@
5455
"mocha": "^3.4.2",
5556
"mocha-lcov-reporter": "^1.3.0",
5657
"nyc": "^11.0.1",
58+
"prettier": "^1.4.0",
59+
"prettier-eslint-cli": "^4.0.2",
5760
"rimraf": "^2.6.1",
5861
"webpack": "^2.6.1"
5962
},

src/__tests__/index.spec.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ describe('makeTheme', () => {
3131
const lighterGray = graySelector.lighten(0.4)
3232
const darkerRed = redSelector.darken(0.1)
3333

34-
expect(lighterGray(themeFromProvider)).toBe(new Color(colors.gray).lighten(0.4).hex())
35-
expect(darkerRed(themeFromProvider)).toBe(new Color(colors.red).darken(0.1).hex())
34+
expect(lighterGray(themeFromProvider)).toBe(
35+
new Color(colors.gray).lighten(0.4).hex()
36+
)
37+
expect(darkerRed(themeFromProvider)).toBe(
38+
new Color(colors.red).darken(0.1).hex()
39+
)
3640
})
3741
})

src/addModifier.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Color from 'color'
55
* original function to get the color and then modifies that color, ultimately returning another
66
* color string.
77
*/
8-
const addModifier = (fn, method, ...modifierArgs) =>
9-
(...args) => new Color(fn(...args))[ method ](...modifierArgs).hex()
8+
const addModifier = (fn, method, ...modifierArgs) => (...args) =>
9+
new Color(fn(...args))[method](...modifierArgs).hex()
1010

1111
export default addModifier

src/colorMethods.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
const colorMethods = [
2-
'negate', // rgb(0, 100, 255) -> rgb(255, 155, 0)
2+
'negate', // rgb(0, 100, 255) -> rgb(255, 155, 0)
33

4-
'lighten', // hsl(100, 50%, 50%) -> hsl(100, 50%, 75%)
5-
'darken', // hsl(100, 50%, 50%) -> hsl(100, 50%, 25%)
4+
'lighten', // hsl(100, 50%, 50%) -> hsl(100, 50%, 75%)
5+
'darken', // hsl(100, 50%, 50%) -> hsl(100, 50%, 25%)
66

7-
'saturate', // hsl(100, 50%, 50%) -> hsl(100, 75%, 50%)
7+
'saturate', // hsl(100, 50%, 50%) -> hsl(100, 75%, 50%)
88
'desaturate', // hsl(100, 50%, 50%) -> hsl(100, 25%, 50%)
9-
'greyscale', // #5CBF54 -> #969696
9+
'greyscale', // #5CBF54 -> #969696
1010

11-
'whiten', // hwb(100, 50%, 50%) -> hwb(100, 75%, 50%)
12-
'blacken', // hwb(100, 50%, 50%) -> hwb(100, 50%, 75%)
11+
'whiten', // hwb(100, 50%, 50%) -> hwb(100, 75%, 50%)
12+
'blacken', // hwb(100, 50%, 50%) -> hwb(100, 50%, 75%)
1313

14-
'clearer', // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 0.4)
15-
'opaquer', // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 1.0)
14+
'clearer', // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 0.4)
15+
'opaquer', // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 1.0)
1616

17-
'rotate' // hsl(60, 20%, 20%) -> hsl(330, 20%, 20%)
17+
'rotate' // hsl(60, 20%, 20%) -> hsl(330, 20%, 20%)
1818
]
1919

2020
export default colorMethods

src/decorateSelector.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import addModifier from './addModifier'
88
const decorateSelector = selector => {
99
// add member functions to our selector
1010
colorMethods.forEach(method => {
11-
selector[method] = (...args) => decorateSelector(addModifier(selector, method, ...args))
11+
selector[method] = (...args) =>
12+
decorateSelector(addModifier(selector, method, ...args))
1213
})
1314
return selector
1415
}

src/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ const makeTheme = (...colors) =>
66
return result
77
}, {})
88

9-
export {
10-
makeThemeColor
11-
}
9+
export { makeThemeColor }
1210

1311
export default makeTheme

src/makeThemeColor.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import decorateSelector from './decorateSelector'
22

3-
const makeThemeColor = key =>
4-
decorateSelector(props => props.theme[key])
3+
const makeThemeColor = key => decorateSelector(props => props.theme[key])
54

65
export default makeThemeColor

0 commit comments

Comments
 (0)