Skip to content

Commit e5291fd

Browse files
committed
add default to export format
1 parent 3530066 commit e5291fd

6 files changed

Lines changed: 51 additions & 46 deletions

File tree

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
extends:
33
- standard
4+
- standard-preact
45
- plugin:import/warnings
56
- plugin:import/errors
67
- sketch

Resources/Portal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default class Portal extends Component {
3535

3636
this.remote = render((
3737
<PortalProxy context={this.context}>
38-
{ show && this.props.children || null }
38+
{ (show && this.props.children) || null }
3939
</PortalProxy>
4040
), this.into, this.remote)
4141
}
@@ -52,6 +52,6 @@ class PortalProxy extends Component {
5252
return this.props.context
5353
}
5454
render ({ children }) {
55-
return children && children[0] || null
55+
return (children && children[0]) || null
5656
}
5757
}

Resources/branches.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Branch extends Component {
1414
{name}
1515
</span>
1616
<span className='delete' onClick={() => pluginCall('deleteBranch', name)}>
17-
<img src="delete.svg" title='Delete the branch' />
17+
<img src='delete.svg' title='Delete the branch' />
1818
</span>
1919
</div>
2020
)
@@ -32,11 +32,11 @@ class Branches extends Component {
3232
if (!window.ready) {
3333
const interval = setInterval(() => {
3434
if (window.ready) {
35-
this.state = {
35+
this.setState({
3636
branches: (window.branches || []).map(cleanBranchName),
3737
currentBranch: cleanBranchName(window.currentBranch),
3838
ready: window.ready
39-
}
39+
})
4040
clearInterval(interval)
4141
}
4242
}, 100)
@@ -47,7 +47,7 @@ class Branches extends Component {
4747
return (
4848
<div>
4949
<Portal>
50-
<button onClick={() => pluginCall('createBranch')} className="create">
50+
<button onClick={() => pluginCall('createBranch')} className='create'>
5151
Create a new branch
5252
</button>
5353
</Portal>

Resources/preferences.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ class Preferences extends Component {
1212
if (!window.ready) {
1313
const interval = setInterval(() => {
1414
if (window.ready) {
15-
this.state = {
15+
this.setState({
1616
preferences: window.preferences || {},
1717
ready: window.ready
18-
}
18+
})
1919
clearInterval(interval)
2020
}
2121
}, 100)
@@ -26,49 +26,49 @@ class Preferences extends Component {
2626
return (
2727
<div>
2828
<Portal>
29-
<button onClick={() => pluginCall('savePreferences', preferences)} className="save">
29+
<button onClick={() => pluginCall('savePreferences', preferences)} className='save'>
3030
Save Preferences
3131
</button>
3232
</Portal>
3333
{!ready && 'loading...'}
3434
<h2>Diffs preferences</h2>
35-
<div className="form">
36-
<label htmlFor="folder">Folder where the pretty diffs will be exported</label>
37-
<input type="text" value={preferences.exportFolder} id="folder" onInput={this.linkState('preferences.exportFolder')} />
35+
<div className='form'>
36+
<label htmlFor='folder'>Folder where the pretty diffs will be exported</label>
37+
<input type='text' value={preferences.exportFolder} id='folder' onInput={this.linkState('preferences.exportFolder')} />
3838
</div>
39-
<div className="form">
40-
<label htmlFor="scale">Scale of the exported artboards</label>
41-
<input type="number" value={preferences.exportScale} id="scale" onInput={this.linkState('preferences.exportScale')} />
39+
<div className='form'>
40+
<label htmlFor='scale'>Scale of the exported artboards</label>
41+
<input type='number' value={preferences.exportScale} id='scale' onInput={this.linkState('preferences.exportScale')} />
4242
</div>
43-
<div className="form">
44-
<label htmlFor="format">Format of the exported artboards</label>
45-
<select id="form" value={preferences.exportFormat} onChange={this.linkState('preferences.exportFormat')}>
46-
<option value="png">PNG</option>
47-
<option value="jpg">JPG</option>
48-
<option value="pdf">PDF</option>
49-
<option value="eps">EPS</option>
50-
<option value="svg">SVG</option>
43+
<div className='form'>
44+
<label htmlFor='format'>Format of the exported artboards</label>
45+
<select id='form' value={preferences.exportFormat} onChange={this.linkState('preferences.exportFormat')}>
46+
<option value='png'>PNG</option>
47+
<option value='jpg'>JPG</option>
48+
<option value='pdf'>PDF</option>
49+
<option value='eps'>EPS</option>
50+
<option value='svg'>SVG</option>
5151
</select>
5252
</div>
53-
<div className="form">
54-
<input type="checkbox" checked={preferences.diffByDefault} id="diffByDefault" onChange={this.linkState('preferences.diffByDefault')} />
55-
<label htmlFor="diffByDefault"> Generate pretty diff by default</label>
53+
<div className='form'>
54+
<input type='checkbox' checked={preferences.diffByDefault} id='diffByDefault' onChange={this.linkState('preferences.diffByDefault')} />
55+
<label htmlFor='diffByDefault'> Generate pretty diff by default</label>
5656
</div>
57-
<div className="form">
58-
<input type="checkbox" checked={preferences.includeOverviewFile} id="includeOverviewFile" onChange={this.linkState('preferences.includeOverviewFile')} />
59-
<label htmlFor="includeOverviewFile"> Save an overview file with rendered artboards</label>
57+
<div className='form'>
58+
<input type='checkbox' checked={preferences.includeOverviewFile} id='includeOverviewFile' onChange={this.linkState('preferences.includeOverviewFile')} />
59+
<label htmlFor='includeOverviewFile'> Save an overview file with rendered artboards</label>
6060
</div>
6161
<h2>Miscellaneous</h2>
62-
<div className="form">
63-
<label htmlFor="terminal">Terminal App</label>
64-
<select id="terminal" value={preferences.terminal} onChange={this.linkState('preferences.terminal')}>
65-
<option value="Terminal">Terminal</option>
66-
<option value="iTerm">iTerm</option>
62+
<div className='form'>
63+
<label htmlFor='terminal'>Terminal App</label>
64+
<select id='terminal' value={preferences.terminal} onChange={this.linkState('preferences.terminal')}>
65+
<option value='Terminal'>Terminal</option>
66+
<option value='iTerm'>iTerm</option>
6767
</select>
6868
</div>
69-
<div className="form">
70-
<input type="checkbox" checked={preferences.sendAnalytics} id="sendAnalytics" onChange={this.linkState('preferences.sendAnalytics')} />
71-
<label htmlFor="sendAnalytics"> Send anymous usage data to improve the plugin</label>
69+
<div className='form'>
70+
<input type='checkbox' checked={preferences.sendAnalytics} id='sendAnalytics' onChange={this.linkState('preferences.sendAnalytics')} />
71+
<label htmlFor='sendAnalytics'> Send anymous usage data to improve the plugin</label>
7272
</div>
7373
</div>
7474
)

package.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"example": "example"
1414
},
1515
"scripts": {
16-
"test": "echo \"Error: no test specified\" && exit 1",
16+
"test": "eslint -c ./.eslintrc src/ && eslint -c ./.eslintrc Resources/",
1717
"postinstall": "npm run build && skpm link ./",
1818
"build": "skpm build",
1919
"publish": "skpm publish"
@@ -33,19 +33,23 @@
3333
"babel-plugin-transform-react-jsx": "^6.8.0",
3434
"babel-preset-es2015": "^6.18.0",
3535
"babel-preset-react": "^6.16.0",
36-
"eslint": "^3.10.2",
37-
"eslint-config-sketch": "^0.1.0",
38-
"eslint-config-standard": "^6.2.1",
36+
"eslint": "^3.19.0",
37+
"eslint-config-sketch": "^0.2.0",
38+
"eslint-config-standard": "^10.2.0",
3939
"eslint-plugin-import": "^2.2.0",
40-
"eslint-plugin-promise": "^3.4.0",
41-
"eslint-plugin-standard": "^2.0.1",
42-
"skpm": "^0.4.4"
40+
"eslint-plugin-node": "4.2.2",
41+
"eslint-plugin-promise": "^3.5.0",
42+
"eslint-plugin-standard": "^3.0.1",
43+
"skpm": "^0.7.4"
4344
},
4445
"dependencies": {
46+
"eslint-config-sketch": "0.2.2",
47+
"eslint-config-standard-preact": "1.0.1",
48+
"eslint-plugin-react": "6.10.3",
4549
"preact": "^7.1.0",
4650
"sketch-module-google-analytics": "^0.1.3",
4751
"sketch-module-update": "^0.1.2",
4852
"sketch-module-user-preferences": "^0.2.3",
49-
"sketch-module-web-view": "0.1.3"
53+
"sketch-module-web-view": "0.1.4"
5054
}
5155
}

src/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export function exportArtboards (context) {
173173
const pluginPath = context.scriptPath.replace(/Contents\/Sketch\/(\w*)\.cocoascript$/, '').replace(/ /g, '\\ ')
174174
const fileFolder = exportFolder + '/' + currentFileNameWithoutExtension
175175

176-
const command = `${pluginPath}/exportArtboard.sh "${path}" "${exportFolder}" "${fileFolder}" "${NSBundle.mainBundle().bundlePath()}" "${currentFileName}" "${exportFormat}" "${exportScale}" "${includeOverviewFile}"`
176+
const command = `${pluginPath}/exportArtboard.sh "${path}" "${exportFolder}" "${fileFolder}" "${NSBundle.mainBundle().bundlePath()}" "${currentFileName}" "${exportFormat || 'png'}" "${exportScale}" "${includeOverviewFile}"`
177177
return exec(context, command)
178178
}
179179

0 commit comments

Comments
 (0)