-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Heavy cleanup in ORM hook-- pulls things out into separate functions.…
… Makes a few potentially breaking changes.
- Loading branch information
1 parent
7901806
commit bd8fdb1
Showing
12 changed files
with
851 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,122 @@ | ||
{ | ||
// To fix column positions for JSHint errors you may want to add `"indent": 1` to your | ||
// **User** "jshint_options". This issue affects users with tabs for indentation. | ||
// This fix was reverted due to a conflict with using the `"white": true` option. | ||
// "indent": 1, | ||
// ┬┌─┐╦ ╦╦╔╗╔╔╦╗┬─┐┌─┐ | ||
// │└─┐╠═╣║║║║ ║ ├┬┘│ | ||
// o└┘└─┘╩ ╩╩╝╚╝ ╩ ┴└─└─┘ | ||
// | ||
// This file (`.jshintrc`) exists to help with consistency of code | ||
// throughout this package, and throughout Sails and the Node-Machine project. | ||
// | ||
// To review what each of these options mean, see: | ||
// http://jshint.com/docs/options | ||
// | ||
// (or: https://github.com/jshint/jshint/blob/master/examples/.jshintrc) | ||
|
||
|
||
|
||
////////////////////////////////////////////////////////////////////// | ||
// NOT SUPPORTED IN SOME JSHINT VERSIONS SO LEAVING COMMENTED OUT: | ||
////////////////////////////////////////////////////////////////////// | ||
// Prevent overwriting prototypes of native classes like `Array`. | ||
// (doing this is _never_ ok in any of our packages that are intended | ||
// to be used as dependencies of other developers' modules and apps) | ||
// "freeze": true, | ||
////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
////////////////////////////////////////////////////////////////////// | ||
// EVERYTHING ELSE: | ||
////////////////////////////////////////////////////////////////////// | ||
|
||
// Allow the use of `eval` and `new Function()` | ||
// (we sometimes actually need to use these things) | ||
"evil": true, | ||
|
||
// Tolerate funny-looking dashes in RegExp literals. | ||
// (see https://github.com/jshint/jshint/issues/159#issue-903547) | ||
"regexdash": true, | ||
|
||
// The potential runtime "Environments" (as defined by jshint) | ||
// that the _style_ of code written in this package should be | ||
// compatible with (not the code itself, of course). | ||
"browser": true, | ||
"node": true, | ||
"wsh": true, | ||
|
||
// Tolerate the use `[]` notation when dot notation would be possible. | ||
// (this is sometimes preferable for readability) | ||
"sub": true, | ||
|
||
// Suppress warnings about mixed tabs and spaces | ||
"smarttabs": true, | ||
// Do NOT suppress warnings about mixed tabs and spaces | ||
// (two spaces always, please; see `.editorconfig`) | ||
"smarttabs": false, | ||
|
||
// Suppress warnings about trailing whitespace | ||
// (this is already enforced by the .editorconfig, so no need to warn as well) | ||
"trailing": false, | ||
|
||
// Suppress warnings about the use of expressions where fn calls or assignments are expected | ||
// Suppress warnings about the use of expressions where fn calls or assignments | ||
// are expected, and about using assignments where conditionals are expected. | ||
// (while generally a good idea, without this setting, JSHint needlessly lights up warnings | ||
// in existing, working code that really shouldn't be tampered with. Pandora's box and all.) | ||
"expr": true, | ||
|
||
// Suppress warnings about using functions inside loops (useful for inifinityCounters) | ||
"loopfunc": true, | ||
|
||
// Suppress warnings about using assignments where conditionals are expected | ||
"boss": true, | ||
|
||
// Do NOT suppress warnings about using functions inside loops | ||
// (in the general case, we should be using iteratee functions with `_.each()` | ||
// or `Array.prototype.forEach()` instead of `for` or `while` statements | ||
// anyway. This warning serves as a helpful reminder.) | ||
"loopfunc": false, | ||
|
||
// Suppress warnings about "weird constructions" | ||
// i.e. allow code like: | ||
// ``` | ||
// (new (function OneTimeUsePrototype () { } )) | ||
// ``` | ||
// | ||
// (sometimes order of operations in JavaScript can be scary. There is | ||
// nothing wrong with using an extra set of parantheses when the mood | ||
// strikes or you get "that special feeling".) | ||
"supernew": true, | ||
|
||
// Allow backwards, node-dependency-style commas | ||
"laxcomma": true | ||
|
||
// "bitwise": true, | ||
// "camelcase": true, | ||
// "node": true, | ||
// "undef": true, | ||
// "unused": true, | ||
// "curly": true, | ||
// "immed": true, | ||
// "latedef": true, | ||
// "noarg": true, | ||
// "noempty": true, | ||
// "plusplus": true, | ||
// "quotmark": "single", | ||
// "trailing": true, | ||
// "asi": false, | ||
// "eqnull": true, | ||
// "eval": true, | ||
// "sub": true, | ||
// "supernew": true, | ||
// "eqeqeq": true, | ||
// "eqnull": true | ||
|
||
// Do NOT allow backwards, node-dependency-style commas. | ||
// (while this code style choice was used by the project in the past, | ||
// we have since standardized these practices to make code easier to | ||
// read, albeit a bit less exciting) | ||
"laxcomma": false, | ||
|
||
// Strictly enforce the consistent use of single quotes. | ||
// (this is a convention that was established primarily to make it easier | ||
// to grep [or FIND+REPLACE in Sublime] particular string literals in | ||
// JavaScript [.js] files. Note that JSON [.json] files are, of course, | ||
// still written exclusively using double quotes around key names and | ||
// around string literals.) | ||
"quotmark": "single", | ||
|
||
// Do NOT suppress warnings about the use of `==null` comparisons. | ||
// (please be explicit-- use Lodash or `require('util')` and call | ||
// either `.isNull()` or `.isUndefined()`) | ||
"eqnull": false, | ||
|
||
// Strictly enforce the use of curly braces with `if`, `else`, and `switch` | ||
// as well as, much less commonly, `for` and `while` statements. | ||
// (this is just so that all of our code is consistent, and to avoid bugs) | ||
"curly": true, | ||
|
||
// Strictly enforce the use of `===` and `!==`. | ||
// (this is always a good idea. Check out "Truth, Equality, and JavaScript" | ||
// by Angus Croll [the author of "If Hemmingway Wrote JavaScript"] for more | ||
// explanation as to why.) | ||
"eqeqeq": true, | ||
|
||
// Allow initializing variables to `undefined`. | ||
// For more information, see: | ||
// • https://jslinterrors.com/it-is-not-necessary-to-initialize-a-to-undefined | ||
// • https://github.com/jshint/jshint/issues/1484 | ||
// | ||
// (it is often very helpful to explicitly clarify the initial value of | ||
// a local variable-- especially for folks new to more advanced JavaScript | ||
// and who might not recognize the subtle, yet critically important differences between our seemingly | ||
// between `null` and `undefined`, and the impact on `typeof` checks) | ||
"-W080": true | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = { | ||
|
||
|
||
code: 'E_MODEL_HAS_MULTIPLE_DATASTORES', | ||
|
||
|
||
inputs: { | ||
|
||
modelIdentity: { | ||
example: 'wolf', | ||
required: true | ||
} | ||
|
||
}, | ||
|
||
|
||
template: | ||
'One of your models (`<%= modelIdentity %>`) refers to multiple datastores.\n'+ | ||
'Please set its configured datastore to a string instead of an array in its model definition (`.connection`) or the app-wide default (`sails.config.models.connection`)\n'+ | ||
'(this is conventionally set in your `config/models.js` file, or as part of your app\'s environment-specific config).' | ||
|
||
|
||
}; |
Oops, something went wrong.