Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
I18nLintPlugin
✓ const I18nLintPlugin = require('i18n-lint-plugin')
✗ import I18nLintPlugin from 'i18n-lint-plugin'
Package does not provide ESM exports; use CommonJS require as shown. Node >=8 is required.
i18n-lint
✓ npx i18n-lint
✗ i18n-lint (without npx if not installed globally)
CLI command is available after install; run via npx or add to scripts in package.json
.i18nlintrc.js
✓ module.exports = { /* config */ }
✗ export default { /* config */ }
Configuration file uses CommonJS module.exports; ESM export is not supported.
Install plugin, add to webpack config, create .i18nlintrc.js, and run via webpack or CLI.
// Step 1: Install
// npm install i18n-lint-plugin --save-dev
// Step 2: In webpack config (e.g., vue.config.js)
const I18nLintPlugin = require('i18n-lint-plugin');
module.exports = {
configureWebpack: {
plugins: [
new I18nLintPlugin()
]
}
};
// Step 3: Create .i18nlintrc.js in project root
module.exports = {
report: 'warnings',
rules: [{
glob: 'src/**/*.{js,vue}',
test: /[\u4e00-\u9fa5]+/
}],
ignores: 'src/views/components/**/*',
staticPath: 'dataview/*.json',
lintSuffix: ['js', 'vue', 'coffee', 'ts'],
ignoreComment: true,
ignoreConsole: true
};
// Step 4: Run via webpack build or CLI: npx i18n-lint
Debug
Known issues
breakingPlugin only works with webpack; cannot be used standalone as a generic linter.fixUse the CLI command (i18n-lint) for CI or non-webpack projects.
affects: all
deprecatedHusky v4 configuration format shown in README is deprecated; newer versions use .husky directory.fixUse husky v4 or follow updated documentation for husky v5+.
affects: >=5.0.0 of husky
gotchaThe glob 'src/**/*.{js,vue}' may not catch all file types unless lintSuffix includes them.fixEnsure lintSuffix includes all relevant extensions (e.g., 'ts' for TypeScript).
affects: all
breakingtest regex /[\u4e00-\u9fa5]+/ only matches Chinese characters; not suitable for other languages.fixCustomize the test regex or function for your specific i18n needs.
affects: all
gotchaignoreComment and ignoreConsole options may not work perfectly with all comment types or console.log variations.fixManually verify false positives; consider custom test functions.
affects: all
Errors
Common errors & fixes
Cannot find module 'i18n-lint-plugin'
Package not installed or not in node_modules
fixRun 'npm install i18n-lint-plugin --save-dev'
TypeError: I18nLintPlugin is not a constructor
Using incorrect import method (e.g., ESM import instead of require)
fixUse const I18nLintPlugin = require('i18n-lint-plugin'); Configuration file .i18nlintrc.js not found
File missing or not in project root directory
fixCreate .i18nlintrc.js in the same directory as your package.json
No rules matching the provided glob pattern
Glob pattern in .i18nlintrc.js does not match any files
fixVerify glob patterns; use correct path relative to project root
Audit
Dependencies
webpackrequiredPlugin requires webpack to be installed as it hooks into webpack's compilation process
huskyoptionalRecommended for git hooks integration, but not strictly required for plugin operation