Skip to content

ESLint plugin for Chinese typographies (中文排版) with zhlint

License

Notifications You must be signed in to change notification settings

zhlint-project/eslint-plugin-zhlint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-zhlint

Linting Chinese typographies in JavaScript/TypeScript with zhlint.

VSCode Linting Preview

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-zhlint:

npm install eslint-plugin-zhlint --save-dev

Usage

Add zhlint to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["zhlint"]
}

Then configure the zhlint/zhlint rule under the rules section.

{
  "rules": {
    "zhlint/zhlint": ["warn"]
  }
}

or with options:

{
  "rules": {
    "zhlint/zhlint": [
      "warn",
      {
        "lintComments": true,
        "lintStringLiterals": true,
        "zhlint": {
          "rules": {
            "halfWidthPunctuation": "",
            "fullWidthPunctuation": ",。:;?!“”‘’()",
            "unifiedPunctuation": "traditional"
          }
        }
      }
    ]
  }
}

Options

  • lintComments (boolean, default true): true to enable zhlint in // or /* ... */ comments
  • lintStringLiterals (boolean, default true): true to enable zhlint in string literals (single-quoted / double-quoted strings, and template literals)
  • zhlint (object): options passed down to zhlint

Supported rules

See https://github.com/Jinjiang/zhlint#supported-rules. If no zhlint.rules option provided, all rules are enabled by default.

About

ESLint plugin for Chinese typographies (中文排版) with zhlint

Resources

License

Stars

Watchers

Forks

Packages

No packages published