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

lesshint-antd

v1.2.1

Published

A tool to aid you in writing clean and consistent Less.

Downloads

5

Readme

lesshint

Build Status Build status Coverage Status Dependency Status devDependency Status

lesshint is a tool to aid you in writing clean and consistent Less.

Requirements

Node.js 0.10 (or later) or io.js 1.0 (or later).

Installation

Run the following command from the command line (add -g to install globally):

npm install lesshint

Configuration

lesshint is customizable and we highly recommend you to look at the available options to tailor it to your needs.

Start by creating a .lesshintrc file in your project root and add your settings to it. It will be automatically loaded and merged with the default values.

Each option is then specifed by it's own JSON object, for example:

"fileExtensions": [".less", ".css"],

"excludedFiles": ["vendor.less"],

"spaceAfterPropertyColon": {
    "enabled": true,
    "style": "one_space" // Comments are allowed
}

Options

fileExtensions

Array of file extensions to check. Either an array of extensions or "*" to allow all files. For example:

"fileExtensions": [".less", ".css"] // Allow ".less" and ".css" files. Can be passed with or without a dot.

"fileExtensions": "*" // Allow all files

excludedFiles

Array of minimatch glob patterns or a file to exclude. For example:

"excludedFiles": ["vendor/*.less"] // Ignore all files in "vendor/"

"excludedFiles": ["vendor.less"] // Ignore a file named "vendor.less"

CLI usage

Run lesshint from the command-line by passing one or more files/directories to recursively scan.

lesshint src/less/ lib/style.less

Available Flags | Description --------------------|---------------------------------------------- -c/--config | Specify the configuration file to use (will be merged with defaults). -e/--exclude | A minimatch glob pattern or a file to exclude form being linted. -r/--reporter | The reporter to use. See "Reporters" below for possible values. -V/--version | Show version.

Reporters

As of 0.8.0 the ability to specify custom reporters has been added. These can do anything from just printing something to the terminal to generate custom reports.

There are three ways to load a reporter.

  1. Pass the name of a core reporter. See below for a complete listing.
  2. Pass the name of a Node module. If lesshint is installed globally only globally installed reporters are available (the normal Node module loading rules apply).
  3. Pass a absolute or relative path to a custom reporter anywhere on the disk. Relative paths will be resolved against process.cwd().

Core reporters

  • stylish - Colored print of all errors to the console.

Writing your own reporter

In it's simplest form, a reporter is just a function accepting some input. The most basic reporter possible:

module.exports = {
    report: function (errors) {
        console.log(errors.length ? 'Errors found' : 'No errors');
    }
};

// Old usage, deprecated as of 1.2.0:
module.exports = function (errors) {
    console.log(errors.length ? 'Errors found' : 'No errors');
};

The reporter will be passed an array of objects representing each error:

{
    column: 5,
    file: 'test.less',
    line: 1,
    linter: 'spaceBeforeBrace',
    message: 'Opening curly brace should be preceded by one space.',
    severity: 'warning',
    source: '.foo{'
}

It's then up to the reporter to do something with the errors. No returns or anything is needed. lesshint will handle everything like exit codes etc.

Take a look at the default reporter for more information.