jslint eval can be harmful for Angular and DHXGantt sample

Hi All,

I am getting the JsLINT error " jslint eval can be harmful" for the following piece of code
var template = Function(‘sd’, ‘ed’, ‘task’, ‘return "’ + templateHelper($element) + ‘"’);

provided at dhtmlx.com/blog/gantt-chart- … tmlxgantt/

Is there any alternatives I can use to avoid such an error?

function templateHelper($element) {
    var template = $element[0].innerHTML;
    return template.replace(/[\r\n]/g, "").replace(/"/g, "\\\"").replace(/\{\{task\.([^\}]+)\}\}/g, function(match, prop) {
        if (prop.indexOf("|") != -1) {
            var parts = prop.split("|");
            return "\"+gantt.aFilter('" + (parts[1]).trim() + "')(task." + (parts[0]).trim() + ")+\"";
        }
        return '"+task.' + prop + '+"';
    });
}
app.directive('ganttTemplate', ['$filter', function($filter) {
    gantt.aFilter = $filter;

    return {
        restrict: 'AE',
        terminal: true,

        link: function($scope, $element, $attrs, $controller) {
            var template = Function('sd', 'ed', 'task', 'return "' + templateHelper($element) + '"');
            gantt.templates[$attrs.ganttTemplate] = template;
        }
    };
}]);

I am getting the JsLINT error " jslint eval can be harmful" for the following piece of code

Code of gantt creates the optimized template functions from the HTML markup. It is a valid use-case for Function constructor.