Skip to content

Commit 884338d

Browse files
committed
chore: migrate eslint to flat config
1 parent ce503ce commit 884338d

13 files changed

Lines changed: 71 additions & 913 deletions

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import eslint from '@eslint/js'
2+
import tsParser from '@typescript-eslint/parser'
3+
import eslintConfigPrettier from 'eslint-config-prettier/flat'
4+
import { defineConfig } from 'eslint/config'
5+
import globals from 'globals'
6+
import tseslint from 'typescript-eslint'
7+
8+
export default defineConfig(
9+
eslint.configs.recommended,
10+
tseslint.configs.recommended,
11+
eslintConfigPrettier,
12+
{ ignores: ['dist', 'apidocs', 'vitest.config.ts'] },
13+
{
14+
languageOptions: {
15+
globals: { ...globals.node },
16+
parser: tsParser,
17+
ecmaVersion: 9,
18+
parserOptions: {
19+
project: './tsconfig.json',
20+
},
21+
},
22+
rules: {
23+
'@typescript-eslint/no-unused-vars': [
24+
'warn',
25+
{ args: 'after-used', ignoreRestSiblings: false },
26+
],
27+
'no-console': 'warn',
28+
},
29+
},
30+
)

knip.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"project": ["**/*.{js,ts}"],
3-
"entry": ["src/index.ts", "src/generate-api-docs.ts"],
3+
"entry": ["src/generate-api-docs.ts"],
44
"ignore": ["apidocs/*"],
55
"ignoreDependencies": ["@types/co-body"],
66
"ignoreBinaries": ["openssl"]

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
},
1717
"license": "MIT",
1818
"devDependencies": {
19+
"@eslint/js": "^9.39.2",
1920
"@solid/community-server": "^7.0.2",
2021
"@types/maildev": "^0.0.7",
21-
"@typescript-eslint/eslint-plugin": "^8.54.0",
2222
"@typescript-eslint/parser": "^8.54.0",
2323
"cheerio": "^1.0.0-rc.12",
2424
"cross-fetch": "^4.0.0",
2525
"eslint": "^9.39.2",
2626
"eslint-config-prettier": "^10.1.8",
2727
"eslint-import-resolver-typescript": "^4.4.4",
28-
"eslint-plugin-import": "^2.29.1",
29-
"eslint-plugin-prettier": "^5.0.0",
28+
"globals": "^17.2.0",
3029
"knip": "^5.43.6",
3130
"maildev": "^2.1.0",
3231
"msw": "^2.0.14",
3332
"prettier": "^3.0.0",
3433
"puppeteer": "^24.33.0",
3534
"swagger-autogen": "^2.23.6",
35+
"typescript-eslint": "^8.54.0",
3636
"vitest": "^4.0.16"
3737
},
3838
"dependencies": {

src/controllers/integration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { sendMail } from '../services/mailerService.js'
77
import { generateHtmlMessage } from '../templates/generateMessage.js'
88
import { findWritableSettings, getBotFetch } from '../utils.js'
99

10-
// eslint-disable-next-line import/no-named-as-default-member
1110
const { JsonWebTokenError, TokenExpiredError, sign, verify } = jsonwebtoken
1211

1312
export const initializeIntegration: Middleware<{

src/controllers/status.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export const getVerifiedEmails = async (webId: string) => {
1212
const verifiedEmails = tokens
1313
.map(token => {
1414
try {
15-
// eslint-disable-next-line import/no-named-as-default-member
1615
return jsonwebtoken.verify(token, pem) as {
1716
webId: string
1817
email: string

src/test/helpers/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ export const initIntegration = async ({
4141
expect(emailMessage).toBeDefined()
4242
const $ = cheerio.load(emailMessage as string)
4343
const verificationLink = $('a').first().attr('href')
44-
expect(verificationLink).to.not.be.null
44+
expect(verificationLink).to.not.equal(null)
4545
vi.restoreAllMocks()
4646

4747
return { verificationLink }
4848
}
4949

5050
const finishIntegration = async (verificationLink: string) => {
5151
const response = await fetch(verificationLink)
52-
expect(response.ok).to.be.true
52+
expect(response.ok).to.equal(true)
5353
const jwt = await response.text()
5454
return { token: jwt }
5555
}

src/test/helpers/setupPod.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const createFile = async ({
2020
headers: { 'content-type': 'text/turtle' },
2121
})
2222

23-
expect(response.ok).to.be.true
23+
expect(response.ok).to.equal(true)
2424

2525
if (acl) {
2626
await addAcl({
@@ -81,7 +81,7 @@ const patchFile = async ({
8181
body: patch,
8282
headers: { 'content-type': 'text/n3' },
8383
})
84-
expect(response.ok).to.be.true
84+
expect(response.ok).to.equal(true)
8585
}
8686

8787
/**
@@ -200,7 +200,7 @@ const addAcl = async ({
200200
}.`,
201201
})
202202

203-
expect(response.ok).to.be.true
203+
expect(response.ok).to.equal(true)
204204

205205
return response
206206
}

src/test/integration-finish.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('email verification via /verify-email?token=jwt', () => {
4848
const response = await fetch(verificationLink, {
4949
headers: { accept: 'text/plain' },
5050
})
51-
expect(response.ok).to.be.true
51+
expect(response.ok).to.equal(true)
5252
const jwt = await response.text()
5353
const payload = jsonwebtoken.decode(jwt) as jsonwebtoken.JwtPayload
5454

@@ -68,7 +68,7 @@ describe('email verification via /verify-email?token=jwt', () => {
6868
const response = await fetch(verificationLink, {
6969
headers: { accept: 'application/json' },
7070
})
71-
expect(response.ok).to.be.true
71+
expect(response.ok).to.equal(true)
7272
const { token: jwt } = await response.json()
7373

7474
// after, the settings should contain triple <webId> <verification token predicate (config)> "token".
@@ -85,7 +85,7 @@ describe('email verification via /verify-email?token=jwt', () => {
8585
const response = await fetch(verificationLink, {
8686
headers: { accept: 'text/html' },
8787
})
88-
expect(response.ok).to.be.true
88+
expect(response.ok).to.equal(true)
8989
const body = await response.text()
9090
expect(response.headers.get('content-type')).to.equal('text/html')
9191
expect(body).to.include('Your email was successfully verified')

0 commit comments

Comments
 (0)