New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

i18next-parser

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-parser - npm Package Compare versions

Comparing version 3.6.0 to 3.7.0

6

CHANGELOG.md
# Changelog
# 3.6.0 - latest
# 3.7.0 - latest
- Improve handling of string literals #261
# 3.6.0
- Fix a conflict in jsx lexer #254

@@ -6,0 +10,0 @@

10

dist/lexers/javascript-lexer.js

@@ -131,8 +131,8 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};var _extends = Object.assign || function (target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i];for (var key in source) {if (Object.prototype.hasOwnProperty.call(source, key)) {target[key] = source[key];}}}return target;};var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();var _baseLexer = require('./base-lexer');var _baseLexer2 = _interopRequireDefault(_baseLexer);

} else {
if (keyArgument.kind === ts.SyntaxKind.Identifier) {
this.emit(
'warning', 'Key is not a string literal: ' +
keyArgument.text);
this.emit(
'warning',
keyArgument.kind === ts.SyntaxKind.Identifier ? 'Key is not a string literal: ' +
keyArgument.text :
'Key is not a string literal');
}
return null;

@@ -139,0 +139,0 @@ }

@@ -5,3 +5,3 @@ {

"name": "i18next-parser",
"version": "3.6.0",
"version": "3.7.0",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "dist/index.js",

@@ -32,3 +32,3 @@ # i18next Parser [![Build Status](https://travis-ci.org/i18next/i18next-parser.svg?branch=master)](https://travis-ci.org/i18next/i18next-parser)

For legacy user on `0.x`, the code has since been entirely rewritten and there is a dedicated [branch](https://github.com/i18next/i18next-parser/tree/0.x.x) for it. You are hihgly encouraged to upgrade!
For legacy users on `0.x`, the code has since been entirely rewritten and there is a dedicated [branch](https://github.com/i18next/i18next-parser/tree/0.x.x) for it. You are highly encouraged to upgrade!

@@ -35,0 +35,0 @@ ## Usage

@@ -131,8 +131,8 @@ import BaseLexer from './base-lexer'

} else {
if (keyArgument.kind === ts.SyntaxKind.Identifier) {
this.emit(
'warning',
`Key is not a string literal: ${keyArgument.text}`
)
}
this.emit(
'warning',
keyArgument.kind === ts.SyntaxKind.Identifier
? `Key is not a string literal: ${keyArgument.text}`
: 'Key is not a string literal'
)
return null

@@ -139,0 +139,0 @@ }

@@ -230,2 +230,22 @@ import { assert } from 'chai'

})
it('emits warnings on dynamic keys', () => {
const Lexer = new JavascriptLexer()
const content =
'const bar = "bar"; i18n.t("foo"); i18n.t(bar); i18n.t(`foo.${bar}`);'
let warningCount = 0
Lexer.on('warning', (warning) => {
if (warning.indexOf('Key is not a string literal') === 0) {
warningCount++
}
})
assert.deepEqual(Lexer.extract(content), [
{
key: 'foo',
},
])
assert.strictEqual(warningCount, 2)
})
})
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