Comparing version 0.0.3 to 0.0.4
22
index.js
@@ -1,2 +0,2 @@ | ||
#!/usr/bin/env node | ||
#!/usr/local/bin/node | ||
/*jshint node:true */ | ||
@@ -6,4 +6,4 @@ 'use strict'; | ||
var fs = require('fs'), | ||
path = require('path'), | ||
lint = require('jshint').JSHINT, | ||
opts = require('./jshint-flags'), | ||
bbresults = require('bbresults'), | ||
@@ -14,8 +14,23 @@ | ||
function getOptions(dir) { | ||
var candidate, opts; | ||
if (dir === '/') { | ||
opts = require('./jshint-flags'); | ||
} | ||
if (fs.existsSync(candidate = path.join(dir, '.jshintrc'))) { | ||
opts = JSON.parse(fs.readFileSync(candidate)); | ||
} | ||
return opts || getOptions(path.join(dir, '..')); | ||
} | ||
function run(err, str) { | ||
if (err) { | ||
bbresults.notify('error, reading ' + pathname, {title: title}); | ||
} else if(lint(str, opts)) { | ||
} else if(lint(str, getOptions(path.dirname(pathname)))) { | ||
bbresults.notify(pathname + ' is lint free', {title: title}); | ||
} else { | ||
@@ -29,2 +44,3 @@ bbresults.show(lint.errors, pathname, title); | ||
bbresults.notify('please save the document and try again', {title: title}); | ||
} else { | ||
@@ -31,0 +47,0 @@ fs.readFile(pathname, 'utf-8', run); |
{ | ||
"name": "bbjshint", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Run JSLint on BBEdit's frontmost text document.", | ||
@@ -30,3 +30,4 @@ "bin": "index.js", | ||
"author": "Isao Yagi <isao.yagi@gmail.com>", | ||
"contributors": ["Nate Silva (https://github.com/natesilva)"], | ||
"license": "MIT" | ||
} |
@@ -1,2 +0,2 @@ | ||
BbJsHint <!-- [![Build Status](https://travis-ci.org/isao/bbjshint.png)](https://travis-ci.org/isao/bbjshint) --> | ||
bbjshint | ||
======== | ||
@@ -8,15 +8,21 @@ | ||
Install | ||
install | ||
------- | ||
npm i -g bbjshint | ||
cd path/to/your/Application\ Support/BBEdit/Scripts | ||
Use from BBEdit's Scripts menu by either installing or symlinking `bbjshint` to BBEdit's Scripts folder. This is `~/Library/Application Support/BBEdit/Scripts` or perhaps `~/Dropbox/Application Support/BBEdit/Scripts`. You can show this folder from BBEdit by going to the scripts menu and choosing "Open Scripts Folder". | ||
npm install --global bbjshint | ||
cd ~/Library/Application\ Support/BBEdit/Scripts | ||
ln -s `which bbjshint` | ||
Acknowledgements | ||
contributors | ||
------------ | ||
[Nate Silva](https://github.com/natesilva) | ||
acknowledgements | ||
---------------- | ||
See [bbresults](https://github.com/isao/bbresults). | ||
License | ||
license | ||
------- | ||
MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4198
86
28