Comments (2)
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.
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)
- Have the same exception possibilities of arguments on arrays. HOT 5
- ArrayLiteralSpacing > Exceptions > firstElement > allowElementPrecedingWhitespaces fails. HOT 2
- VariableDeclarationPerScopeConventions -> requireInTheBeginning reports functions without any variables HOT 1
- ArrayLiteralSpacing Strange Behavior HOT 3
- Windows - Maximum call stack size exceeded HOT 1
- Spaces around function declarations vs. function invocation parens HOT 5
- Add sniff for whitespace around control flow statements HOT 3
- ArgumentsSpacing Exception isn't working HOT 3
- Relax indentation rule(s) for JSDoc comments HOT 1
- Support for something like .jshintignore HOT 1
- Support for inline silencing of certain errors HOT 2
- Wrong EmptyConstructsSpacing validation HOT 1
- Custom standart as path
- Missing a colon in "readme documentation"
- ES6 support HOT 1
- ArgumentsSpacing Exception (firstArg > allowArgPrecedingWhitespaces) doesn't seem to work. HOT 8
- Certain keywords preceded or followed by a new line. HOT 2
- Enable the same options for parameterspacing as for argumentspacing. HOT 6
- ifNesting of argumentSpacing should accept the same configuration as its parent. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jscodesniffer.