Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 5c3dd99

Browse files
committed
using prettier-eslint
1 parent 46f2200 commit 5c3dd99

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

index.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ const defaultOptions = {
1717
browserifyOptions: {
1818
extensions: ['.js', '.jsx', '.coffee', '.cjsx'],
1919
transform: [
20-
[
21-
require.resolve('./cjsxify'),
22-
{},
23-
],
20+
[require.resolve('./cjsxify'), {}],
2421
[
2522
require.resolve('babelify'),
2623
{
@@ -30,7 +27,9 @@ const defaultOptions = {
3027
plugins: ['babel-plugin-add-module-exports'].map(require.resolve),
3128
// babel-preset-env supports any JS that's stage-4, meaning it's
3229
// completely finalized in the ECMA standard
33-
presets: ['babel-preset-env', 'babel-preset-react'].map(require.resolve),
30+
presets: ['babel-preset-env', 'babel-preset-react'].map(
31+
require.resolve
32+
),
3433
},
3534
],
3635
],
@@ -61,8 +60,16 @@ const preprocessor = (options = {}) => {
6160
log('received user options', options)
6261

6362
// allow user to override default options
64-
const browserifyOptions = Object.assign({}, defaultOptions.browserifyOptions, options.browserifyOptions)
65-
const watchifyOptions = Object.assign({}, defaultOptions.watchifyOptions, options.watchifyOptions)
63+
const browserifyOptions = Object.assign(
64+
{},
65+
defaultOptions.browserifyOptions,
66+
options.browserifyOptions
67+
)
68+
const watchifyOptions = Object.assign(
69+
{},
70+
defaultOptions.watchifyOptions,
71+
options.watchifyOptions
72+
)
6673

6774
// we return function that accepts the arguments provided by
6875
// the event 'file:preprocessor'
@@ -152,18 +159,19 @@ const preprocessor = (options = {}) => {
152159
log(`update ${filePath}`)
153160
// we overwrite the cached bundle promise, so on subsequent invocations
154161
// it gets the latest bundle
155-
const bundlePromise = bundles[filePath] = bundle()
156-
.finally(() => {
162+
const bundlePromise = (bundles[filePath] = bundle().finally(() => {
157163
log(`- update finished for ${filePath}`)
158164
file.emit('rerun')
159-
})
165+
}))
160166
// we suppress unhandled rejections so they don't bubble up to the
161167
// unhandledRejection handler and crash the app. Cypress will eventually
162168
// take care of the rejection when the file is requested
163169
bundlePromise.suppressUnhandledRejections()
164170
})
165171

166-
const bundlePromise = fs.ensureDirAsync(path.dirname(outputPath)).then(bundle)
172+
const bundlePromise = fs
173+
.ensureDirAsync(path.dirname(outputPath))
174+
.then(bundle)
167175

168176
// cache the bundle promise, so it can be returned if this function
169177
// is invoked again with the same filePath

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"ban": "ban",
2727
"deps": "deps-ok && dependency-check --no-dev .",
2828
"license": "license-checker --production --onlyunknown --csv",
29-
"lint": "eslint --fix *.js",
29+
"lint": "prettier-eslint --trailing-comma es5 --no-semi --single-quote --write '*.js'",
3030
"secure": "nsp check",
3131
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",
3232
"test": "mocha",
@@ -50,6 +50,7 @@
5050
"mocha": "3.5.0",
5151
"mockery": "2.1.0",
5252
"nsp": "2.7.0",
53+
"prettier-eslint-cli": "4.4.0",
5354
"semantic-release": "8.2.0",
5455
"simple-commit-message": "3.3.1",
5556
"sinon": "3.2.1",

0 commit comments

Comments
 (0)