Socket
Socket
Sign inDemoInstall

@hi18n/eslint-plugin

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hi18n/eslint-plugin - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 0.1.7
- Support a new overload for `new Catalog` constructor introduced in `@hi18n/core` 0.1.6. It accepts a locale identifier as the first argument.
## 0.1.6

@@ -2,0 +6,0 @@

3

dist/common-trackers.d.ts

@@ -1,6 +0,7 @@

import { Tracker } from "./tracker";
import { CaptureMap, GeneralizedNode, Tracker } from "./tracker";
export declare function bookTracker(): Tracker;
export declare function catalogTracker(): Tracker;
export declare function getCatalogData(captured: CaptureMap): GeneralizedNode;
export declare function translationCallTracker(): Tracker;
export declare function linguiTracker(): Tracker;
//# sourceMappingURL=common-trackers.d.ts.map

@@ -8,2 +8,3 @@ "use strict";

exports.catalogTracker = catalogTracker;
exports.getCatalogData = getCatalogData;
exports.linguiTracker = linguiTracker;

@@ -30,4 +31,7 @@ exports.translationCallTracker = translationCallTracker;

tracker.watchConstruct('import("@hi18n/core").Catalog', [{
captureAs: "locale",
path: ["0"]
}, {
captureAs: "catalogData",
path: ["0"]
path: ["1"]
}]);

@@ -37,2 +41,13 @@ return tracker;

function getCatalogData(captured) {
const locale = captured["locale"];
const catalogData = captured["catalogData"];
if (locale.type === "ObjectExpression") {
return locale;
} else {
return catalogData;
}
}
function translationCallTracker() {

@@ -39,0 +54,0 @@ const tracker = new _tracker.Tracker();

@@ -36,3 +36,3 @@ "use strict";

const missingIdsSet = new Set(usedIds);
const catalogData = captured["catalogData"];
const catalogData = (0, _commonTrackers.getCatalogData)(captured);
if (catalogData.type !== "ObjectExpression") return;

@@ -39,0 +39,0 @@

@@ -34,3 +34,3 @@ "use strict";

const usedIdsSet = new Set(usedIds);
const catalogData = captured["catalogData"];
const catalogData = (0, _commonTrackers.getCatalogData)(captured);
if (catalogData.type !== "ObjectExpression") return;

@@ -37,0 +37,0 @@

@@ -47,3 +47,3 @@ "use strict";

const catalogData = captured["catalogData"];
const catalogData = (0, _commonTrackers.getCatalogData)(captured);
if (!catalogData) throw new Error("Cannot capture catalogData");

@@ -50,0 +50,0 @@

@@ -38,4 +38,4 @@ import type { TSESLint, TSESTree } from "@typescript-eslint/utils";

};
declare type CaptureMap = Record<string, GeneralizedNode>;
declare type GeneralizedNode = TSESTree.Node | ArgumentsOf | PropsOf | CaptureFailure;
export declare type CaptureMap = Record<string, GeneralizedNode>;
export declare type GeneralizedNode = TSESTree.Node | ArgumentsOf | PropsOf | CaptureFailure;
declare type CaptureFailure = {

@@ -42,0 +42,0 @@ type: "CaptureFailure";

{
"name": "@hi18n/eslint-plugin",
"version": "0.1.6",
"version": "0.1.7",
"description": "Message internationalization meets immutability and type-safety - ESLint plugin",

@@ -77,3 +77,3 @@ "keywords": [

"@babel/preset-typescript": "^7.18.6",
"@hi18n/core": "0.1.5",
"@hi18n/core": "0.1.6",
"@hi18n/react": "0.1.3",

@@ -85,3 +85,3 @@ "@hi18n/react-context": "0.1.0",

"@types/node": "^17.0.32",
"@types/react": "^18.0.14",
"@types/react": "^18.0.15",
"@typescript-eslint/parser": "^5.30.4",

@@ -88,0 +88,0 @@ "@typescript-eslint/types": "^5.30.4",

@@ -1,2 +0,2 @@

import { Tracker } from "./tracker";
import { CaptureMap, GeneralizedNode, Tracker } from "./tracker";

@@ -26,5 +26,9 @@ export function bookTracker(): Tracker {

{
captureAs: "catalogData",
captureAs: "locale",
path: ["0"],
},
{
captureAs: "catalogData",
path: ["1"],
},
]);

@@ -34,2 +38,12 @@ return tracker;

export function getCatalogData(captured: CaptureMap): GeneralizedNode {
const locale = captured["locale"]!;
const catalogData = captured["catalogData"]!;
if (locale.type === "ObjectExpression") {
return locale;
} else {
return catalogData;
}
}
export function translationCallTracker(): Tracker {

@@ -36,0 +50,0 @@ const tracker = new Tracker();

import type { TSESLint, TSESTree } from "@typescript-eslint/utils";
import { getStaticKey, lineIndent } from "../util";
import { catalogTracker } from "../common-trackers";
import { catalogTracker, getCatalogData } from "../common-trackers";
import { parseComments, ParseError, Parser } from "../microparser";

@@ -31,3 +31,3 @@ import { queryUsedTranslationIds } from "../used-ids";

const catalogData = captured["catalogData"]!;
const catalogData = getCatalogData(captured);
if (catalogData.type !== "ObjectExpression") return;

@@ -34,0 +34,0 @@

import type { TSESLint } from "@typescript-eslint/utils";
import { commentOut, getStaticKey } from "../util";
import { catalogTracker } from "../common-trackers";
import { catalogTracker, getCatalogData } from "../common-trackers";
import { queryUsedTranslationIds } from "../used-ids";

@@ -30,3 +30,3 @@

const catalogData = captured["catalogData"]!;
const catalogData = getCatalogData(captured);
if (catalogData.type !== "ObjectExpression") return;

@@ -33,0 +33,0 @@

import type { TSESLint } from "@typescript-eslint/utils";
import { getStaticKey } from "../util";
import { catalogTracker } from "../common-trackers";
import { catalogTracker, getCatalogData } from "../common-trackers";
import { capturedRoot } from "../tracker";

@@ -55,3 +55,3 @@ import { resolveAsLocation } from "../def-location";

const catalogData = captured["catalogData"];
const catalogData = getCatalogData(captured);
if (!catalogData) throw new Error("Cannot capture catalogData");

@@ -58,0 +58,0 @@ if (catalogData.type !== "ObjectExpression") {

@@ -340,4 +340,8 @@ import type { TSESLint, TSESTree } from "@typescript-eslint/utils";

type CaptureMap = Record<string, GeneralizedNode>;
type GeneralizedNode = TSESTree.Node | ArgumentsOf | PropsOf | CaptureFailure;
export type CaptureMap = Record<string, GeneralizedNode>;
export type GeneralizedNode =
| TSESTree.Node
| ArgumentsOf
| PropsOf
| CaptureFailure;

@@ -344,0 +348,0 @@ type CaptureFailure = {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc