Git Product home page Git Product logo

jshint.tmbundle's Introduction

#JSHint TextMate Bundle

TextMate bundle for JSHint, the (Gentler) JavaScript Code Quality Tool.

Screenshot

Features:

  • Pretty UI
  • Runs automatically upon save (⌘S)
  • Can be bypassed by pressing ⇧⌘S
  • JSHint can be run by itself by pressing ^⇧L
  • Output is only shown when errors are found
  • Window is automatically closed when it looses focus
  • Window with error list is closed when all errors are fixed and saved or checked again
  • Uses custom JSHint options if .jshintrc found in current dir, TextMate project, or User Home
  • Auto-updates itself to the latest version of JSHint
  • Based on Node.js

Installation

Download the zip file and rename the extracted folder to jshint.tmbundle. Double-click.

Prerequisites

You need Node.js and TextMate, that's all.

This bundle uses #!/bin/env node to launch the node process. If you get a node - not found error, the PATH variable is probably not setup properly in TextMate (this happens when you start TextMate via the Finder rather than from the command-line). Either add or extend the PATH variable in TextMate preferences to include path to node binary.

You can set the PATH either via Preferences → Variables or by editing ~/.MacOSX/environment.plist.

Example: When installed with homebrew, path to node is /usr/local/bin/node. If jshint.tmbundle can't find executable node add /usr/local/bin to existing TextMate PATH:

PATH    $PATH:/usr/local/bin

TODO

Consider including/updating a local copy of latest stable JSHint installed using node/npm instead of automatically downloading source files directly from JSHint repo.

Contributors

jshint.tmbundle's People

Contributors

bpierre avatar etgryphon avatar fgnass avatar kmiyashiro avatar rob-ot avatar stepheneb 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

Watchers

 avatar  avatar  avatar  avatar

jshint.tmbundle's Issues

working on adding ability to run jshint on unsaved content in document

I've made a separare pull request #14 that updates the url for where jshint.js is downloaded and I'm working on adding the ability to run jshint on unsaved content in a document.

The project I am working on builds and tests after file saves and I often want to be able to run jshint on the content in the current doc before I have saved it.

In a local branch I've added a Hint command which is just a simple variation of the Hint and Save command. This works ... but it only checks content that has already been saved.

I looked through other bundles that do something similar and noticed that the HTML bundle will show previews of new document content that is not already saved. I posted this question on their issue tracker: how does the html bundle preview a document with unsaved changes?

It seems like for this to work they'd need to make a temporary file ... but I'm not sure how they are doing that.

I'm noticing two differences in the HTML Show Web Preview command.

  1. It ends with the shell command cat
  2. The output key is set to showAsHTML

In jshint_tm.js you are streaming to console (stdout) and then exiting with status 205:

process.exit(205); //show_html

https://github.com/fgnass/jshint.tmbundle/blob/master/Support/jshint-tm.js#L94-L99

I don't know exactly how/where the exit status 205 results in a show_html operation. I've looked in the textmate source and not found something that looks for this process exit status and generates an html view. Is this part of textmate or something in the OS?

I think the simplest way to get Hint (without saving) working is to:

  1. Add an optional filepath argument to jshint-tm.js which is used instead of env.TM_FILEPATH
  2. If the current doc contents are modified save a tmp file of the current doc and pass tmp file path to jshint-tm.js invocation.

Unable to execute JSHint

Hi,

When I execute Save & Hint I get the following error:

module.js:340
    throw err;
          ^
Error: Cannot find module '../data/ascii-identifier-data.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/tito/Library/Application Support/Avian/Pristine Copy/Bundles/jshint.tmbundle/Support/lex.js:12:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

I have verified that PATH looks like this:

$PATH:/opt/local/bin:/usr/local/bin:/usr/texbin

Node is also setup properly:

Alpha:test_app tito$ which node
/usr/local/bin/node
Alpha:test_app tito$ 

Any idea why it's not working? Thanks!

no file or directory?

I'm running TextMate version 2.0-alpha.9475 on OSX 10.8.5 and my node is installed with brew in

[rails 3] which node
/usr/local/bin/node
[rails 3] ls -la /usr/local/bin/node
lrwxr-xr-x  1 walther  admin  31  9 Sep 17:29 /usr/local/bin/node -> ../Cellar/node/0.10.13/bin/node

and I even tried making the node

[rails 3] ln -s /usr/local/Cellar/node/0.10.13/bin/node node

My PATH in TextMate is $PATH:/opt/local/bin:/usr/local/bin:/usr/texbin

and yet, when I do a CMD-S JsHint complains with

Failure running Save & Hint
env: node no such file or directory

any leads, hints, links would make my day <:)

404 Error on every save

looks like you jshint url is wrong, should be hitting: /jshint/jshint/master/src/stable/jshint.js

doesn't read inline config

Depending upon the project I'm working on, there may be different rules. The bundle should give priority to the inline configuration of the file.

/*jshint asi: true, curly: false */
var stuff = 'whatever'
// etc.

Crashing textmate 2

I'm running the latest nightly build of TM2 (9300), and whenever I save a js file with this bundle enabled, Textmate crashes. Specifically, the window shrinks to 1/2 the screen, it shows some results, then if I click on the window again, it closes.
Not sure if this is JsHint specific or a general bug in Textmate, but I haven't seen it happen with other bundles.

Error: Cannot find module './parser.js'

Failure running “Save & Hint”.

module.js:340
throw err;
^
Error: Cannot find module './parser.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object. (/Users/jm019641/Library/Application Support/Avian/Pristine Copy/Bundles/jshint.tmbundle/Support/jshint.js:4:14)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)

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.