ts-expect-error-validator
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -9,3 +9,3 @@ "use strict"; | ||
const tsExpectedErrors = []; | ||
const groupedTsExpectedErrors = []; | ||
let tsExpectedErrorLine = ''; | ||
let lineNumber = 0; | ||
@@ -19,8 +19,6 @@ for await (const line of (0, fileReader_1.fileReader)(filePath)) { | ||
if (lineEndsWithTsError === true && tsExpectedLineErrorsInfo !== null) { | ||
groupedTsExpectedErrors.push(tsExpectedLineErrorsInfo); | ||
tsExpectedErrorLine = tsExpectedLineErrorsInfo; | ||
} | ||
if (groupedTsExpectedErrors.length > 0 && isComment === false) { | ||
const expectedErrors = groupedTsExpectedErrors | ||
.join(',') | ||
.split(','); | ||
if (tsExpectedErrorLine.length > 0 && isComment === false) { | ||
const expectedErrors = tsExpectedErrorLine.split(','); | ||
for (const expectedError of expectedErrors) { | ||
@@ -35,7 +33,7 @@ const [code, message] = expectedError.trim().split('-'); | ||
} | ||
groupedTsExpectedErrors.length = 0; | ||
tsExpectedErrorLine = ''; | ||
continue; | ||
} | ||
if (hasTsError === true) { | ||
groupedTsExpectedErrors.push(tsExpectedLineErrorsInfo ?? ''); | ||
tsExpectedErrorLine = tsExpectedLineErrorsInfo ?? ' '; | ||
} | ||
@@ -42,0 +40,0 @@ } |
@@ -8,4 +8,3 @@ "use strict"; | ||
const trimmedLine = line.replaceAll(' ', ''); | ||
const isComment = trimmedLine.startsWith('#') || | ||
trimmedLine.startsWith('//') || | ||
const isComment = trimmedLine.startsWith('//') || | ||
trimmedLine.startsWith('/**') || | ||
@@ -23,3 +22,3 @@ trimmedLine.startsWith('*'); | ||
} | ||
const cleanedLine = trimmedLine.replaceAll('//', '').replaceAll('*', ''); | ||
const cleanedLine = trimmedLine.replaceAll('//', ''); | ||
const lineStartsWithTsError = cleanedLine.startsWith(constants_1.TS_EXPECT_ERROR) || | ||
@@ -30,4 +29,3 @@ cleanedLine.substring(1).startsWith(constants_1.TS_EXPECT_ERROR); | ||
.split('[')[1] | ||
?.split(']')[0] | ||
?.trim(); | ||
?.split(']')[0]; | ||
return { | ||
@@ -34,0 +32,0 @@ lineStartsWithTsError, |
{ | ||
"name": "ts-expect-error-validator", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"author": "pashak09", | ||
@@ -17,2 +17,6 @@ "description": "", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pashak09/ts-expect-error-validator" | ||
}, | ||
"bin": { | ||
@@ -19,0 +23,0 @@ "ts-expect-error-validator": "dist/cli.js" |
@@ -5,4 +5,4 @@ <p align="center"> | ||
</a> | ||
<a href="https://coveralls.io/github/pashak09/ts-expect-error-validator?branch=main"> | ||
<img src="https://coveralls.io/repos/github/pashak09/ts-expect-error-validator/badge.svg?branch=main" alt="Coverage Status" /> | ||
<a href="https://coveralls.io/github/pashak09/ts-expect-error-validator?branch=master"> | ||
<img src="https://coveralls.io/repos/github/pashak09/ts-expect-error-validator/badge.svg?branch=master" alt="Coverage Status" /> | ||
</a> | ||
@@ -9,0 +9,0 @@ <a href="https://www.npmjs.com/package/ts-expect-error-validator"> |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
3
35732
665