Skip to content

Commit 58c06dc

Browse files
committed
feat: migrate off of tslint and use eslint
1 parent e1909ff commit 58c06dc

File tree

24 files changed

+1796
-370
lines changed

24 files changed

+1796
-370
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
node_modules/

.eslintrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"prettier"
9+
],
10+
"rules": {
11+
"no-shadow": "off",
12+
"@typescript-eslint/no-shadow": "off",
13+
"@typescript-eslint/naming-convention": "off",
14+
"no-bitwise": "off",
15+
"max-classes-per-file": "off",
16+
"no-console": "off",
17+
"@typescript-eslint/no-explicit-any": "off",
18+
"no-case-declarations": "off",
19+
"no-useless-escape": "off",
20+
"no-prototype-builtins": "off",
21+
"@typescript-eslint/no-var-requires": "off",
22+
"@typescript-eslint/no-namespace": "off",
23+
"no-control-regex": "off",
24+
"@typescript-eslint/no-unused-vars": ["error", {
25+
"argsIgnorePattern": "^_",
26+
"varsIgnorePattern": "^_"
27+
}]
28+
}
29+
}

lib/analyzer/image-inspector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ function isLocalImageSameArchitecture(
377377
return platformArchitecture === inspectResultArchitecture;
378378
}
379379

380-
async function pullIfNotLocal(targetImage: string, options?: DockerOptions) {
380+
async function pullIfNotLocal(targetImage: string, _options?: DockerOptions) {
381381
const docker = new Docker();
382382
try {
383383
await docker.inspectImage(targetImage);

lib/analyzer/package-managers/apk.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ function parseLine(
5454
break;
5555
case "r": // Depends
5656
case "D": // Depends
57-
// tslint:disable-next-line:no-duplicate-variable
5857
for (let name of value.split(" ")) {
5958
if (name.charAt(0) !== "!") {
6059
name = name.split("=")[0];

lib/dockerfile/instruction-parser.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export {
1616
};
1717

1818
// Naive regex; see tests for cases
19-
// tslint:disable-next-line:max-line-length
2019
const installRegex =
2120
/(rpm\s+-i|rpm\s+--install|apk\s+((--update|-u|--no-cache)\s+)*add(\s+(--update|-u|--no-cache))*|apt-get\s+((--assume-yes|--yes|-y)\s+)*install(\s+(--assume-yes|--yes|-y))*|apt\s+((--assume-yes|--yes|-y)\s+)*install|dnf\s+((--assumeyes|--best|--nodocs|--allowerasing|-y)\s+)*install(\s+(--assumeyes|--best|--nodocs|--allowerasing|-y))*|microdnf\s+((--nodocs|--best|--assumeyes|-y)\s+)*install(\s+(--nodocs|--best|--assumeyes|-y))*|yum\s+install|aptitude\s+install)\s+/;
2221

lib/dockerfile/instruction-updater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function updateDockerfileBaseImageName(
4040
const argRanges = dockerfile
4141
.getARGs()
4242
.filter((arg) => arg.getProperty()?.getValue() === currentBaseImageName)
43-
.map((arg) => arg.getProperty()?.getValueRange()!);
43+
.map((arg) => arg.getProperty()!.getValueRange()!);
4444

4545
const ranges = fromRanges.concat(argRanges);
4646

lib/extractor/decompress-maybe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function decompressMaybe(): Transform {
6363

6464
// Setup zstd decompressor with streaming API
6565
zstdStream = new ZstdDecompress(
66-
(data: Uint8Array, final?: boolean) => {
66+
(data: Uint8Array, _final?: boolean) => {
6767
transform.push(Buffer.from(data));
6868
},
6969
);

lib/extractor/oci-archive/layer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ async function tryParseJsonMetadata(stream: Readable): Promise<unknown> {
214214
// Keep a no-op error handler to prevent unhandled error events
215215
// when the stream is drained after fast-fail
216216
stream.removeAllListeners("error");
217-
// tslint:disable-next-line:no-empty
217+
// eslint-disable-next-line @typescript-eslint/no-empty-function
218218
stream.on("error", () => {});
219219
};
220220

lib/go-parser/go-binary.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ export function readRawBuildInfo(binary: Elf): RawBuildInfo {
288288
const buildInfoAlign = 16;
289289
const buildInfoSize = 32;
290290

291+
// eslint-disable-next-line no-constant-condition
291292
while (true) {
292293
const i = data.toString("binary").indexOf(buildInfoMagic);
293294
if (i < 0 || data.length - i < buildInfoSize) {

lib/inputs/redHat/static.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function getRedHatRepositoriesFromExtractedLayers(
1919
if (!contentManifest || !contentManifest.content_sets) {
2020
continue;
2121
}
22-
repositories.push(...contentManifest?.content_sets);
22+
repositories.push(...contentManifest.content_sets);
2323
}
2424
}
2525

0 commit comments

Comments
 (0)