Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make our output JS less terrible. #31

Merged
merged 3 commits into from Aug 9, 2017
Merged

Conversation

patricksrobertson
Copy link
Contributor

This reforms our template output so it's a bit more ES6-7 compatible.

Copy link
Contributor

@alexrothenberg alexrothenberg left a comment

Choose a reason for hiding this comment

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

If we're going all in with ES6 we should probably do a major version bump just in case anyone else is using braise.

Also what do you think of publishing our eslint standards?

const modelName = this.constructor.modelName;
const adapter = this.store.adapterFor(modelName);
return adapter.autocomplete(modelName, this.get('id'), arguments).then((response) => {
const serializer = _this.store.serializerFor(modelName);
Copy link
Contributor

Choose a reason for hiding this comment

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

is _this unnecessary now that we're using => function ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not 100% sure the anon function works there with how Ember does things :(. Will test it out.

var underscorized = Ember.String.underscore(type);
return Ember.String.pluralize(underscorized);
pathForType(type) {
var underscorized = EmberString.underscore(type);
Copy link
Contributor

Choose a reason for hiding this comment

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

const ?

@@ -93,7 +96,7 @@ defmodule Braise.AdapterTemplate do
action_name = link_action.name
method = link_action.method
"""
#{action_name}: function(modelName, id, snapshot) {
#{action_name}(modelName, id, snapshot) {
var url = this.buildURL(modelName, id) + '/#{action_name}';
Copy link
Contributor

Choose a reason for hiding this comment

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

const ?

@@ -57,12 +60,15 @@ defmodule AdapterTemplateTest do
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, EmberString: String } = Ember;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be the other way

const { computed, String: EmberString } = Ember;

@@ -74,7 +80,7 @@ defmodule AdapterTemplateTest do
return this._super(url, type, options);
},

cancel: function(modelName, id, snapshot) {
cancel(modelName, id, snapshot) {
var url = this.buildURL(modelName, id) + '/cancel';
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're ES6'ing all this should we standardize to use let or const here (& everywhere else) too?

@alexrothenberg alexrothenberg merged commit 6729bdb into master Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants