Comparing version 1.3.1 to 1.3.2
@@ -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 |
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
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
80332
2065