0.2.3 • Published 2 years ago

i18n-lint-plugin v0.2.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

i18n-lint-plugin

Install

$ yarn add i18n-lint-plugin -D
# or
$ npm install i18n-lint-plugin -D

Configuration

  1. vue.config.js
const I18nLintPlugin = require('i18n-lint-plugin')

module.exports = {
  configureWebpack: {
    plugins: [
      new I18nLintPlugin()
    ]
  }
}
  1. add .i18nlintrc.js to the root dir of your project
module.exports = {
  // report level, exits on 'errors'
  report: 'warnings',
  rules: [{
    // report: 'errors',
    glob: 'src/**/*.{js,vue}',
    test: /[\u4e00-\u9fa5]+/
    // or check with function
    // test: (line, filePath, lines, lineNo) => {
    //   return line.match(/[\u4e00-\u9fa5]+/)?.index
    // }
  }, {
    glob: '**/*.json',
    test: /[\u4e00-\u9fa5]+/
  }],
  // ignore path, use array depends
  ignores: 'src/views/components/**/*',
  // static path to lint
  staticPath: 'dataview/*.json',
  // file types to lint, defaults are js,jsx,json,vue,jade,ejs
  lintSuffix: ['js', 'vue', 'coffee', 'ts'],
  // remove comments before lint
  ignoreComment: true,
  // remove console before lint
  ignoreConsole: true
}

Git Hooks

Execute i18n-lint before git commit. 1. install husky

$ yarn add husky@4.2.3 -D
  1. add husky config to package.json
"husky": {
  "hooks": {
    "pre-commit": "i18n-lint"
  }
}
0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago