{"id":25145,"library":"csshint","title":"CSSHint","description":"CSSHint is a Node.js-based CSS code review tool that lints CSS files for style consistency and errors. Current stable version 0.3.4, with an unknown release cadence (last update appears sporadic). It is built on PostCSS and supports rules from the ecomfe CSS style spec as well as CSSLint rules. Key differentiators: integration with global counters for project-wide consistency checks (hex color case, font-family case), and a promise-based API for file content checking.","status":"maintenance","version":"0.3.4","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/ecomfe/node-csshint","tags":["javascript","csslint","csshint"],"install":[{"cmd":"npm install csshint","lang":"bash","label":"npm"},{"cmd":"yarn add csshint","lang":"bash","label":"yarn"},{"cmd":"pnpm add csshint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"CSS parser and plugin framework","package":"postcss","optional":false}],"imports":[{"note":"Package does not declare a default export. Use named export 'checkString' or 'check'.","wrong":"const csshint = require('csshint')","symbol":"default","correct":"import csshint from 'csshint'"},{"note":"Must use named import; default import is undefined.","wrong":"import checkString from 'csshint'","symbol":"checkString","correct":"import { checkString } from 'csshint'"},{"note":"CJS require with destructuring works, but ESM named import is preferred.","wrong":"const { check } = require('csshint')","symbol":"check","correct":"import { check } from 'csshint'"}],"quickstart":{"code":"import { checkString } from 'csshint';\n\nconst cssCode = `div { color: #fff; }`;\nconst config = {}; // optional custom config object\n\ncheckString(cssCode, config)\n  .then(result => {\n    console.log('Path:', result.path);\n    result.messages.forEach(msg => {\n      console.log(`${msg.ruleName}: ${msg.message} (line ${msg.line}, col ${msg.col})`);\n    });\n  })\n  .catch(err => {\n    console.error('Error reading file:', err);\n  });","lang":"typescript","description":"Demonstrates how to lint a CSS string using the checkString function, handling the promise result with warning messages."},"warnings":[{"fix":"Avoid concurrent lint operations; reset globals between runs if needed.","message":"The package modifies global objects (CSSHINT_INVALID_ALL_COUNT, CSSHINT_HEXCOLOR_CASE_FLAG, CSSHINT_FONTFAMILY_CASE_FLAG) which can cause side effects across multiple lint runs.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use the Node.js API instead of CLI for consistent behavior.","message":"The CLI interface may be unstable; documentation lacks clear CLI command support beyond basic usage.","severity":"deprecated","affected_versions":">=0.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import { checkString } from 'csshint' instead of import csshint from 'csshint'.","cause":"Importing default export incorrectly, as the package only exports named functions.","error":"TypeError: csshint is not a function"},{"fix":"Run npm install postcss as a dependency of your project.","cause":"PostCSS is a peer dependency of csshint and must be installed manually if not auto-installed.","error":"Cannot find module 'postcss'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}