0.2.3 • Published 1 year ago

i18n-lint-plugin v0.2.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year 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

1 year ago

0.2.0

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago