Reputation: 107
Well for the first time today I seem to have asked a question that isn't immediately highlighted as a duplicate!
I'm working my way through alot of the error messages that JSLint is giving me and trying to solve them.
I've got several that are telling me I have bad property names, if you're curious they are :
I have a feeling it's due to the $ sign at the start but why would that be a problem? as far as I was aware it's quite common practice to cache jQuery objects using $ at the start of the variable name.
Anyway I'd naturally prefer to correct this error with something that conforms to a good standard however if it's just one of those things that people can live with, is there a way of telling jslint to ignore these?
Thanks
EDIT: I can't share the whole class since it's being used in a project by the company I work for but here is the render function where alot of these properties are set.
render: function () {
TextImage.prototype.render.call(this);
var $slider = this.$wrapper.find('.in-panel');
this.$wrapper = this.$el.find('.panel');
this.$labelWrapper = this.$wrapper.find('.in-panel');
this.$feedbackWrapper = this.$wrapper.find('.text');
this.$feedback = this.$feedbackWrapper.find('.feedback');
this.$feedbackWrapper.addClass("hidden");
this.itemIndex = -1;
this.createSlider($slider);
},
Upvotes: 3
Views: 1612
Reputation: 1574
If you run this code in JSlint you will see, it does not like properties that start with $, _ and probably other non letter symbols.
The ones I found: it does not like properties that CONTAIN $ (it likes variables though) it does not like properties that start with _ though they can contain I encourage you to do a more extensive search. If you copy paste these you will see some examples of when it complains
var a = 23;
var $b = 24;
var c = {};
c.$a = 4;
c.a$t = 5;
c.c_a = 6;
c._a = 53;
c._d = 25;
c.this = 32;
c.window = 55;
Upvotes: 1