Giter Site home page Giter Site logo

benquarmby / jslintnet Goto Github PK

View Code? Open in Web Editor NEW
78.0 16.0 11.0 5.86 MB

JSLint.NET is a wrapper for Douglas Crockford's JSLint, the JavaScript code quality tool. It can validate JavaScript anywhere .NET runs.

License: Apache License 2.0

C# 96.43% HTML 0.11% CSS 0.07% JavaScript 3.39%

jslintnet's Introduction

Build status

Install

JSLint.NET for MSBuild

This NuGet package wires up targets to any Visual Studio project for development and CI time JavaScript validation. Run the following command from the package manager console to install:

PM> Install-Package JSLintNet.MSBuild

JSLint.NET for Visual Studio

Provides a richer IDE experience for Visual Studio 2012, 2013 and 2015, with underlined warnings and the ability to validate automatically on save and build. Can function side by side with the MSBuild package.

Download it from the Extensions and Tools dialog within Visual Studio or from the Visual Studio Gallery.

Other Releases

Stand alone binaries together with a command line runner are available on the releases page.

Configuration

JSLint.NET can be configured with common options for an entire project or solution. See the Settings page for more information.

jslintnet's People

Contributors

benquarmby avatar madskristensen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jslintnet's Issues

Replace "Run on build" setting in Visual Studio

The "Run on build" setting in JSLint.NET for Visual Studio can be quite confusing when coupled with the MSBuild targets of the NuGet package. They don't apply across both. The NuGet package is also far better and more consistent way to run JSLint on build.

Remove the "Run on build" and "Cancel build" settings and replace them with a way to install the NuGet package within Visual Studio instead.

Bad property name on angularjs property/methods

I am using angularjs along with jslint.net in my aspnet application.

When using angularjs stuff like "$watch", "$inject", "$promise", etc I get the jslint error "Bad property name". Since I am using warnings as errors this is preventing me to compile the project.

Since angularjs is built this way and I'm perfectly fine with this there should be a way to turn this validation off, as we can turn off other validations, using the json file.

This problem is forcing me to downgrade to v 1.8.

Cannot ignore multiple parameters in JSLint.NET

Hi there, I'm using Semantic UI and one of the function callbacks requires three parameters and in this particular usage I am only interested in the third parameter.

self.ClearVariation = function(value, text, $choice) {
//code
};

In this instance I am only interested in $choice
I can change value to ignore and JSLint will ignore this, but changing text to ignore1 or some derivation of that does not.

I am using Visual Studio 2015 if that helps.
How should I properly suppress this warning?

Allow mapping JSLint codes to specific output types

Currently it's possible to output all JSLint violations as either Errors, Warnings or Messages in Visual Studio and MSBuild. However, there is no way to mark some errors as higher or lower priority.

Allow users to specify a custom output map in the settings file, similar to the following:

{
    "output": "Error", // Default output type
    "outputMap": {
        "bad_property_a": "Message" // Specific output type
    }
}

Create a readme.

Self explanatory. Create a readme.md to act as the new home page for JSLint.NET.

Document CI / build server requirements

It is not currently clear what the requirements are for successfully running JSLint.NET for MSBuild on a CI or build server. This results in issues like #17.

Add a wiki page to describe the requirements.

JsLint.net for web site projects

Is it possible to use the nuget-version on web site projects?
I specifically need my CI server to run the the jslint on build.

jslint 2.0.1 & Angular

How am I supposed to use the new version of JSLint.net with angular? Basic functionality like $watch no longer validates.

scope.$watch('myVariable',function(){});

Is it possible to get specific errors as warnings, but not all output?
I don't want output like "Quotes are not needed around 'something'" to output as error, this line is in a localization file with a lot of text where most of the lines have spaces or something else that requires the quotes. I want consistent properties and half of them with quotes and half without.

{
    'Word':'Ord',
    'This is a sentance':'Detta är en mening'
}

How should I handle unused parameters now when I can't ignore specific lines?

var fn = function (ignore, ignore, b) {
       return b+1;
};

Errors building from scatch in VS 2015.1

After cloning from GitHub, opening JSLint.NET.sln, and building, the following errors come up. Is there a list of steps to take on first run?

In summary of the errors, some folders such as source\JSLintNet\bin\Debug and submodules\JSLint\jslint.js are empty but files are expected to exist within them.

Error       Metadata file 'C:\Users\Josh\Desktop\NuGet\jslintnet\source\JSLintNet\bin\Debug\JSLintNet.dll' could not be found   JSLintNet.QualityTools  C:\Users\Josh\Desktop\NuGet\jslintnet\specifications\JSLintNet.QualityTools\CSC     
Error       Invalid Resx file. Could not find file 'C:\Users\Josh\Desktop\NuGet\jslintnet\submodules\JSLint\jslint.js'. Line 129, position 5.   JSLintNet   C:\Users\Josh\Desktop\NuGet\jslintnet\source\JSLintNet\Properties\Resources.resx    129 
Error       Metadata file 'C:\Users\Josh\Desktop\NuGet\jslintnet\source\JSLintNet.Console\bin\Debug\JSLintNet.Console.exe' could not be found   JSLintNet.Console.Specifications    C:\Users\Josh\Desktop\NuGet\jslintnet\specifications\JSLintNet.Console.Specifications\CSC       
Error       Metadata file 'C:\Users\Josh\Desktop\NuGet\jslintnet\source\JSLintNet\bin\Debug\JSLintNet.dll' could not be found   JSLintNet.Console   C:\Users\Josh\Desktop\NuGet\jslintnet\source\JSLintNet.Console\CSC      
Error       Metadata file 'C:\Users\Josh\Desktop\NuGet\jslintnet\source\JSLintNet\bin\Debug\JSLintNet.dll' could not be found   JSLintNet.Console.Specifications    C:\Users\Josh\Desktop\NuGet\jslintnet\specifications\JSLintNet.Console.Specifications\CSC       
Error       Metadata file 'C:\Users\Josh\Desktop\NuGet\jslintnet\source\JSLintNet\bin\Debug\JSLintNet.dll' could not be found   JSLintNet.Specifications    C:\Users\Josh\Desktop\NuGet\jslintnet\specifications\JSLintNet.Specifications\CSC       
Error       Metadata file 'C:\Users\Josh\Desktop\NuGet\jslintnet\specifications\JSLintNet.QualityTools\bin\Debug\JSLintNet.QualityTools.dll' could not be found JSLintNet.Console.Specifications    C:\Users\Josh\Desktop\NuGet\jslintnet\specifications\JSLintNet.Console.Specifications\CSC       
Error       Metadata file 'C:\Users\Josh\Desktop\NuGet\jslintnet\specifications\JSLintNet.QualityTools\bin\Debug\JSLintNet.QualityTools.dll' could not be found JSLintNet.Specifications    C:\Users\Josh\Desktop\NuGet\jslintnet\specifications\JSLintNet.Specifications\CSC       

Environment details:

  • Windows 10 x64
  • Visual Studio 2015 Update 1

Error when running with MsBuild

I am trying to compile my web project using MsBuild on a build server, and I am costantly getting this error:

error MSB4018: C:\Program Files (x86)\MSBuild\14.0\bin\amd64\v8-x64.dll: The specified module could not be found

The strange thing is that it shouldn't be looking for the clearscript library in that path, but in the JsLint.Net package path, where it is correctly located:

{{solutiondir}}\packages\JSLintNet.MSBuild.2.0.4\tools

The same project compiled with VS2015 works fine.

Can't get JsLintNet.MSBuild to process embedded resource file

I have some javascript files that are embedded resources (they are used with an external node.js process instead of the browser). I'd love to be able to lint these, but JsLintNet.MsBuild seems to ignore them. Is there a way to lint embedded resource js files?

Add "Run on open" feature to Visual Studio

It would be handy if JSLint could scan a file when it is opened in Visual Studio. This would complement linting on save.

Add a new setting for this feature. It should be off by default.

JSHint support?

Hello, just wondering if you're planning on adding support for using JSHint instead of JSLint?

Error when launching Visual Studio with JSLint.NET 2.0.1

When launching Visual Studio 2012 or 2013, a "JSLintPackage" error appears. This is because the VSIX was sourced from AppVeyor which has a later version of the VSSDK installed. Rebuild the artifact on a machine with the correct SDK to restore compatibility.

MSBuild fails when total error limit is reached

Hi Ben,

Thank you for the library. It's been working great except one thing. When the error amount exceeds default it fails the build with an error:

Total JSLint: error limit reached: 1001

Currently, I'd prefer not to fail the build at all. I'd like to show everything as warnings. I set "output": "Warning" in my JSLintNet.json and in my target I changed Error block to warning like so:

 <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Warning Condition="!Exists('..\..\packages\JSLintNet.MSBuild.2.3.0\build\JSLintNet.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\JSLintNet.MSBuild.2.3.0\build\JSLintNet.MSBuild.targets'))" />
  </Target>

It still shows "Total JSLint: error limit reached" as an error. Is this a bug?

JS Lint Build Errors

Hi ,

I have configure jslint from nuget manager in my visual studio 2013 and plateform is Windows server 2008 R2.
When I build solution then it shows an error while I converted all errors type into warnings and due to this error build is faild.
Error is : "Build canclled due to JSlint validation errors".
How can I resolve this so that i can see all errors only in warning, while all errors converted to warnings but still one error i got.
Please suggest me how can i resolve this

Documentation discrepancy between 1.x and 2.x

There seems to be no way to disable "Bad property name" warnings completely in 2.x and you suggested we should downgrade to 1.x so I did that. However, documentation is for 2.x and it seems to create problems. For example globalVariables doesn't work for 1.x and I have no idea what the new syntax should be. Thank you for this tool but this whole adventure of trial by errors needs some attention as well.

Add compatibility for Visual Studio 2015 for Web

I received this error on installation:

VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.

I'm using Visual Studio 2015 for Web, and it would be a great fit for this sort of extension, if possible.

[Request] x86 Releases

Hello, I would like to request that in the future x86 and x64 versions of the executables are released separately. I want this because if you run an executable built in AnyCpu on a x64 machine, it will default to x64, but I'd prefer to run in x86 because that's the only way I can seem to get it to run.

I was receiving the same issue seen in issue #8 until I built it myself to force x86.

Cancelling settings editor keeps changes in memory

When opening the JSLint.NET settings editor in Visual Studio, any changes stay in memory even if the cancel button is pressed. Even though the cancelled changes aren't persisted to the file system, they should revert back to how they were before opening the editor.

MSBuild error: module could not be found

When trying to run this from the VS context menu, I get the following error from VisualStudio:

Cannot load V8 interface assembly. Load failure information for v8-ia32.dll:
  C:\Users\me\AppData\Local\Microsoft\VisualStudio\11.0\Extensions\uo5tep2b.ksb\v8-ia32.dll:
    The specified module could not be found
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\v8-ia32.dll:
  The specified module could not be found

Sure enough, I don't have that DLL. I had hoped that the NuGet package would fail if I were missing a dependency. To be clear, I'm attempting to use this for a single-page-app, not for Node.JS; though, I do have Node.JS installed on the host machine, not coming from NuGet/VisualStudio.

Getting issue on run jslint click.

Hi Experts, I am getting error on run jslint click.
On first run error is : "Could not load file or assembly 'clearscriptv8' or one of its dependencies. An argument was out of its legal range. (Exception from HRESULT: 0x80131502)"
On second run and afterwards, Error is : "Length cannot be less than zero. Parameter name:length".
I have installed this jslint version from Visual Studio extensions manager.
And unfortunately, other older version of jslint for vs2015 is working fine for me.
But I was told to use this version of JSlint. Could you help me with solution ?
I remember older version was working fine for me in other project. But new version is not working somehow.

Add options to ignore "bogus" errors ...

Hello,

Please add options to ignore the following:

  1. "Out of Scope (ordering)"
    When function A is callled from function B, but A is declared AFTER B (ordering is NOT important in this regard).

  2. "Ignore Unexpected expression (++ / --)"
    Self explanatory.

ES6 Support

IE11 and the evergreen browsers (Firefox and Chrome) now support many features of ES6 such as keywords and types.

Application developers who are not required to support older browsers would like to write safe JavaScript code using these new features.

As Crockford is working on a new version of JSLint, JSLint.NET should be updated to work with ES6.

JSLint.net 2.1.0 does not ignore jslint warning/error messages results in files/folders.

Neither file scope "ignore file" or folder scope "ignore folder" items are working in JSLint.net 2.1.0.

For example, in an ExtJS codebase, I have configured ignore-folder for a folder containing some javascript files that are auto-generated by a remote-procedure-invocation tool. I am not going to go and remove all spurious semicolons or re-format the tool-generated code. If I could figure out how to emit an "/* ignoreme */" comment that could be respected by JSLint itself, that would be cool, but I currently don't know how to do that.

What would be great is if JSLint.net would just let JSLint do what it wants and then post-processing (after JSLINT itself reports errors) have it just not output into visual studio errors/warnings list the items where the file name is in the "ignored" file or folder set.

If this is a known issue and requires someone to work on it to implement it, I would be willing to try to implement it, make a fork and issue a pull request. (I'm not asking the author to spend his limited time fixing this if it only helps me, I'd be happy to try to fix it.)

It's also possible that (due to my newness to JSLint.net) I'm missing something obvious, or some obvious workaround or something.

My JSLint.net.json:

        {
        "version": "2.1.0",
        "output": "Warning",
        "ignore": [
            "indent",
            "no-extra-parens",
            "\\common\\src\\webservice\\dicomservice_Intf.js",
            "\\common\\src\\webservice\\DictationLibrary_Intf.js",
            "\\common\\src\\webservice\\emaildistribution_Intf.js",
            "\\common\\src\\webservice\\ImageSource_Intf.js",
            "\\common\\src\\webservice\\MobilePortal_Intf.js",
            "\\common\\src\\webservice\\PowerReader_Intf.js",
            "\\common\\src\\webservice\\PowerReaderCache_Intf.js",
            "\\common\\src\\webservice\\PowerReaderRODLTypes_Intf.js",
            "\\common\\src\\webservice\\prcacheroservice_Intf.js",
            "\\common\\src\\webservice\\Priority_Intf.js",
            "\\common\\src\\webservice\\reportinfo_Intf.js",
            "\\common\\src\\webservice\\RSAccessManagement_Intf.js",
            "\\common\\src\\webservice\\RSCommonTypes_Intf.js",
            "\\common\\src\\webservice\\RSDataSnapModule_Intf.js",
            "\\common\\src\\webservice\\RSDicomTypes_Intf.js",
            "\\common\\src\\webservice\\rulesbasedsystem_Intf.js",
            "\\common\\src\\webservice\\scheduler_Intf.js",
            "\\common\\src\\webservice\\studybookmark_Intf.js",
            "\\common\\src\\webservice\\viewerstorage_Intf.js",
            "\\common\\src\\webservice\\VolumeConfig_Intf.js",
            "\\common\\src\\webservice\\WADOLibrary_Intf.js",
            "\\common\\src\\webservice\\WebLibrary_Intf.js",
            "\\common\\src\\webservice\\Worklist_Intf.js",
            "\\common\\src\\webservice\\reportdistribution_Intf.js",
            "\\common\\src\\webservice\\"
        ],
        "options": {
            "browser": true,
            "for": true,
            "node": true,
            "this": true,
            "white": true
        },
        "globalVariables": [
            "Ext",
            "navigator",
            "Common",
            "RapidResults"
        ],
        "errorLimit": 999,
        "fileLimit": 999
        }

Not compatible with Cordova projects?

I have been using JSLint for a while in javascript projects edited with VS2013. But I am now experimenting with the Cordova plugins for VS2013 (and later VS2015), and JSLint won't run with any of the .js files in the project. I get the error message "The directory name [project path]\mymap.jsproj is invalid". But 'mymap.jsproj' isn't a directory, it's the VS project definition file.

However if I load a .js file that's not part of the project into the same IDE, jslint runs on that OK. It also runs OK on a javascript project that isn't based on Cordova.

It's not a problem with my particular project setup; the same issue occurs with a simple 'empty' project created by VS.

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.