Convert js/resources/models to ES6.
Review Request #8108 — Created April 8, 2016 and submitted
This is a relatively large but straightforward conversion.
Ran unit tests.
Description | From | Last Updated |
---|---|---|
You can make this const and do: const url = /* ... */; return this.isNew() ? url : `${url}${this.id}/`; |
brennie | |
Do we prefer spread/rest over arguments? e.g., { destroyIfEmpty(...args) { if (!this.get('text')) { this.destroy.apply(this, args); } } } |
brennie | |
Add a period. |
brennie | |
"Serialize and return" |
brennie | |
What about: { deserializers: { date(date) { return date ? new Date(date) : ''; }, summary(message) { return message.split('\n', 1)[0]; … |
brennie | |
Same here. |
brennie | |
parseResourceData(rsp) |
brennie | |
Same comment as the other one about making this const. |
brennie | |
Same as above. |
brennie | |
Same as above. |
brennie | |
Same comment re: function literals. |
brennie | |
Same comment about const-ness. |
brennie | |
parseResourceData(rsp) |
brennie | |
validate(attrs) |
brennie |
-
Some stylistic nitpicks. Nothing major.
-
You can make this const and do:
const url = /* ... */; return this.isNew() ? url : `${url}${this.id}/`;
-
Do we prefer spread/rest over
arguments
? e.g.,{ destroyIfEmpty(...args) { if (!this.get('text')) { this.destroy.apply(this, args); } } }
-
-
-
What about:
{ deserializers: { date(date) { return date ? new Date(date) : ''; }, summary(message) { return message.split('\n', 1)[0]; } } }
-
-
-
-
-
-
-
-
-
-
- Commit:
-
12e0fd7829c7f63ff61ecded259171b4b3719101851ad83da035a8071e65856552ccbe1046c3c81e
- Diff:
-
Revision 2 (+2222 -1557)
-
Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/resources/models/screenshotCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/fileDiffModel.js reviewboard/static/rb/js/resources/models/repositoryBranchModel.es6.js reviewboard/static/rb/js/resources/models/repositoryCommitModel.es6.js reviewboard/static/rb/js/resources/models/validateDiffModel.es6.js reviewboard/static/rb/js/resources/models/baseCommentModel.es6.js reviewboard/static/rb/js/resources/models/screenshotCommentModel.es6.js reviewboard/static/rb/js/resources/models/generalCommentModel.es6.js reviewboard/static/rb/js/resources/models/diffCommentModel.es6.js reviewboard/static/rb/js/resources/models/draftResourceChildModelMixin.es6.js reviewboard/static/rb/js/resources/models/repositoryCommitModel.js reviewboard/static/rb/js/resources/models/repositoryBranchModel.js reviewboard/static/rb/js/resources/models/screenshotModel.es6.js reviewboard/static/rb/js/resources/models/reviewModel.es6.js reviewboard/static/rb/js/resources/models/fileDiffModel.es6.js reviewboard/static/rb/js/resources/models/repositoryModel.es6.js reviewboard/static/rb/js/resources/models/baseResourceModel.es6.js reviewboard/static/rb/js/resources/models/diffCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentModel.es6.js reviewboard/static/rb/js/resources/utils/serializers.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/draftResourceChildModelMixin.js reviewboard/static/rb/js/resources/models/screenshotCommentModel.js reviewboard/static/rb/js/resources/models/draftFileAttachmentModel.es6.js reviewboard/static/rb/js/resources/models/diffModel.es6.js reviewboard/static/rb/js/resources/models/draftReviewRequestModel.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js reviewboard/static/rb/js/resources/models/reviewGroupModel.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentModel.js reviewboard/static/rb/js/resources/models/reviewRequestModel.es6.js reviewboard/static/rb/js/resources/models/reviewModel.js reviewboard/static/rb/js/resources/models/apiTokenModel.js reviewboard/static/rb/js/resources/models/draftResourceModelMixin.es6.js reviewboard/static/rb/js/resources/models/baseCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/generalCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/apiTokenModel.es6.js reviewboard/static/rb/js/resources/models/screenshotModel.js reviewboard/static/rb/js/resources/models/draftReviewModel.es6.js reviewboard/static/rb/js/resources/models/repositoryModel.js reviewboard/static/rb/js/resources/models/defaultReviewerModel.es6.js reviewboard/static/rb/js/resources/models/reviewReplyModel.es6.js Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/resources/models/screenshotCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/fileDiffModel.js reviewboard/static/rb/js/resources/models/repositoryBranchModel.es6.js reviewboard/static/rb/js/resources/models/repositoryCommitModel.es6.js reviewboard/static/rb/js/resources/models/validateDiffModel.es6.js reviewboard/static/rb/js/resources/models/baseCommentModel.es6.js reviewboard/static/rb/js/resources/models/screenshotCommentModel.es6.js reviewboard/static/rb/js/resources/models/generalCommentModel.es6.js reviewboard/static/rb/js/resources/models/diffCommentModel.es6.js reviewboard/static/rb/js/resources/models/draftResourceChildModelMixin.es6.js reviewboard/static/rb/js/resources/models/repositoryCommitModel.js reviewboard/static/rb/js/resources/models/repositoryBranchModel.js reviewboard/static/rb/js/resources/models/screenshotModel.es6.js reviewboard/static/rb/js/resources/models/reviewModel.es6.js reviewboard/static/rb/js/resources/models/fileDiffModel.es6.js reviewboard/static/rb/js/resources/models/repositoryModel.es6.js reviewboard/static/rb/js/resources/models/baseResourceModel.es6.js reviewboard/static/rb/js/resources/models/diffCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentModel.es6.js reviewboard/static/rb/js/resources/utils/serializers.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/draftResourceChildModelMixin.js reviewboard/static/rb/js/resources/models/screenshotCommentModel.js reviewboard/static/rb/js/resources/models/draftFileAttachmentModel.es6.js reviewboard/static/rb/js/resources/models/diffModel.es6.js reviewboard/static/rb/js/resources/models/draftReviewRequestModel.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js reviewboard/static/rb/js/resources/models/reviewGroupModel.es6.js reviewboard/static/rb/js/resources/models/fileAttachmentModel.js reviewboard/static/rb/js/resources/models/reviewRequestModel.es6.js reviewboard/static/rb/js/resources/models/reviewModel.js reviewboard/static/rb/js/resources/models/apiTokenModel.js reviewboard/static/rb/js/resources/models/draftResourceModelMixin.es6.js reviewboard/static/rb/js/resources/models/baseCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/generalCommentReplyModel.es6.js reviewboard/static/rb/js/resources/models/apiTokenModel.es6.js reviewboard/static/rb/js/resources/models/screenshotModel.js reviewboard/static/rb/js/resources/models/draftReviewModel.es6.js reviewboard/static/rb/js/resources/models/repositoryModel.js reviewboard/static/rb/js/resources/models/defaultReviewerModel.es6.js reviewboard/static/rb/js/resources/models/reviewReplyModel.es6.js