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

@phoenix-plugin-registry/ws-sanitizer

v1.2.1

Published

Bring sanity to your white spaces and tabs leveraging Brackets settings

Downloads

3

Readme

White Space Sanitizer

Bring sanity to your code by keeping your indentation (spaces and tabs) consistent; the white space sanitizer.

White Space Sanitizer goes well with Show Whitesapce.

Features

  • Trims trailing white spaces
  • Ensures newline at the end of the file
  • Uses Brackets preferences for tabs and spaces, including configured units (2 spaces, 4 spaces, etc.)
  • Gracefully handles mixed tabs and spaces
  • Sanitize on file save
  • Sanitize on file open

Options

  • brackets-wsSanitizer.autosave [true] - Setting to automatically sanitize and save corrections on document save. If disabled, the conversion will need to be manually initiated via the notification bar.
  • brackets-wsSanitizer.enabled [true] - Setting to enable/disable sanitizing documents.
  • brackets-wsSanitizer.newline [true] - Setting to enable/disable adding a new line at the end of the file.
  • brackets-wsSanitizer.notification [true] - Setting to enable/disable notifications when the current document has inconsistent tabs, spaces, or no new line at the end of the file.

Brackets Preferences

White Space Sanitizer leverages Brackets preferences, which means that you can specify per project settings by defining a .brackets.json in the root directory of your project. With Brackets preferences you can even define per file settings, which is really handy when dealing with third party libraries that may have different white space requirements than the rest of your project.

White Space Sanitizer also support per language settings, which enables you to enable/disabled sanitizing your documents using the Brackets language layer. For more information on the preferences system, you can read up on this link.

The sample .brackets.json below enables White Space Sanitizer for every file, with indentation of 2 white spaces. The configuration file also defines a path that disables White Space Sanitizer for sanitize.js, uses tabs, and each tab is 4 spaces. Furthermore, you will be asked if you want to sanitize your documents when you open them.

Brackets per file settings cannot be configured as a user preference (globally); they can only be configured at the project level (project preference). Please read this issue for details.

.brackets.json with path settings

{
    "spaceUnits": 2,
    "useTabChar": false,
    "brackets-wsSanitizer.enabled": true,
    "brackets-wsSanitizer.newline": true,
    "brackets-wsSanitizer.notification": true,
    "path": {
        "Brackets-wsSanitizer/src/sanitize.js": {
            "useTabChar": true,
            "tabSize": 4,
            "brackets-wsSanitizer.enabled": false
        }
    }
}

.brackets.json with language settings

{
    "language": {
        "javascript": {
            "useTabChar": false,
            "tabSize": 4,
            "spaceUnits": 4,
            "brackets-wsSanitizer.enabled": true,
            "brackets-wsSanitizer.notification": true
        },
        "json": {
            "useTabChar": false,
            "tabSize": 4,
            "spaceUnits": 4,
            "brackets-wsSanitizer.enabled": false,
            "brackets-wsSanitizer.newline": false,
            "brackets-wsSanitizer.notification": true
        }
    }
}

For more information on Brackets preferences, please checkout this example.

How to...

Enable/Disable: enable/disable ss

Notification: enable/disable ss

Credits

Thanks to Dimitar Bonev for his work on whitespace normalizer