All Projects → lint-md → cli

lint-md / cli

Licence: other
Command tool of @lint-md, used in ci.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to cli

HTML-Lint
A code quality bookmarklet and command-line tool
Stars: ✭ 20 (+0%)
Mutual labels:  lint
errorformat
Vim's quickfix errorformat implementation in Go
Stars: ✭ 83 (+315%)
Mutual labels:  lint
eslint-plugin
😎 基于 @lint-md,提供 eslint-plugin,让 lint-md 玩家在 IDE 中得到愉悦的文档编写体验。
Stars: ✭ 22 (+10%)
Mutual labels:  lint-md
arduino-lint
Tool to check for problems with Arduino projects
Stars: ✭ 63 (+215%)
Mutual labels:  lint
mock-spy-module-import
JavaScript import/require module testing do's and don'ts with Jest
Stars: ✭ 40 (+100%)
Mutual labels:  lint
openapi-lint-vscode
OpenAPI 2.0/3.0.x intellisense, validator, linter, converter and resolver extension for Visual Studio Code
Stars: ✭ 47 (+135%)
Mutual labels:  lint
lint
Linting and formatting for SAS® code
Stars: ✭ 16 (-20%)
Mutual labels:  lint
ue5-style-guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,892 (+14360%)
Mutual labels:  lint
TyStrings
strings file tool for iOS / macOS developers
Stars: ✭ 15 (-25%)
Mutual labels:  lint
flake8-broken-line
🚨 Flake8 plugin to forbid backslashes (\) for line breaks
Stars: ✭ 85 (+325%)
Mutual labels:  lint
jsonlint
JSON/CJSON/JSON5 parser, syntax & schema validator and pretty-printer with a command-line client, written in pure JavaScript.
Stars: ✭ 21 (+5%)
Mutual labels:  lint
flake8-import-order-spoqa
Spoqa's import order style for flake8-import-order
Stars: ✭ 15 (-25%)
Mutual labels:  lint
dockerfile-utils
A library and command line interface for formatting and linting Dockerfiles.
Stars: ✭ 17 (-15%)
Mutual labels:  lint
prettier-check
Check that all files match prettier code style.
Stars: ✭ 54 (+170%)
Mutual labels:  lint
cpplint
Static code checker for C++
Stars: ✭ 1,014 (+4970%)
Mutual labels:  lint
extra pedantic
Stricter Dart analyzer linter settings and best practices.
Stars: ✭ 28 (+40%)
Mutual labels:  lint
AutoBindings
Set of annotations that aims to make your Android development experience easier along with lint checks.
Stars: ✭ 15 (-25%)
Mutual labels:  lint
ansible-later
Another best practice scanner for Ansible roles and playbooks
Stars: ✭ 54 (+170%)
Mutual labels:  lint
pahout
A pair programming partner for writing better PHP. Pahout means PHP mahout 🐘
Stars: ✭ 43 (+115%)
Mutual labels:  lint
lint-prepush
Lint committed files on pre-push 🔬
Stars: ✭ 18 (-10%)
Mutual labels:  lint

@lint-md/cli

用于检查中文 markdown 编写格式规范的命令行工具,基于 AST 开发,且方便集成 ci;同时提供 API 方法调用。Cli tool to lint your markdown file for Chinese.

npm npm

安装

npm i -g @lint-md/cli

使用

Usage: <lint-md> <files...> [options]

lint your markdown files

Options:
  -v, --version                  output the version number
  -c, --config [configure-file]  use the configure file, default .lintmdrc
  -f, --fix                      fix the errors automatically
  -h, --help                     output usage information
  • 校验 lint
lint-md README.md Document.md
  • 修复 fix
lint-md README.md Document.md --fix

检查类型

基于 lint-md,具体支持的检查类型,请到该项目查看。

配置

默认所有的规则都是 error 类型,但是可以通过配置来指定规则类型。示例 .lintmdrc

{
  "excludeFiles": [],
  "rules": {
    "no-empty-code": 1,
    "no-long-code": [
      2,
      {
        "length": 100,
        "exclude": [
          "dot"
        ]
      }
    ]
  }
}
  • 通过 rules 来配置规则。参考 lint-md 文档说明。
  • 通过 excludeFiles 来忽略文件和目录,glob 语法。

ci 集成

  • Travis

.travis.yml 文件中配置以下内容。

language: node_js
node_js:
  - "10"
before_install:
  - npm i -g @lint-md/cli
script: lint-md README.md
  • lint-stage

package.json 中增加以下配置。

{
  "lint-staged": {
    "src/**/*.{md,markdown}": [
      "lint-md"
    ]
  }
}

基于 Docker

假设当前目录有一文件名为 README.md,可在本地使用以下命令:

docker run --rm -it -v$(pwd):/docs yuque/lint-md:cli /docs/README.md # 也可直接带其它参数

其中:

  • --rm 表示在运行完毕后直接销毁容器。
  • -it 表示交互式 TTY,你可以理解为进入容器终端。
  • -v$(pwd)/docs 表示将当前目录「挂载」至容器内部的 /docs 目录。

另外,在基于 Docker 的 CI/CD 平台上,也可使用 yuque/lint-md 镜像。例如 GitLab CI/CD:

lint:
  image: yuque/lint-md:cli
  script:
    - lint-md README.md # 或其它文件

Circle CI:

version: 2
jobs:
  lint:
    docker:
      - image: yuque/lint-md:cli
    steps:
      - checkout
      - run: lint-md README.md # 或其它文件

利用 Docker 作为 CI 的基础环境通常更有优势,不必每次构建都执行 yarn install;资源节省,速度也会更快些。

License

MIT@hustcc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].