Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
kof committed Sep 18, 2021
1 parent 8e13468 commit aa7074b
Show file tree
Hide file tree
Showing 87 changed files with 286 additions and 334 deletions.
8 changes: 4 additions & 4 deletions docs/csp.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ To communicate the nonce value to JSS, we're going use some basic templating wit
1. First, create the template HTML file.
```html
<head>
<meta property="csp-nonce" content="{{ styleNonce }}">
</head>
...
<head>
<meta property="csp-nonce" content="{{ styleNonce }}" />
</head>
...
```
1. Now update the server to render the template with the `styleNonce` variable to be interpolated with the nonce generated from our middleware `res.locals.styleNonce`.
Expand Down
4 changes: 1 addition & 3 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ const styles = {
ctaButton: {
extend: 'button',
'&:hover': {
background: color('blue')
.darken(0.3)
.hex()
background: color('blue').darken(0.3).hex()
}
},
'@media (min-width: 1024px)': {
Expand Down
11 changes: 5 additions & 6 deletions docs/jss-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ const sheet2 = jss.createStyleSheet({}, {index: 1, meta: 'sheet-2'}).attach()
```

```html
<style data-meta="sheet-2"></style>
<style data-meta="sheet-1"></style>
<style data-meta="sheet-2"></style> <style data-meta="sheet-1"></style>
```

## Add a rule to an existing Style Sheet
Expand Down Expand Up @@ -274,11 +273,11 @@ import jss from 'jss'
const styles = {
container: {
height: 200,
width: data => data.width
width: (data) => data.width
},
button: {
color: data => data.button.color,
padding: data => data.button.padding
color: (data) => data.button.color,
padding: (data) => data.button.padding
}
}

Expand Down Expand Up @@ -452,7 +451,7 @@ import {getDynamicStyles} from 'jss'
const dynamicStyles = getDynamicStyles({
button: {
fontSize: 12,
color: data => data.color
color: (data) => data.color
}
})

Expand Down
8 changes: 6 additions & 2 deletions docs/jss-plugin-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,12 @@ const button2 = (
It renders to:

```html
<button class="buttonActiveDisabled-123456 buttonActive-123456 button-123456">Active Disabled Button</button>
<button class="buttonDisabled-123456 button-123456 active-123456 disabled-123456">Disabled Button with active state</button>
<button class="buttonActiveDisabled-123456 buttonActive-123456 button-123456">
Active Disabled Button
</button>
<button class="buttonDisabled-123456 button-123456 active-123456 disabled-123456">
Disabled Button with active state
</button>
```

### Mix global and local classes.
Expand Down
2 changes: 1 addition & 1 deletion docs/jss-plugin-default-unit.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import defaultUnit from 'jss-plugin-default-unit'
const options = {
'line-height': 'rem',
'font-size': 'rem',
width: val => `${val / 2}px`
width: (val) => `${val / 2}px`
}

jss.use(defaultUnit(options))
Expand Down
5 changes: 4 additions & 1 deletion docs/jss-plugin-expand.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ compiles to
```javascript
const styles = {
container: {
transition: [['opacity', '200ms'], ['width', '300ms']]
transition: [
['opacity', '200ms'],
['width', '300ms']
]
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/jss-plugin-extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Nested `extend` inside of the function is not supported. Will override other pro
```javascript
const styles = {
button: {
extend: data => ({
extend: (data) => ({
color: data.theme.color
}),
fontSize: '20px'
Expand Down
6 changes: 3 additions & 3 deletions docs/jss-plugin-rule-value-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ _Plugins are applied by default to function rules or values._
```javascript
const styles = {
button: {
color: data => data.color
color: (data) => data.color
}
}
```
Expand All @@ -28,7 +28,7 @@ Similar to function values, you can use a function to return a dynamic style obj

```javascript
const styles = {
button: data => ({
button: (data) => ({
display: 'flex',
color: data.color
})
Expand All @@ -44,7 +44,7 @@ To use the `!important` modifier with function values, you must use [array synta
```javascript
const styles = {
button: {
color: data => [[data.color], '!important']
color: (data) => [[data.color], '!important']
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions docs/jss-plugin-rule-value-observable.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {Observable} from 'rxjs'

const styles = {
button: {
color: new Observable(observer => {
color: new Observable((observer) => {
observer.next('red')
})
}
Expand All @@ -32,7 +32,7 @@ Similar to observable values, you can declare "observable" rules. A stream shoul
import {Observable} from 'rxjs'

const styles = {
button: new Observable(observer => {
button: new Observable((observer) => {
observer.next({
color: 'red',
opacity: 1
Expand Down
4 changes: 1 addition & 3 deletions docs/jss-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,7 @@ import color from 'color'

const styles = {
button: {
color: color('blue')
.darken(0.3)
.hex()
color: color('blue').darken(0.3).hex()
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ You need to register a `plugin` only once per JSS instance. There are some hooks
import jss from 'jss'
jss.use({
onProcessSheet: sheet => {
onProcessSheet: (sheet) => {
// Do something here.
}
})
Expand Down
8 changes: 3 additions & 5 deletions docs/react-jss-hoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ The above code will compile to
```html
<div id="root">
<button class="Button-myButton-1-25">
<span class="Button-myLabel-1-26">
Submit
</span>
<span class="Button-myLabel-1-26"> Submit </span>
</button>
</div>
```
Expand Down Expand Up @@ -109,7 +107,7 @@ const Button = ({classes, children, theme}) => (
</button>
)

const styles = theme => ({
const styles = (theme) => ({
button: {
background: theme.colorPrimary
},
Expand Down Expand Up @@ -156,7 +154,7 @@ const StyledComponent = withStyles({})(InnerComponent)

const App = (
<StyledComponent
ref={ref => {
ref={(ref) => {
console.log(ref)
}}
/>
Expand Down
4 changes: 2 additions & 2 deletions docs/react-jss-ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const useStyles = createUseStyles((theme: CustomTheme) => ({
myButton: {
padding: (props: ButtonProps) => props.spacing || 10
},
myLabel: props => ({
myLabel: (props) => ({
display: 'block',
color: props.labelColor || 'red',
fontWeight: props.fontWeight || 'bold',
Expand All @@ -87,7 +87,7 @@ const useStyles = createUseStyles({
backgroundColor: theme.background || 'gray'
}),
myButton: {
padding: props => props.spacing || 10
padding: (props) => props.spacing || 10
}
})
```
Expand Down
22 changes: 8 additions & 14 deletions docs/react-jss.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ The above code will compile to
```html
<div id="root">
<button class="Button-myButton-1-25">
<span class="Button-myLabel-1-26">
Submit
</span>
<span class="Button-myLabel-1-26"> Submit </span>
</button>
</div>
```
Expand Down Expand Up @@ -124,9 +122,9 @@ import {createUseStyles} from 'react-jss'

const useStyles = createUseStyles({
myButton: {
padding: props => props.spacing
padding: (props) => props.spacing
},
myLabel: props => ({
myLabel: (props) => ({
display: 'block',
color: props.labelColor,
fontWeight: props.fontWeight,
Expand Down Expand Up @@ -157,9 +155,7 @@ The above code will compile to
```html
<div id="root">
<button class="myButton-1-25">
<span class="myLabel-1-26">
Submit
</span>
<span class="myLabel-1-26"> Submit </span>
</button>
</div>
```
Expand Down Expand Up @@ -187,9 +183,9 @@ import {createUseStyles} from 'react-jss'
const useStyles = createUseStyles(
{
myButton: {
padding: props => props.spacing
padding: (props) => props.spacing
},
myLabel: props => ({
myLabel: (props) => ({
display: 'block',
color: props.labelColor,
fontWeight: props.fontWeight,
Expand Down Expand Up @@ -222,9 +218,7 @@ The above code will compile to
```html
<div id="root">
<button class="Button-myButton-1-25">
<span class="Button-myLabel-1-26">
Submit
</span>
<span class="Button-myLabel-1-26"> Submit </span>
</button>
</div>
```
Expand Down Expand Up @@ -264,7 +258,7 @@ import {createUseStyles, useTheme, ThemeProvider} from 'react-jss'

// Using `theme` function is better when you have many theme dependant styles.
// Note that in this case you don't need to use useTheme(), it subscribes to the them automatically
const useStylesFromThemeFunction = createUseStyles(theme => ({
const useStylesFromThemeFunction = createUseStyles((theme) => ({
button: {
background: theme.colorPrimary
},
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const travisBuildNumber = process.env.TRAVIS_BUILD_NUMBER
const travisBuildId = process.env.TRAVIS_BUILD_ID
const travisJobNumber = process.env.TRAVIS_JOB_NUMBER

module.exports = config => {
module.exports = (config) => {
config.set({
customLaunchers: browsers,
browsers: ['Chrome'],
Expand Down
4 changes: 2 additions & 2 deletions packages/jss-plugin-camel-case/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import functionPlugin from 'jss-plugin-rule-value-function'
import camelCase from './index'

const settings = {
createGenerateId: () => rule => `${rule.key}-id`
createGenerateId: () => (rule) => `${rule.key}-id`
}

describe('jss-plugin-camel-case', () => {
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('jss-plugin-camel-case', () => {
it('with dynamic css variable', () => {
const sheet = localJss.createStyleSheet({
a: {
'--fontSize': size => size
'--fontSize': (size) => size
}
})

Expand Down
2 changes: 1 addition & 1 deletion packages/jss-plugin-compose/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {create} from 'jss'
import sinon from 'sinon'
import compose from '.'

const settings = {createGenerateId: () => rule => `${rule.key}-id`}
const settings = {createGenerateId: () => (rule) => `${rule.key}-id`}

describe('jss-plugin-compose', () => {
let jss
Expand Down
2 changes: 1 addition & 1 deletion packages/jss-plugin-default-unit/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import defaultUnits, {px} from './defaultUnits'
*/
function addCamelCasedVersion(obj) {
const regExp = /(-[a-z])/g
const replace = str => str[1].toUpperCase()
const replace = (str) => str[1].toUpperCase()
const newObj = {}
for (const key in obj) {
newObj[key] = obj[key]
Expand Down
8 changes: 5 additions & 3 deletions packages/jss-plugin-default-unit/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ import functionPlugin from 'jss-plugin-rule-value-function'
import defaultUnit from './index'

const settings = {
createGenerateId: () => rule => `${rule.key}-id`
createGenerateId: () => (rule) => `${rule.key}-id`
}

describe('jss-plugin-default-unit', () => {
let jss

beforeEach(() => {
jss = create(settings).use(defaultUnit({'min-width': 'pc', 'max-width': val => `${val / 2}px`}))
jss = create(settings).use(
defaultUnit({'min-width': 'pc', 'max-width': (val) => `${val / 2}px`})
)
})

describe('unitless values', () => {
Expand Down Expand Up @@ -425,7 +427,7 @@ describe('jss-plugin-default-unit', () => {

sheet = jss.createStyleSheet({
a: {
width: new Observable(observer => {
width: new Observable((observer) => {
observer.next(1)
})
}
Expand Down
2 changes: 1 addition & 1 deletion packages/jss-plugin-expand/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {propArray, propArrayInObj, propObj, customPropObj} from './props'
* @return {String} mapped values
*/
function mapValuesByProp(value, prop, rule) {
return value.map(item => objectToArray(item, prop, rule, false, true))
return value.map((item) => objectToArray(item, prop, rule, false, true))
}

/**
Expand Down
9 changes: 6 additions & 3 deletions packages/jss-plugin-expand/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import observablePlugin from 'jss-plugin-rule-value-observable'
import expand from '.'

const settings = {
createGenerateId: () => rule => `${rule.key}-id`
createGenerateId: () => (rule) => `${rule.key}-id`
}

describe('jss-plugin-expand', () => {
Expand Down Expand Up @@ -50,7 +50,10 @@ describe('jss-plugin-expand', () => {
beforeEach(() => {
sheet = jss.createStyleSheet({
a: {
transition: [['opacity', 1, 'linear'], ['transform', 300, 'ease']]
transition: [
['opacity', 1, 'linear'],
['transform', 300, 'ease']
]
}
})
})
Expand Down Expand Up @@ -381,7 +384,7 @@ describe('jss-plugin-expand', () => {

sheet = jss.createStyleSheet({
a: {
width: new Observable(observer => {
width: new Observable((observer) => {
observer.next(1)
})
}
Expand Down
Loading

0 comments on commit aa7074b

Please sign in to comment.