Git Product home page Git Product logo

Comments (4)

rhysbrettbowen avatar rhysbrettbowen commented on July 19, 2024

Just tried pasting advice in to http://www.jshint.com/ and only warning I'm getting is that "define" is not declared. Can you shoot me the actual warnings? The jshint file I use to lint is included in the rep: https://github.com/rhysbrettbowen/Backbone.Advice/blob/master/.jshintrc so maybe just having that in the folder with advice will help

from backbone.advice.

parris avatar parris commented on July 19, 2024

Ahh this isn't necessarily about the source code of Advice itself, but rather implementing a mixin. Take for example this mixin:

define(function() {
   'use strict';

    function addMixin() {
        this.setDefaults({});
        this.after('initialize', function() {});
    }

    return addMixin;
});

Both times this is referenced we get a "Possible strict violation.". This makes sense since this ends up referring to something JSHint doesn't expect. I guess I could do something like following:

define(function() {
   'use strict';

    var mixin = {
        add: function() {
             this.setDefaults({});
             this.after('initialize', function() {});
        }
    }; 

    return mixin.add;
});

I was wondering if you've found a better way?

from backbone.advice.

parris avatar parris commented on July 19, 2024

Interestingly enough this seems to pass:

define(function() {
   'use strict';

    var namer = function() {
        this.setDefaults({});
        this.after('initialize', function() {});
    }

    return namer;
});

However, this can result in an unnamed function in older browsers :/. Maybe not so important.

from backbone.advice.

parris avatar parris commented on July 19, 2024

Closing.. ha

from backbone.advice.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.