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-use-si-units

v2.0.0

Published

Textlint rule to always use International System of Units (SI).

Downloads

1,424

Readme

textlint-rule-use-si-units npm

Use SI Units

sample texts

  1. SI単位系の単位以外の使用を禁止します
  2. SI単位系の単位とは以下のいずれかの単位、またはそれらの組み合わせ(組立単位)を指します
    • SI基本単位(s, m, kg, A, K, mol, cd)
    • 固有の名称をもつSI組立単位(rad, sr, Hz, N, Pa, Jなど22種)
  3. 以下の文字は単体では単位となることができませんが、単位と組み合わせて使用できます
    • SI接頭語(M, G, k, mなど20種)
    • SI単位を組み合わせる際に使用される記号(, ^, -, ·, ・, ・, (, ))
    • 次元を表すための数字(e.g. m^2)
  4. 以下のSI併用単位も許容します
    • SIに属さないが、SIと併用される単位(min, h, d, au, °, ′, ″など16種)
    • これらはrestrictNonSIUnitsオプションで禁止できます

指摘の対象とする文字列

  • 数値 + 単位の組み合わせを検出します
    • e.g.「10 m」「273 K」「123 kgm^2/s^3」
    • 数値と単位の間には半角スペースが入っている必要があります
      • IDや型番のような、単位と関係ない文字列を誤検出するのを防ぐためです

指摘の対象としない文字列

  • 日本語の単位や助数詞
    • e.g.「枚」「本」「糎」「㌢㍍」
  • 小数点や記号入りの数値
    • e.g.「2.56 m/s」「1.1e-10 m」
    • ただし、小数点・記号より後にも数字があればその部分を検出します
  • LaTeX等で数値と単位の間に半角スペース以外を使用しているもの
    • e.g.「10\,m」「\SI{123}{kgm^2/s^3}」「$123\ \mathrm{kgm^2/s^3}$

Install

Install with npm:

npm install textlint-rule-use-si-units

Usage

Via .textlintrc(Recommended)

{
    "rules": {
        "use-si-units": true
    }
}

Via CLI

textlint --rule use-si-units README.md

Options

  • allowedUnits
    • この配列にある文字列には、SI単位系に従っていなくとも警告を出しません
  • restrictNonSIUnits
    • false (default): SI併用単位も使用できます
    • true: SI併用単位の使用を禁止し、SIに属する単位のみ認めます
{
    "rules": {
        "use-si-units": {
            "allowedUnits": ["Å"],
            "restrictNonSIUnits": true
        }
    }
}

Build

Builds source codes for publish to the lib folder. You can write ES2015+ source codes in src/ folder.

npm run build

Tests

Run test code in test folder. Test textlint rule by textlint-tester.

npm test

License

ISC © kn1cht