i18n-validate
Advanced tools
Comparing version 1.2.2-next.21c923f.0 to 1.3.0-next.b8acd4d.0
#!/usr/bin/env node | ||
import { parseOptionsFile, log, parseFile, ValidationError, validateKey } from './chunk-PCOSWKCS.js'; | ||
import { parseOptionsFile, log, parseFile, ValidationError, validateKey } from './chunk-E2KNZ4RE.js'; | ||
import process from 'node:process'; | ||
@@ -7,3 +7,3 @@ import { Command } from 'commander'; | ||
var command = new Command().version("1.2.2-next.21c923f.0").usage("[options] <file ...>").option("-c, --config <config>", "Path to the config file", "./i18n-validate.json").option("--log-level <logLevel>", "Log level").option("--exclude <exclude...>", "Exclude files from parsing").option("--exit-on-error", "Exit immediately if an error is found"); | ||
var command = new Command().version("1.3.0-next.b8acd4d.0").usage("[options] <file ...>").option("-c, --config <config>", "Path to the config file", "./i18n-validate.json").option("--log-level <logLevel>", "Log level").option("--exclude <exclude...>", "Exclude files from parsing").option("--exit-on-error", "Exit immediately if an error is found"); | ||
command.on("--help", () => { | ||
@@ -57,2 +57,5 @@ console.log(""); | ||
} | ||
if (errorCount > 0 && options.exitOnError) { | ||
break; | ||
} | ||
} | ||
@@ -59,0 +62,0 @@ if (errorCount > 0) { |
@@ -93,16 +93,2 @@ type LogLevel = 'debug' | 'error' | 'info' | 'warn'; | ||
declare class ValidationError extends Error { | ||
stack: string; | ||
constructor(message: string, filePath: string, positions: { | ||
end: { | ||
character: number; | ||
line: number; | ||
}; | ||
start: { | ||
character: number; | ||
line: number; | ||
}; | ||
}); | ||
} | ||
interface TranslationNode { | ||
@@ -115,7 +101,7 @@ isStaticKey: boolean; | ||
end: { | ||
character: number; | ||
col: number; | ||
line: number; | ||
}; | ||
start: { | ||
character: number; | ||
col: number; | ||
line: number; | ||
@@ -128,2 +114,7 @@ }; | ||
declare class ValidationError extends Error { | ||
stack: string; | ||
constructor(message: string, filePath: string, positions: TranslationNode['positions']); | ||
} | ||
declare const validateKey: (node: TranslationNode, options: OptionsWithDefault) => Promise<boolean>; | ||
@@ -130,0 +121,0 @@ |
@@ -1,3 +0,3 @@ | ||
export { ValidationError, parseFile, parseOptionsFile, validateKey } from './chunk-PCOSWKCS.js'; | ||
export { ValidationError, parseFile, parseOptionsFile, validateKey } from './chunk-E2KNZ4RE.js'; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "i18n-validate", | ||
"version": "1.2.2-next.21c923f.0", | ||
"version": "1.3.0-next.b8acd4d.0", | ||
"description": "A cli tool to find invalid i18n keys, missing variables and many more", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"bin": "./dist/cli.js", | ||
@@ -14,3 +15,3 @@ "type": "module", | ||
"format": "prettier --write . --cache", | ||
"test": "true || vitest run", | ||
"test": "vitest run", | ||
"test:watch": "vitest", | ||
@@ -17,0 +18,0 @@ "update": "yarn upgrade-interactive", |
@@ -51,5 +51,5 @@ <div align="center"> | ||
You can disable the `i18n-validate` for a specific line by adding `// i18n-validate-disable-next-line` before the line. | ||
- You can ignore a specific function by adding `// i18n-validate-disable-next-line` comment before the function call or ignore all the functions in a file by adding `/* i18n-validate-disable */` comment at the top of the file. | ||
> **Note**: Currently, `i18n-validate` only supports `ts`, `tsx`, `js` and `jsx` source files and `json` translation files. | ||
> **Note**: Currently, `i18n-validate` supports `typescript` and `javascript` (including `tsx` and `jsx`) source files and `json` translation files only. | ||
@@ -95,2 +95,15 @@ ### Use with lint-staged | ||
## TODO | ||
- [ ] Write unit tests | ||
- [ ] Add support for `yaml`, `json5` translation files | ||
- [ ] Add support for other framework specific source files (e.g. `vue`, `svelte`, `angular` etc.) | ||
- [ ] Detect unused translation keys | ||
- [ ] A vscode extension | ||
- [ ] A github action | ||
- [ ] An eslint plugin | ||
- [ ] A `--fix` flag to remove unused keys and variables | ||
_Any help to complete these tasks will be highly appreciated._ | ||
## Contributors ✨ | ||
@@ -97,0 +110,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46008
114
11
431
1