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

lintspelljs

v0.0.8

Published

Library to spell check variables and identifiers on javascript

Downloads

90

Readme

lintspelljs

Module to spell check your js files. lintspelljs checks inside your comments, strings, and on each part of the identifiers splitting up the subwords on a camelCased or snake_cased string.

Installation

The package is not published yet to npm but there is a plan to do so. To insall you should clone this repo and then npm install it directly from the folder.

npm install lintspelljs

Usage

lintspelljs works from the comm and line using a simple CLI interface

lintspelljs <filename>

Output

Checking Spelling on: spellchecklint-cli.js
You have a mispelled Identifier JsSpellChecker mispelled: Js On Line: 4
You have a misspelled word on a String spellcheckvars On Line: 23
You have a misspelled word on a Comment spellcheckvars On Line: 24

Usage as a module

lintspelljs could be used as a module to check js files. Check lintint (https://www.npmjs.com/package/lintint) for an example of usage.

var spellCheckerLib = require('lintspelljs');
var options = {
    color: false
};
var spellChecker = new spellCheckerLib.JsSpellChecker(options);
var results = spellChecker.checkString('var variavle_fisrt = 1 + funktionKall(); // Tetsing');

Results will contain an Array of Objects with the following format:

{
    type: <<String>>, // The type of the parsed string (one of 'identifier', 'string', 'comment')
    message: <<String>>, // There are three possible messages
    line: <<Integer>>, // The line number for the parsed string
    word: <<String>>, // The word which is checked
    misspelled: <<Boolean>> // The result of the spell check (true if the word is misspelled) 
}

Default options

{
    checkers: ['identifier', 'string', 'comment'], // locations where to check words
    color: true, // If true, return colored and bold messages
    hideSuccessful: true, // If true, return only the misspelled results
    skipWords: [] // Additional words to ignore and do not mark as misspelled 
}

Test

lintspelljs uses mocha for testing and chai for assertions. You should have mocha installed globally to run tests.

npm install -g mocha

And to run the test you can use:

npm test

Dictionaries

To spell check each string lintspelljs is using the hunspell-spellchecker. And for dictionaries the openoffice en_US files.