Add jscs style check, fix violations found
This commit is contained in:
parent
83723379a2
commit
5b5071864b
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"preset": "google",
|
||||
"requireCurlyBraces": [
|
||||
"do",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"disallowSpacesInsideObjectBrackets": null,
|
||||
"requireSpaceAfterLineComment": true,
|
||||
"maximumLineLength": {
|
||||
"value": 80,
|
||||
"allowRegex": true
|
||||
},
|
||||
"validateJSDoc": {
|
||||
"checkParamNames": false,
|
||||
"checkRedundantParams": false,
|
||||
"requireParamTypes": true
|
||||
},
|
||||
"excludeFiles": [
|
||||
"node_modules/**",
|
||||
"coverage/**",
|
||||
"test/sandbox/**"
|
||||
]
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"camelcase" : true,
|
||||
"eqnull" : true,
|
||||
"indent": 2,
|
||||
"undef": true,
|
||||
|
|
2
index.js
2
index.js
|
@ -136,7 +136,7 @@ exports.compileToBrowserify = function(options, bundler) {
|
|||
addInstructionsToBrowserify(compile(options), bundler);
|
||||
};
|
||||
|
||||
//-- undocumented low-level API --//
|
||||
/*-- undocumented low-level API --*/
|
||||
|
||||
exports.ConfigLoader = ConfigLoader;
|
||||
exports.compile = compile;
|
||||
|
|
|
@ -309,7 +309,9 @@ function loadModelDefinition(rootDir, jsonFile, allFiles) {
|
|||
var basename = path.basename(jsonFile, path.extname(jsonFile));
|
||||
|
||||
// find a matching file with a supported extension like `.js` or `.coffee`
|
||||
var base, ext, validFileType;
|
||||
var base;
|
||||
var ext;
|
||||
var validFileType;
|
||||
var sourceFile = allFiles
|
||||
.filter(function(f) {
|
||||
ext = path.extname(f);
|
||||
|
|
|
@ -189,8 +189,8 @@ function hasCompatibleType(origValue, newValue) {
|
|||
|
||||
/**
|
||||
* Try to read a config file with .json extension
|
||||
* @param cwd Dirname of the file
|
||||
* @param fileName Name of the file without extension
|
||||
* @param {string} cwd Dirname of the file
|
||||
* @param {string} fileName Name of the file without extension
|
||||
* @returns {Object|undefined} Content of the file, undefined if not found.
|
||||
*/
|
||||
function tryReadJsonConfig(cwd, fileName) {
|
||||
|
|
|
@ -69,7 +69,7 @@ function assertLoopBackVersion(app) {
|
|||
}
|
||||
|
||||
function setHost(app, instructions) {
|
||||
//jshint camelcase:false
|
||||
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
var host =
|
||||
process.env.npm_config_host ||
|
||||
process.env.OPENSHIFT_SLS_IP ||
|
||||
|
@ -86,7 +86,7 @@ function setHost(app, instructions) {
|
|||
}
|
||||
|
||||
function setPort(app, instructions) {
|
||||
//jshint camelcase:false
|
||||
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
var port = _.find([
|
||||
process.env.npm_config_port,
|
||||
process.env.OPENSHIFT_SLS_PORT,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"main": "index.js",
|
||||
"browser": "browser.js",
|
||||
"scripts": {
|
||||
"pretest": "jshint .",
|
||||
"pretest": "jscs . && jshint .",
|
||||
"test": "mocha"
|
||||
},
|
||||
"license": {
|
||||
|
@ -37,6 +37,7 @@
|
|||
"coffee-script": "^1.8.0",
|
||||
"coffeeify": "^0.7.0",
|
||||
"fs-extra": "^0.12.0",
|
||||
"jscs": "^1.7.3",
|
||||
"jshint": "^2.5.6",
|
||||
"loopback": "^2.5.0",
|
||||
"mocha": "^1.19.0",
|
||||
|
|
|
@ -12,7 +12,10 @@ describe('compiler', function() {
|
|||
beforeEach(appdir.init);
|
||||
|
||||
describe('from options', function() {
|
||||
var options, instructions, appConfig;
|
||||
var options;
|
||||
var instructions;
|
||||
var appConfig;
|
||||
|
||||
beforeEach(function() {
|
||||
options = {
|
||||
config: {
|
||||
|
|
|
@ -266,7 +266,7 @@ describe('executor', function() {
|
|||
});
|
||||
|
||||
it('should prioritize sources', function() {
|
||||
/*jshint camelcase:false */
|
||||
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
process.env.npm_config_host = randomHost();
|
||||
process.env.OPENSHIFT_SLS_IP = randomHost();
|
||||
process.env.OPENSHIFT_NODEJS_IP = randomHost();
|
||||
|
@ -328,7 +328,6 @@ describe('executor', function() {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
function assertValidDataSource(dataSource) {
|
||||
// has methods
|
||||
assert.isFunc(dataSource, 'createModel');
|
||||
|
|
|
@ -2,4 +2,3 @@ process.bootFlags.push('barSyncLoaded');
|
|||
module.exports = function(app) {
|
||||
process.bootFlags.push('barSyncExecuted');
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue