public void TestJSHintOK() { string code = "function test(){ }"; JSHint.result[] result; result = JSHint.JSHINT(code); result.Should().Be.Null(); }
public void CanRunMultipleTimes_JSHINT() { for (var j = 0; j < 10; j++) { for (var i = 0; i < 10; i++) { string code = "if(test==0){alert(1);}"; JSHint.JSHINT(code); } } }
public void TestJSHintEvalIsEvil() { string code = "function test(){ eval(''); }"; JSHint.result[] result; result = JSHint.JSHINT(code); result.Should().Not.Be.Null(); result.Length.Should().Be.InRange(1, 9999); result[0].reason.Should().Contain("eval is evil"); }
public void TestJSHintOptions() { string code = "function test(){ if(true) return (/./).test(''); }"; JSHint.result[] result; result = JSHint.JSHINT(code, new JSHint.options { regexp = true, curly = true }); result.Should().Not.Be.Null(); result.Length.Should().Be.InRange(1, 9999); result[0].reason.Should().Contain("Expected '{'"); }
public override void Run(string fullFileName, EnvDTE.ProjectItem projectItem) { var code = System.IO.File.ReadAllText(fullFileName); var results = JSHint.JSHINT(code, this.Settings.JsHintOptions); if (results != null) { foreach (var item in results) { if (item != null && projectItem.ContainingProject != null && TaskList.Instance != null) { TaskList.Instance.Add(projectItem.ContainingProject, Microsoft.VisualStudio.Shell.TaskErrorCategory.Warning, fullFileName, item.line, item.character, item.reason); } } } }