npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-jshint-react

v0.6.1

Published

jshint for react

Downloads

4

Readme

NPM

Like grunt-contrib-jshint but compatible with react's jsx

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-jshint-react --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-jshint-react');

Jshint task

This grunt plugin works exactly like grunt-contrib-jshint. In fact it's even using grunt-contrib-jshint. The only difference to grunt-contrib-jshint is that this plugin runs require('babel').transform on every file passed in. This will transform the jsx syntax to regular JavaScript. Non jsx-files will be unchanged. Line numbers are preserved by jsx so the line numbers outputted by jshint will be correct.

This is a drop in replacement for grunt-contrib-jshint. So you can just replace the grunt-contrib-jshint dependency in your package.json with grunt-jshint-react.

grunt-jshint-react needs babel to work. If you don't have babel installed run

npm install babel --save-dev

Use exactly like grunt-contrib-jshint:

jshint: {
  //Everything like in grunt-contrib-jshint
}

Parsed filed extensions

By default, your jsx files need to have a .jsx or .react.js file extension. In order to parse other files, add the following into your jshint options object:

jshint: {
    options: {
        jshintrc: '.jshintrc',
        ignores: [],
        additionalSuffixes: ['.js']
    },
}

These suffixes are concatenated onto .jsx and .react.js.

Contributing

If grunt-jshint-react is lacking a feature or if you found bug (or a typo in the README) feel free to submit a pull request or file an issue.

Release History

  • 2015-04-07   v0.6.0   Add additionalSuffixes option.
  • 2015-02-06   v0.5.0   Update dependencies and remove /** @jsx React.DOM */
  • 2014-10-29   v0.4.0   Add support for .react.js suffix
  • 2014-08-14   v0.3.0   Improve error messages. Use locally installed react-tool.
  • 2014-08-04   v0.2.0   Add check for /** @jsx React.DOM */. Upgrade react-tools.
  • 2014-07-15   v0.1.0   Stop transforming non jsx files.
  • 2014-07-12   v0.0.3   Use absolute version of grunt-contrib-jshint.
  • 2014-06-20   v0.0.2   Add MIT licence. Update README.
  • 2014-06-19   v0.0.1   Initial version.