Skip to content

Commit d73b3bc

Browse files
committed
better code style for typescript
1 parent a8299b5 commit d73b3bc

13 files changed

Lines changed: 9 additions & 122 deletions

File tree

eslint.config.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import tsParser from '@typescript-eslint/parser'
2-
import tseslintPlugin from '@typescript-eslint/eslint-plugin'
32
import importPlugin from 'eslint-plugin-import'
43

54
export default [
@@ -12,7 +11,7 @@ export default [
1211
],
1312
},
1413
{
15-
files: ['src/**/*.js', 'src/**/*.ts', 'src/**/*.cjs', 'src/**/*.mjs'],
14+
files: ['src/**/*.ts'],
1615
languageOptions: {
1716
parser: tsParser,
1817
parserOptions: {
@@ -21,19 +20,20 @@ export default [
2120
},
2221
},
2322
plugins: {
24-
'@typescript-eslint': tseslintPlugin,
2523
import: importPlugin,
2624
},
2725
rules: {
26+
// Style rules (not handled by TypeScript)
2827
semi: ['error', 'never'],
2928
quotes: ['error', 'single'],
30-
'no-unused-vars': 'off', // handled by TS
31-
'@typescript-eslint/no-unused-vars': ['warn'],
32-
'@typescript-eslint/no-explicit-any': 'warn',
29+
30+
// Disable ESLint rules that TypeScript handles better
31+
'no-unused-vars': 'off', // TypeScript handles this via noUnusedLocals
32+
'no-undef': 'off', // TypeScript handles undefined variables
3333
},
3434
},
3535
{
36-
files: ['test/**/*.js', 'test/**/*.ts'],
36+
files: ['test/**/*.ts'],
3737
languageOptions: {
3838
parser: tsParser,
3939
parserOptions: {

package-lock.json

Lines changed: 0 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"@babel/preset-env": "^7.28.3",
5353
"@babel/preset-typescript": "^7.27.1",
5454
"@types/jest": "^30.0.0",
55-
"@typescript-eslint/eslint-plugin": "^8.46.2",
5655
"@typescript-eslint/parser": "^8.34.0",
5756
"babel-jest": "^30.1.2",
5857
"babel-loader": "^10.0.0",

src/acl/aclLogic.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ export function createAclLogic(store): AclLogic {
8787

8888
return fetcher.load(docURI).then(result => {
8989
if (!result.ok) {
90-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9190
throw new Error('fetchACLRel: While loading:' + (result as any).error)
9291
}
9392

src/authn/authUtil.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import * as debug from '../util/debug'
77
* see: https://github.com/facebook/jest/issues/936#issuecomment-545080082 for more
88
* @return {any} - an appContext object
99
*/
10-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1110
export const appContext = ():any => {
12-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1311
let { SolidAppContext }: any = window
1412
SolidAppContext ||= {}
1513
SolidAppContext.viewingNoAuthPage = false
@@ -42,7 +40,6 @@ export const appContext = ():any => {
4240
* @returns {NamedNode|null}
4341
*/
4442
export function offlineTestID (): NamedNode | null {
45-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4643
const { $SolidTestEnvironment }: any = window
4744
if (
4845
typeof $SolidTestEnvironment !== 'undefined' &&

src/chat/chatLogic.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export function createChatLogic(store, profileLogic): ChatLogic {
9696
await store.fetcher.load(
9797
new NamedNode(chatContainer.value + 'index.ttl#this')
9898
)
99-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
10099
} catch (e) {
101100
exists = false
102101
}

src/inbox/inboxLogic.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { NamedNode } from 'rdflib'
22
import { InboxLogic } from '../types'
33
import { getArchiveUrl } from '../util/utils'
44

5-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
65
export function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic): InboxLogic {
76

87
async function createInboxFor(peerWebId: string, nick: string) {

src/logic/solidLogic.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import * as debug from '../util/debug'
1717
** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is
1818
** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
1919
*/
20-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2120
export function createSolidLogic(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: Session): SolidLogic {
2221

2322
debug.log('SolidLogic: Unique instance created. There should only be one of these.')

src/profile/profileLogic.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export function createProfileLogic(store, authn, utilityLogic): ProfileLogic {
1717
async function silencedLoadPreferences(user: NamedNode): Promise <NamedNode | undefined> {
1818
try {
1919
return await loadPreferences(user)
20-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2120
} catch (err) {
2221
return undefined
2322
}

src/typeIndex/typeIndexLogic.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export function createTypeIndexLogic(store, authn, profileLogic, utilityLogic):
2323
let publicTypeIndex
2424
try {
2525
publicTypeIndex = await utilityLogic.followOrCreateLink(user, ns.solid('publicTypeIndex') as NamedNode, suggestion, profile)
26-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2726
} catch (err) {
2827
const message = `User ${user} has no pointer in profile to publicTypeIndex file.`
2928
debug.warn(message)
@@ -33,7 +32,6 @@ export function createTypeIndexLogic(store, authn, profileLogic, utilityLogic):
3332
let preferencesFile
3433
try {
3534
preferencesFile = await profileLogic.silencedLoadPreferences(user)
36-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
3735
} catch (err) {
3836
preferencesFile = null
3937
}
@@ -47,7 +45,6 @@ export function createTypeIndexLogic(store, authn, profileLogic, utilityLogic):
4745
try {
4846
privateTypeIndex = store.any(user, ns.solid('privateTypeIndex'), undefined, profile) ||
4947
await utilityLogic.followOrCreateLink(user, ns.solid('privateTypeIndex') as NamedNode, suggestedPrivateTypeIndex, preferencesFile)
50-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
5148
} catch (err) {
5249
const message = `User ${user} has no pointer in preference file to privateTypeIndex file.`
5350
debug.warn(message)
@@ -71,7 +68,6 @@ export function createTypeIndexLogic(store, authn, profileLogic, utilityLogic):
7168
let preferencesFile
7269
try {
7370
preferencesFile = await profileLogic.silencedLoadPreferences(user)
74-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7571
} catch (err) {
7672
const message = `User ${user} has no pointer in profile to preferences file.`
7773
debug.warn(message)
@@ -82,7 +78,6 @@ export function createTypeIndexLogic(store, authn, profileLogic, utilityLogic):
8278
)
8379
let result = []
8480
for (const org of communities) {
85-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8681
result = result.concat(await loadTypeIndexesFor(org as NamedNode) as any)
8782
}
8883
return result
@@ -98,7 +93,6 @@ export function createTypeIndexLogic(store, authn, profileLogic, utilityLogic):
9893
const scopes = await loadAllTypeIndexes(user)
9994
let scopedApps = []
10095
for (const scope of scopes) {
101-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
10296
const scopedApps0 = await getScopedAppsFromIndex(scope, klass) as any
10397
scopedApps = scopedApps.concat(scopedApps0)
10498
}

0 commit comments

Comments
 (0)