GithubHelp home page GithubHelp logo

Gulp plugin about jscodesniffer HOT 2 CLOSED

dsheiko avatar dsheiko commented on June 18, 2024
Gulp plugin

from jscodesniffer.

Comments (2)

dsheiko avatar dsheiko commented on June 18, 2024

You can go with high-level interface with the report in stdout:

var argv = [ "node", "jscs", "./source-dir/", "--standard=Jquery", "--report-full" ],
        jscodesniffer = require( "jscodesniffer" );

jscodesniffer( argv, process.cwd() );

Or with low-level one:

var Sniffer = require( "./lib/Sniffer" ),
        sniffer = new Sniffer(),
        src = "var a= 1;",
        options = {
            standard: "Jquery"
        },
        logger = sniffer.getTestResults( src, options, {} );

console.log(logger.getMessages());

/*
  [ { sniff: 'OperatorSpacing',
    errorCode: 'OperatorPrecedingWhitespaces',
    range: [ 5, 5 ],
    loc: {  start: { line: 1, column: 5 }, end: { line: 1, column: 5 }  },
    payload:
     { actual: 0,
       expected: 1,
       excerpt: '',
       trace: '..a=..',
       where: '<' } } ]

*/

from jscodesniffer.

jedrichards avatar jedrichards commented on June 18, 2024

Great that's exactly what I needed, thank you. FYI the Gulp plugin is coming along well. It isn't published to npm yet but here's a heads up:

https://github.com/jedrichards/gulp-jscodesniffer

from jscodesniffer.

Related Issues (20)

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.