Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build": "babel src -d lib -D",
"prepublish": "npm run -s build",
"dev": "babel-node src",
"lint": "eslint 'src/**/*.js'",
"test:build": "babel-node src build --cwd examples/root",
"test:serve": "npm run -s test:build && babel-node src serve --port 3000 --cwd examples/root",
"test:serve:config": "npm run -s test:build && babel-node src serve --server config --cwd examples/root",
Expand Down Expand Up @@ -51,6 +52,8 @@
"rules": {
"no-console": 1,
"no-empty": 0,
"semi": 2,
"keyword-spacing": 2,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@developit I took the liberty of adding those rules to eslint - please check if they're ok with you.
Semicolons are enforced (they were placed almost everywhere and not enforced) & spaces should be placed after keyword (no changes to files).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both good with me, thanks a bunch!

"react/no-string-refs": 2,
"react/no-find-dom-node": 2,
"react/no-is-mounted": 2,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default asyncCommand({
\u001b[32mnpm run serve\u001b[39m
`.trim().replace(/^\t+/gm, '') + '\n';
}
})
});


const npm = (cwd, args) => spawn('npm', args, { cwd, stdio: 'ignore' });
2 changes: 1 addition & 1 deletion src/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function createHeadersFromPushManifest(pushManifest) {
`<${url}>; rel=preload; as=${type}`
).join(', ')
}]
})
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ export default asyncCommand({
let stats = await runWebpack(true, config, showStats);
showStats(stats);
}
})
});
2 changes: 1 addition & 1 deletion src/lib/async-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export default function asyncCommand(options) {
let r = options.handler(argv, done);
if (r && r.then) r.then(result => done(null, result), done);
}
}
};
}
9 changes: 8 additions & 1 deletion src/lib/async-component-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ module.exports.pitch = function(remainingRequest) {
this.cacheable && this.cacheable();
var query = loaderUtils.getOptions(this) || {};
var routeName = typeof query.name === 'function' ? query.name(this.resourcePath) : null;
var name = routeName !== null ? routeName : ('name' in query ? query.name : (query.formatName || String)(this.resourcePath));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I knew someone would undo this lovely upsetting ternary

var name;
if (routeName !== null) {
name = routeName;
} else if ('name' in query) {
name = query.name;
} else if ('formatName' in query) {
name = query.formatName(this.resourcePath);
}

return `
import async from ${JSON.stringify(path.resolve(__dirname, '../components/async'))};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/babel-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ export default (env, options={}) => ({
import: 'h'
}]
]
})
});
1 change: 1 addition & 0 deletions src/lib/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function prerender(config, params) {
app = m && m.default || m;

if (typeof app!=='function') {
// eslint-disable-next-line no-console
console.warn('Entry does not export a Component function/class, aborting prerendering.');
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/push-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ module.exports = class PushManifestPlugin {
callback();
});
}
}
};
2 changes: 1 addition & 1 deletion src/lib/run-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default (watch=false, config, onprogress) => new Promise( (resolve, rejec
// Timeout for plugins that work on `after-emit` event of webpack
setTimeout(()=>{
resolve(stats);
},20)
},20);
}
};

Expand Down