{"library":"postcss-selector-lint","title":"PostCSS Selector Lint","description":"PostCSS Selector Lint is a v1.0.2 PostCSS plugin that warns about disallowed CSS selector types (type, class, id, universal, attribute, pseudo) in global vs local (nested) scope. It helps prevent scope pollution by flagging non-nested type/tag selectors. The configuration is fully customizable per scope. Release cadence is low; latest version is stable. Key differentiator: scope-aware linting (global vs local) rather than simple selector blacklisting. Alternatives like stylelint offer broader linting but require more configuration.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install postcss-selector-lint"],"cli":null},"imports":["import selectorLint from 'postcss-selector-lint'","import selectorLint from 'postcss-selector-lint'","import selectorLint from 'postcss-selector-lint'; const config = { global: { type: false, class: true, id: false, universal: false, attribute: false, psuedo: false }, local: { type: true, class: true, id: false, universal: true, attribute: true, psuedo: true }, options: { excludedFiles: [] } }; postcss([selectorLint(config)])"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// Install: npm install --save-dev postcss postcss-selector-lint\n\nimport postcss from 'postcss';\nimport selectorLint from 'postcss-selector-lint';\n\nconst config = {\n    global: {\n        type: false,\n        class: true,\n        id: false,\n        universal: false,\n        attribute: false,\n        psuedo: false,\n    },\n    local: {\n        type: true,\n        class: true,\n        id: false,\n        universal: true,\n        attribute: true,\n        psuedo: true,\n    },\n    options: {\n        excludedFiles: ['reset.css'],\n    },\n};\n\npostcss([selectorLint(config)])\n    .process('h1 { color: red; }', { from: 'style.css' })\n    .then(result => {\n        result.warnings().forEach(warn => console.log(warn.toString()));\n    });","lang":"javascript","description":"Sets up PostCSS Selector Lint with a configuration that restricts global selectors to class only, but allows type, universal, and attribute selectors in local scope.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}