Lint Blaze callBacks Question


#1

Hello,

For linting, es6 wants you to use arrow functions…in Blaze for onCreated / onRendered you usually use a normal function because of this reference…

Any rule that can be applied to make an exception for those callbacks?

Thanks


#2

I use

/* eslint-disable */
// some stuff
/* eslint-enable */

Which is the block way to disable eslint.

For a single line you can use:

// eslint-disable-line no-use-before-define

#3

Hey thanks for the advise,

definitely a possibility, although finding a rule would be nice considering the two callback are used in almost every template


#4

I see.

What eslint config are you using? I’ve used some rules defined here: https://github.com/meteor/module-todos-react/blob/master/.eslintrc-meteor before with good luck


#5

alright ill take a look, thanks!


#6

seems like linting only gives me an error if i leave the function empty…

I normally just write out all the functions in the js template before filling them so I did not catch it until now…so does not seem to be a problem after all :smiley:

thank you though