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

tsr

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsr - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

20

dist/util/parseFile.js

@@ -53,11 +53,21 @@ import ts from "typescript";

const syntaxList = node.getChildren()[syntaxListIndex];
if (!syntaxList) {
throw new Error("syntaxList missing");
}
const firstKeywordToDeleteIndex = syntaxList.getChildren().findIndex((n) => n.kind !== ts.SyntaxKind.Decorator);
const firstKeywordToDelete = syntaxList.getChildren()[firstKeywordToDeleteIndex];
if (!firstKeywordToDelete) {
throw new Error(
"Unexpected syntax list when looking for keywords after decorators"
);
}
const nextSibling = node.getChildren()[syntaxListIndex + 1];
if (!syntaxList || !nextSibling) {
throw new Error("Unexpected syntax");
if (!nextSibling) {
throw new Error("No sibling after syntax list");
}
return {
code: node.getSourceFile().getFullText().slice(syntaxList.getStart(), nextSibling.getStart()),
code: node.getSourceFile().getFullText().slice(firstKeywordToDelete.getStart(), nextSibling.getStart()),
span: {
start: syntaxList.getStart(),
length: nextSibling.getStart() - syntaxList.getStart()
start: firstKeywordToDelete.getStart(),
length: nextSibling.getStart() - firstKeywordToDelete.getStart()
}

@@ -64,0 +74,0 @@ };

@@ -45,3 +45,3 @@ {

},
"version": "1.3.1"
"version": "1.3.2"
}

@@ -107,3 +107,3 @@ # tsr

By default, exported types in `.d.ts` files are not detected. Use the `--include-d-ts` option if you want to include types in `.d.ts` files
By default, exported types in `.d.ts` files are not detected. Use the `--include-d-ts` option if you want to include types in `.d.ts` files.

@@ -140,3 +140,3 @@ ### JavaScript API

When you add a comment `// tsr-skip` to your export declaration, it will be skipped from being removed
When you add a comment `// tsr-skip` to your export declaration, it will be skipped from being removed.

@@ -213,3 +213,3 @@ ```ts

Knip expects users to provide a config file. While this adds the flexibility, it's difficult to correctly configure Knip to suite your needs. tsr relies on `tsconfig.json` to avoid additional setup. If you have a `tsconfig.json` configured in your repository, it works out of the box.
Knip expects users to provide a config file. While this adds the flexibility, it's difficult to correctly configure Knip to suit your needs. tsr relies on `tsconfig.json` to avoid additional setup. If you have a `tsconfig.json` configured in your repository, it works out of the box.

@@ -238,3 +238,3 @@ #### Less ambiguity

tsr provides `---recursive` option which will edit your files until there are no unused code in one pass.
tsr provides `--recursive` option which will edit your files until there are no unused code in one pass.

@@ -241,0 +241,0 @@ #### Key Differences

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