swiffer

0.0.8 • Public • Published

Swiffer

Clean up your Dust

Summary

Swiffer is a command line lint tool with IDE integration that helps you keep your dust clean. It warns about Dust parse errors, then checks any set of rules defined using the Swiffer DSL (see below).

How it works:

Swiffer uses Dust's dust.parse to create an Abstract Syntax Tree (AST) of the given Dust template. If there are any errors, Swiffer displays these then exits. If the template is successfully parsed, Swiffer walks the AST and checks all applicable rules for each node of the tree.

Getting Started:

  1. run npm install -g swiffer
  2. Go wild. Create your own rules in .swifferrc and test your own templates.

DSL examples:

[
  {
    "name": "ifDeprecation",
    "description": "The @if creates a security hole and should be repalced by @eq, @gt, @lt, etc.",
    "target": {
      "type": "@",
      "matches": "if"
    }
  },
  {
    "name": "special characters",
    "description": "Use one of the available special characters: s, n, r, lb, rb",
    "target": {
      "type": "special"
    },
    "conditions": {
      "matches": "[s|n|r|lb|rb]"
    }
  },
  {
    "name": "jsControl |j|s",
    "description": "references within a jsControl should have |j|s",
    "target": {
      "type": "reference",
      "within": "@jsControl"
    },
    "conditions": {
      "has": {
        "filters": ["j", "s"]
      }
    }
  }
]

Readme

Keywords

Package Sidebar

Install

npm i swiffer

Weekly Downloads

4

Version

0.0.8

License

Apache-2.0

Last publish

Collaborators

  • smfoote