Skip to content

Commit bf17b18

Browse files
committed
Add @typescript-eslint/array-type rule and cleanup ts rules
1 parent f91a174 commit bf17b18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+83
-93
lines changed

.oxlintrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
},
99
"settings": {},
1010
"rules": {
11+
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
1112
"@typescript-eslint/no-misused-new": ["error"],
1213
"@typescript-eslint/no-this-alias": [
1314
"error",
1415
{ "allowDestructuring": true }
1516
],
17+
"@typescript-eslint/return-await": ["error", "always"],
1618
"unicorn/no-empty-file": "off",
1719
"unicorn/no-new-array": "off",
1820
"no-control-regex": "off",

eslint.config.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,8 @@ module.exports = [
159159
},
160160
rules: {
161161
...sharedRules,
162-
// Define @typescript-eslint/no-extraneous-class because oxlint defines
163-
// "no-extraneous-class": ["deny"] and trying to eslint-disable it will
164-
// cause an eslint "Definition not found" error otherwise.
165-
'@typescript-eslint/no-extraneous-class': ['error'],
166-
'@typescript-eslint/no-floating-promises': ['error'],
167-
// Define @typescript-eslint/no-misused-new because oxlint defines
168-
// "no-misused-new": ["deny"] and trying to eslint-disable it will
169-
// cause an eslint "Definition not found" error otherwise.
162+
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
170163
'@typescript-eslint/no-misused-new': ['error'],
171-
'@typescript-eslint/no-misused-promises': ['error'],
172-
// Define @typescript-eslint/no-this-alias because oxlint defines
173-
// "no-this-alias": ["deny"] and trying to eslint-disable it will
174-
// cause an eslint "Definition not found" error otherwise.
175164
'@typescript-eslint/no-this-alias': [
176165
'error',
177166
{ allowDestructuring: true }

src/commands/action/cmd-action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const cmdAction = {
4949
}
5050

5151
async function run(
52-
argv: string[] | Readonly<string[]>,
52+
argv: string[] | readonly string[],
5353
importMeta: ImportMeta,
5454
{ parentName }: { parentName: string }
5555
): Promise<void> {

src/commands/action/core/classes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// https://github.com/SocketDev/socket-python-cli/blob/6d4fc56faee68d3a4764f1f80f84710635bdaf05/socketsecurity/core/classes.py
22
import { components } from '@socketsecurity/sdk/types/api'
33

4-
type IntroducedBy = [string, string][]
4+
type IntroducedBy = Array<[string, string]>
55

66
export class Alert {
77
key = ''
@@ -53,7 +53,7 @@ export class FullScan {
5353
commit_message = ''
5454
commit_hash = ''
5555
pull_request = 0
56-
sbom_artifacts: components['schemas']['SocketArtifact'][] = []
56+
sbom_artifacts: Array<components['schemas']['SocketArtifact']> = []
5757
packages = {}
5858

5959
constructor(obj: Partial<FullScan> = {}) {
@@ -151,7 +151,7 @@ export class Package {
151151
release = ''
152152
id = ''
153153
direct = false
154-
manifestFiles: { file: string }[] = []
154+
manifestFiles: Array<{ file: string }> = []
155155
author: string[] = []
156156
size = 0
157157
score: Score
@@ -172,7 +172,7 @@ export class Package {
172172
release: string | undefined
173173
id: string | undefined
174174
direct: boolean | undefined
175-
manifestFiles: { file: string }[] | undefined
175+
manifestFiles: Array<{ file: string }> | undefined
176176
author: string[] | undefined
177177
size: number | undefined
178178
score: Score | undefined

src/commands/action/core/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class Core {
3737
fullScanId
3838
}: {
3939
fullScanId: string
40-
}): Promise<components['schemas']['SocketArtifact'][]> {
40+
}): Promise<Array<components['schemas']['SocketArtifact']>> {
4141
const orgFullScanResponse = await this.socket.getOrgFullScan(
4242
this.owner,
4343
fullScanId,
@@ -90,8 +90,8 @@ export class Core {
9090
}: {
9191
pkg: Package
9292
packages: Record<string, Package>
93-
}): [string, string][] {
94-
const introducedBy: [string, string][] = []
93+
}): Array<[string, string]> {
94+
const introducedBy: Array<[string, string]> = []
9595

9696
if (pkg.direct) {
9797
let manifests = pkg.manifestFiles.map(({ file }) => file).join(';')
@@ -424,7 +424,7 @@ export class Core {
424424
}
425425

426426
createPackageFromSbomArtifact(
427-
sbomArtifact: components['schemas']['SocketArtifact'][]
427+
sbomArtifact: Array<components['schemas']['SocketArtifact']>
428428
): Package[] {
429429
return sbomArtifact.map(
430430
sbomArtifact =>

src/commands/analytics/cmd-analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const cmdAnalytics = {
7070
}
7171

7272
async function run(
73-
argv: string[] | Readonly<string[]>,
73+
argv: string[] | readonly string[],
7474
importMeta: ImportMeta,
7575
{ parentName }: { parentName: string }
7676
): Promise<void> {

src/commands/analytics/display-analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ function renderLineCharts(
415415
grid: contrib.grid,
416416
screen: Widgets.Screen,
417417
title: string,
418-
coords: Array<number>,
418+
coords: number[],
419419
data: Record<string, number>
420420
): void {
421421
const line = grid.set(...coords, contrib.line, {

src/commands/audit-log/cmd-audit-log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const cmdAuditLog = {
5757
}
5858

5959
async function run(
60-
argv: string[] | Readonly<string[]>,
60+
argv: string[] | readonly string[],
6161
importMeta: ImportMeta,
6262
{ parentName }: { parentName: string }
6363
): Promise<void> {

src/commands/audit-log/get-audit-log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { Choice } from '@socketsecurity/registry/lib/prompts'
1111

1212
type AuditChoice = Choice<string>
1313

14-
type AuditChoices = (Separator | AuditChoice)[]
14+
type AuditChoices = Array<Separator | AuditChoice>
1515

1616
export async function getAuditLog({
1717
logType,

src/commands/cdxgen/cmd-cdxgen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const cmdCdxgen = {
132132
}
133133

134134
async function run(
135-
argv: string[] | Readonly<string[]>,
135+
argv: string[] | readonly string[],
136136
importMeta: ImportMeta,
137137
{ parentName }: { parentName: string }
138138
): Promise<void> {

0 commit comments

Comments
 (0)