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

stylelint-sassdoc

v0.4.2

Published

stylelint plugin to check scss files for a valid sassdoc documentation Credits to https://github.com/anneangersbach

Downloads

6,158

Readme

Stylelint SASSDoc Plugin

This plugin provides configurable rules to check scss files for sassdoc comments. It abides by the stylelint developer guide.

private mixins, functions and variables are currently ignored. See Open issues for more information.

Usage

Install plugin

npm install --save-dev stylelint-sassdoc

Make sure you already included your stylelint job to package.json

// all scss files
"stylelint": "stylelint "**/*.scss" --config ./your.stylelint.config.js --fix -s scss"

Add stylelint plugin and sassdoc rules to stylelint config

plugins: [
   'stylelint-sassdoc',
   ...
]

rules: {
   'sassdoc/atExample': [true, {
        severity: 'warning', // optional
    }],
    'sassdoc/atName': true,
    'sassdoc/atParameter': true,
    'sassdoc/atReturn': true,
    'sassdoc/commentblock-postercomment': true,
    'sassdoc/poster-comment': true,
    'sassdoc/variable-has-type': true,
    'sassdoc/function-is-documented': true,
    'sassdoc/mixin-is-documented': true,
   ...
}

Run

npm run stylelint

Helpful links

| Link | Description | | ------ | ------ | | SassDoc Documentation | Check #Annotation and #File Annotation, to see what you have to check in your file | | SassDoc Repo | useful to check how they validate things (example: @return) | |SCSS Documentation| check valid arguments, etc| |PostCSS API| this is what you will use to write the plugin! | |Stylelint Developer Guide| How to write stylelint plugins| |Stylelint Repo| stylelint utils, useful to re-use some code that's not an external module (yet)| |RegExr| if you need to test some regexp| |Awesome Stylelint| Plugin collection useful for further code inspiration|

Open issues

  • atReturn
    • Fix RegEx for @return to work without whitespace (might be stylelint stringformatter bug)
  • Optimise Utils
    • Merge checkCommentsForReturn/-Name/-Group/-GroupName/-Params/-Example into one function with parameters for the regex(s) and the direction of the search.
  • atParam
    • checking actual name of parameters
  • poster comment
    • description comes before any annotations
    • check for '/// string' between the last '/// @something' and the closing '////' of the poster comment
    • check for multiple poster comments (only 1 allowed)
    • create option for @group-name since it's a custom property
  • private things
    • mixins, functions and variables that start with underscore '_myColor' need to be parsed differently.
      • either check that they aren't commented and throw an error if they are
      • or check that they have @access private
      • CHALLENGE: the first method conflicts in a way with the other rules, checking for parameters and returns etc. Either we need a separate rule for access private, or extend all the other rules for a check of private things.
  • helper to find all "/// @something" to make the next part simpler
  • optional annotations, to complete the plugin
    • alias
    • author
    • content
    • deprecated
    • ignore
    • link
    • output
    • property
    • require
    • see
    • since
    • throw
    • todo
  • performance
    • try to reuse the sourceArray if it's used multiple times
  • testing
    • Write tests with JEST: check stylelint-plugin documentation

Development

IMPORTANT

postCSS does some on-the-fly processing, so a SCSS comment like:

/// my comment

gets output (and compared) like this:

/*/ my comment */

This makes regEx comparisons more difficult. Check out the helper functions adjacentLineIsSCSSComment, nodeToString and getSourceArray for this.

License

MIT.