# csshint

> lint your css code

Latest version **0.3.4** (published 2018-11-09) · 0 weekly downloads

## Install

```sh
npm install csshint
pnpm add csshint
yarn add csshint
bun add csshint
```

Provides the command `csshint`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.4 |
| Published | 2018-11-09 |
| First published | 2014-09-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 7 |
| Unpacked size | 693.8 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 27 |
| Maintainers | ecomfe, ielgnaw |
| Keywords | csslint, csshint |

## Links

- npm: https://www.npmjs.com/package/csshint
- Repository: https://github.com/ecomfe/node-csshint
- Homepage: https://github.com/ecomfe/node-csshint#readme
- Issues: https://github.com/ecomfe/node-csshint/issues
- npm.io page: https://npm.io/package/csshint

## Dependencies (7)

- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [manis](https://npm.io/package/manis.md) ^0.3.0
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.6.1
- [postcss](https://npm.io/package/postcss.md) ^5.2.0
- [edp-core](https://npm.io/package/edp-core.md) ^1.0.32
- [object-assign](https://npm.io/package/object-assign.md) ^4.1.0
- [strip-json-comments](https://npm.io/package/strip-json-comments.md) ^2.0.1

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 0.3.4 (latest) — 2018-11-09
- 0.3.3 — 2017-02-25
- 0.3.2 — 2016-10-30
- 0.3.1 — 2016-09-24
- 0.3.0 — 2016-09-19
- 0.2.8 — 2016-07-31
- 0.2.7 — 2016-04-05
- 0.2.5 — 2016-03-28
- 0.2.4 — 2015-12-24
- 0.2.3 — 2015-11-03
- 0.2.2 — 2015-10-30
- 0.2.1-beta.6 — 2015-10-30
- 0.2.1-beta.5 — 2015-09-08
- 0.2.1-beta.3 — 2015-08-03
- 0.2.1-beta.2 — 2015-07-29
- … 48 more at https://npm.io/package/csshint/versions

## README

CSSHint
===
[![csshint](https://travis-ci.org/ecomfe/node-csshint.svg?branch=master)](https://travis-ci.org/ecomfe/node-csshint)
[![npm version](https://badge.fury.io/js/csshint.svg)](http://badge.fury.io/js/csshint)
[![Coverage Status](https://img.shields.io/coveralls/ecomfe/node-csshint.svg?style=flat)](https://coveralls.io/r/ecomfe/node-csshint)
[![Dependency Status](https://david-dm.org/ecomfe/node-csshint.png)](https://david-dm.org/ecomfe/node-csshint)
[![devDependency Status](https://david-dm.org/ecomfe/node-csshint/dev-status.png)](https://david-dm.org/ecomfe/node-csshint#info=devDependencies)

CSSHint is a code review tool based on NodeJS. The current rules are based on ecomfe [CSS STYLE SPEC](https://github.com/ecomfe/spec/blob/master/css-style-guide.md). It also covers [CSSLint](https://github.com/CSSLint/csslint) [rules](https://github.com/CSSLint/csslint/wiki/Rules).

After a period of code refactoring, we finally came to this version, in which `CSS` parser is replaced with [postcss](https://github.com/postcss/postcss).
In addition, we changed the way of implementation which was also able to improve the performance by a large margin. Meanwhile, the following `global` object has three attributes as follows:

- `global.CSSHINT_INVALID_ALL_COUNT`: it is used to count the number of `warn` to serve `max-error`.
- `global.CSSHINT_HEXCOLOR_CASE_FLAG`: it is used to record project's color value, whether the letters are small or capital. `0` is for small and `1` is for capital. This attribute is to serve `unifying-color-case-sensitive`.
- `global.CSSHINT_FONTFAMILY_CASE_FLAG`: it is used to record whether `font-family` is small or capital to serve `unifying-font-family-case-sensitive`.

[CONFIG Reference](https://github.com/ecomfe/node-csshint/blob/master/lib/config.js)


Install & Update
-------

CSSHint has been released on npm. It can be installed following the instructions.

    $ [sudo] npm install csshint [-g]

Follow the following instruction if you are to update your CSSHint.

    $ [sudo] npm update csshint [-g]
    

Usage
------

- in CLI
	
		$ csshint -v   // show version
		$ csshint [filePath|dirPath]   // run csshint on file or dir

- in Node.js
        
    	/**
	     * detect css file content
	     *
	     * @param {string} fileContent file content
	     * @param {Object=} config config of rule, optional
	     *
	     * @return {Promise} Promise Object
	     * reject and resolve arguments:
	     * {
	     * 		path: {string} file path
	     * 		messages: {Array.<Object>} warning messages, [{ruleName, line, col, errorChar, message, colorMessage}]
	     * }
	     */
	    exports.checkString(fileContent, config);
    
    
	    /**
	     * detect file
	     *
	     * @param {Object} file the object has path and content key
	     * @param {Array} errors warning messages
	     * @param {Function} done detect callback
	     */
	    check(file, errors, done);
 

TODO
------

- [x] Complete coverage [csslint](https://github.com/CSSLint/csslint) [rule](https://github.com/CSSLint/csslint/wiki/Rules)。
- [ ] support `/* csshint-disable ruleName */` and `/* csshint-enable ruleName1 */`.

### [CHANGELOG](https://github.com/ecomfe/node-csshint/blob/master/CHANGELOG.md)

---
_Source: https://npm.io/package/csshint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
