Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@typescript-eslint/eslint-plugin

Package Overview
Dependencies
Maintainers
2
Versions
3879
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typescript-eslint/eslint-plugin - npm Package Compare versions

Comparing version 8.16.1-alpha.1 to 8.16.1-alpha.2

57

dist/rules/no-unnecessary-template-expression.js

@@ -120,16 +120,37 @@ "use strict";

}
const fixableExpressions = node.expressions
.filter(expression => isLiteral(expression) ||
isTemplateLiteral(expression) ||
(0, util_1.isUndefinedIdentifier)(expression) ||
isInfinityIdentifier(expression) ||
isNaNIdentifier(expression))
const fixableExpressionsReversed = node.expressions
.map((expression, index) => ({
expression,
nextQuasi: node.quasis[index + 1],
prevQuasi: node.quasis[index],
}))
.filter(({ expression, nextQuasi }) => {
if ((0, util_1.isUndefinedIdentifier)(expression) ||
isInfinityIdentifier(expression) ||
isNaNIdentifier(expression)) {
return true;
}
if (isLiteral(expression)) {
// allow trailing whitespace literal
if (startsWithNewLine(nextQuasi.value.raw)) {
return !(typeof expression.value === 'string' &&
isWhitespace(expression.value));
}
return true;
}
if (isTemplateLiteral(expression)) {
// allow trailing whitespace literal
if (startsWithNewLine(nextQuasi.value.raw)) {
return !(expression.quasis.length === 1 &&
isWhitespace(expression.quasis[0].value.raw));
}
return true;
}
return false;
})
.reverse();
let nextCharacterIsOpeningCurlyBrace = false;
for (const expression of fixableExpressions) {
for (const { expression, nextQuasi, prevQuasi, } of fixableExpressionsReversed) {
const fixers = [];
const index = node.expressions.indexOf(expression);
const prevQuasi = node.quasis[index];
const nextQuasi = node.quasis[index + 1];
if (nextQuasi.value.raw.length !== 0) {
if (nextQuasi.value.raw !== '') {
nextCharacterIsOpeningCurlyBrace =

@@ -228,2 +249,16 @@ nextQuasi.value.raw.startsWith('{');

});
function isWhitespace(x) {
// allow empty string too since we went to allow
// ` ${''}
// `;
//
// in addition to
// `${' '}
// `;
//
return /^\s*$/.test(x);
}
function startsWithNewLine(x) {
return x.startsWith('\n') || x.startsWith('\r\n');
}
//# sourceMappingURL=no-unnecessary-template-expression.js.map

14

package.json
{
"name": "@typescript-eslint/eslint-plugin",
"version": "8.16.1-alpha.1",
"version": "8.16.1-alpha.2",
"description": "TypeScript plugin for ESLint",

@@ -64,6 +64,6 @@ "files": [

"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.16.1-alpha.1",
"@typescript-eslint/type-utils": "8.16.1-alpha.1",
"@typescript-eslint/utils": "8.16.1-alpha.1",
"@typescript-eslint/visitor-keys": "8.16.1-alpha.1",
"@typescript-eslint/scope-manager": "8.16.1-alpha.2",
"@typescript-eslint/type-utils": "8.16.1-alpha.2",
"@typescript-eslint/utils": "8.16.1-alpha.2",
"@typescript-eslint/visitor-keys": "8.16.1-alpha.2",
"graphemer": "^1.4.0",

@@ -79,4 +79,4 @@ "ignore": "^5.3.1",

"@types/natural-compare": "*",
"@typescript-eslint/rule-schema-to-typescript-types": "8.16.1-alpha.1",
"@typescript-eslint/rule-tester": "8.16.1-alpha.1",
"@typescript-eslint/rule-schema-to-typescript-types": "8.16.1-alpha.2",
"@typescript-eslint/rule-tester": "8.16.1-alpha.2",
"ajv": "^6.12.6",

@@ -83,0 +83,0 @@ "cross-env": "^7.0.3",

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