Skip to content

Commit

Permalink
Merge pull request #2960 from wecc/fix-jscs
Browse files Browse the repository at this point in the history
Fix JSCS rule and unlock v1.11.0
  • Loading branch information
bmac committed Mar 31, 2015
2 parents 5b2a17e + a683658 commit 339b79a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,10 @@ module.exports.prototype = {
check: function(file, errors) {
var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace;
var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace;
var tokens = file.getTokens();

file.iterateNodesByType(['FunctionDeclaration'], function(node) {
var nodeBeforeRoundBrace = node;
// named function
if (node.id) {
nodeBeforeRoundBrace = node.id;
}

var functionTokenPos = file.getTokenPosByRangeStart(nodeBeforeRoundBrace.range[0]);
var functionToken = tokens[functionTokenPos];

var nextTokenPos = file.getTokenPosByRangeStart(functionToken.range[1]);
var nextToken = tokens[nextTokenPos];
var functionToken = file.getFirstNodeToken(node.id || node);
var nextToken = file.getNextToken(functionToken);

if (beforeOpeningRoundBrace) {
if (nextToken) {
Expand All @@ -56,8 +46,8 @@ module.exports.prototype = {
}
}

var tokenBeforeBodyPos = file.getTokenPosByRangeStart(node.body.range[0] - 1);
var tokenBeforeBody = tokens[tokenBeforeBodyPos];
// errors if no token is found unless `includeComments` is passed
var tokenBeforeBody = file.getPrevToken(node.body, { includeComments: true });

if (beforeOpeningCurlyBrace) {
if (tokenBeforeBody) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"es6-module-transpiler-amd-formatter": "^0.2.4",
"es6-module-transpiler-package-resolver": "^1.0.1",
"git-repo-version": "0.0.2",
"jscs": "1.11.0",
"jscs": "^1.12.0",
"testem": "^0.6.19",
"yuidocjs": "~0.3.46"
}
Expand Down
10 changes: 5 additions & 5 deletions packages/ember-data/lib/system/many-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ export default Ember.Object.extend(Ember.MutableArray, Ember.Evented, {
*/
isLoaded: false,

/**
The relationship which manages this array.
/**
The relationship which manages this array.
@property {ManyRelationship} relationship
@private
*/
@property {ManyRelationship} relationship
@private
*/
relationship: null,

internalReplace: function(idx, amt, objects) {
Expand Down
6 changes: 3 additions & 3 deletions packages/ember-data/lib/system/model/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ export default function attr(type, options) {
return getDefaultValue(this, options, key);
}

// `data` is never set directly. However, it may be
// invalidated from the state manager's setData
// event.
// `data` is never set directly. However, it may be
// invalidated from the state manager's setData
// event.
}).meta(meta);
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ test("When all records for a type are requested, a rejection should reject the p
expect(5);

var count = 0;
store = createStore({ adapter: DS.Adapter.extend({
findAll: function(store, type, since) {
store = createStore({
adapter: DS.Adapter.extend({
findAll: function(store, type, since) {
// this will get called twice
ok(true, "the adapter's findAll method should be invoked");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ test("serializeBelongsTo with null", function() {
test("async serializeBelongsTo with null", function() {
Comment.reopen({
post: DS.belongsTo('post', { async: true })
});
});
run(function() {
comment = env.store.createRecord(Comment, { body: "Omakase is delicious", post: null });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module("unit/adapters/rest_adapter/group_records_for_find_many_test - DS.RESTAda
Store = createStore({
adapter: GroupsAdapter,
testRecord: DS.Model.extend()
});
});

}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-data/tests/unit/model/merge-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test("When a record is in flight, pushes are applied underneath the in flight ch

var adapter = DS.Adapter.extend({
updateRecord: function(store, type, snapshot) {
// Make sure saving isn't resolved synchronously
// Make sure saving isn't resolved synchronously
return new Ember.RSVP.Promise(function(resolve, reject) {
run.next(null, resolve, { id: 1, name: "Senor Thomas Dale, Esq.", city: "Portland" });
});
Expand Down

0 comments on commit 339b79a

Please sign in to comment.