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

textlint-rule-prh

v6.0.0

Published

textlint rule for prh.

Downloads

265,934

Readme

textlint-rule-prh textlint rule Actions Status: test

textlint rule for prh/prh: proofreading helper.

This rule check the spell by used with prh.yml.

Installation

npm install textlint-rule-prh

Usage

  1. It require Rule Options!
{
    "rules": {
        "prh": {
            "rulePaths" :["path/to/prh.yml"]
        }
    }
}

Options

  • rulePaths(required) : array of path to YAML file from .textlintrc file
{
    "rules": {
        "prh": {
            "rulePaths" :["./prh-rules/rule1.yml", "./prh-rules/rule2.yml"]
        }
    }
}

You can use ~ as Home directory abbreviation.

{
    "rules": {
        "prh": {
            "rulePaths" :["~/global-rule/rule1.yml"]
        }
    }
}
  • checkLink(optional) : Check Link node type (default: false)
  • checkBlockQuote(optional) : Check BlockQuote node type (default: false)
  • checkEmphasis(optional) : Check Emphasis node type (default: false)
  • checkHeader(optional) : Check Header node type (default: true)
  • checkCodeComment(optional) : Check CodeBlock node's comment for lang (default: [])
    • Set lang array like ["<codeblock-lang>"] for checking CodeBlock
    • Example: If you want to check JavaScript CodeBlock, set { "checkCodeComment": ["js", "javascript"] } Options
    • Note: Currently only support JavaScript CodeBlock

Examples:

{
    "rules": {
        "prh": {
            "checkEmphasis": true,
            "checkHeader": false,
            "rulePaths" :["./prh.yml"]
        }
    }
}

Check CodeBlock's comment in JavaScript Code.

{
    "rules": {
        "prh": {
            "checkCodeComment": ["js", "javascript"],
            "rulePaths" :["./prh.yml"]
        }
    }
}

Fixable

textlint rule

textlint-rule-prh support --fix feature of textlint.

textlint --fix README.md

What is prh.yml?

Please See prh/prh: proofreading helper.

prh format

prh.yml can define RegExp as a dictionary.

# prh version
version: 1
rules:

  # format case-sensitive
  - expected: Cookie
  # the above is equal to following
  # - expected: Cookie
  #   pattern: "/[CcCc][OoOo][OoOo][KkKk][IiIi][EeEe]/g"
  #   options:
  #     wordBoundary: false
  #   specs: []

  # Write test to `expect`
  - expected: jQuery
    specs:
      - from: jquery
        to:   jQuery
      - from: JQUERY
        to:   jQuery

# If the `specs` is failed、fail to load prh.yml
# - expected: JavaScript
#   specs:
#     - from: JAVASCRIPT
#       to:   JavaScprit
# Error: JavaScript spec failed. "JAVASCRIPT", expected "JavaScprit", but got "JavaScript", /[JjJj][AaAa][VvVv][AaAa][SsSs][CcCc][RrRr][IiIi][PpPp][TtTt]/g

# pattern => expected
  - expected: default
    pattern:  deflaut

# Allow to write multiple `pattern`
  - expected: hardware
    patterns:
      - hadware
      - harrdware
      - harddware

# Allow to write `pattern` as RegExp
# Can use $1...$9
# Should wrap `/` and `/`
  # ECMAScript
  - expected: ECMAScript $1
    patterns:
      - /ECMAScript([0-9]+)/
      - /ECMA Script([0-9]+)/
    specs:
      - from: ECMAScript2015
        to:   ECMAScript 2015

# expected contain pattern
# https://github.com/textlint-rule/textlint-rule-prh/pull/8
  - expected: ベンダー
    pattern: /ベンダ(?!ー)/
    specs:
      - from: ベンダ
        to: ベンダー
      - from: ベンダー
        to: ベンダー
  # wordBoundary option
  - expected: js
  # === pattern: "/\b[JjJj][SsSs]\b/g"
    options:
      wordBoundary: true
    specs:
      - from: foo JS bar
        to:   foo js bar
      - from: foo altJS bar
        to:   foo altJS bar

imports

prh.yml can import other yaml file

version: 1

imports:
  - imports-a.yml
  - imports-b.yml

Example

See example-prh.yml.

Tests

npm test

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT