Skip to content

Commit f94f653

Browse files
authored
refactor: to @moeru/eslint-config (#35)
1 parent 517d848 commit f94f653

File tree

16 files changed

+415
-1310
lines changed

16 files changed

+415
-1310
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ on:
1111
jobs:
1212
build-test:
1313
name: Build Test
14-
runs-on: "ubuntu-latest"
14+
runs-on: ubuntu-latest
1515

1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
1919

2020
- uses: actions/setup-go@v5
2121
with:
22-
go-version: "stable"
22+
go-version: stable
2323
cache: true
2424

2525
- name: Test Build
@@ -33,14 +33,14 @@ jobs:
3333

3434
- uses: actions/setup-go@v5
3535
with:
36-
go-version: "stable"
36+
go-version: stable
3737
cache: true
3838

3939
- name: golangci-lint
4040
uses: golangci/golangci-lint-action@v8
4141
with:
4242
# Optional: golangci-lint command line arguments.
43-
args: "--timeout=10m"
43+
args: --timeout=10m
4444

4545
unittest:
4646
name: Unit Test
@@ -52,7 +52,7 @@ jobs:
5252
- name: Setup Go
5353
uses: actions/setup-go@v5
5454
with:
55-
go-version: "stable"
55+
go-version: stable
5656
cache: true
5757

5858
- name: Unit tests

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
"pcss",
8585
"postcss"
8686
],
87+
"eslint.nodePath": "",
88+
"eslint.runtime": "node",
89+
"eslint.options": { "flags": ["unstable_native_nodejs_ts_config"] },
8790

8891
"go.useLanguageServer": true,
8992
"go.lintOnSave": "package",

eslint.config.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_TESTS } from '@antfu/eslint-config'
2+
import { defineConfig } from '@moeru/eslint-config'
3+
4+
export default defineConfig()
5+
.append({
6+
rules: {
7+
'@masknet/no-default-error': 'off',
8+
'@masknet/no-then': 'off',
9+
'@masknet/unicode-specific-set': 'off',
10+
'sonarjs/todo-tag': 'warn',
11+
'ts/strict-boolean-expressions': 'off',
12+
},
13+
})
14+
.append({
15+
files: [...GLOB_TESTS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN],
16+
rules: {
17+
'@masknet/no-top-level': 'off',
18+
'@masknet/unicode-specific-set': 'off',
19+
'sonarjs/unused-import': 'off',
20+
},
21+
})
22+
.append({
23+
ignores: [
24+
'cspell.config.yaml',
25+
'cspell.config.yml',
26+
'.vscode/settings.json',
27+
'.golangci.yml',
28+
],
29+
})

package.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
{
22
"name": "@unspeech/root",
3-
"private": true,
43
"type": "module",
5-
"packageManager": "[email protected]"
4+
"private": true,
5+
"packageManager": "[email protected]",
6+
"scripts": {
7+
"build": "pnpm -r run build",
8+
"bump": "bumpp",
9+
"lint": "eslint --flag unstable_native_nodejs_ts_config --cache .",
10+
"test": "vitest"
11+
},
12+
"devDependencies": {
13+
"@antfu/eslint-config": "^5.2.1",
14+
"@importantimport/tsconfig": "1.0.0-beta.2",
15+
"@moeru/eslint-config": "0.1.0-beta.9",
16+
"@types/node": "^24.3.0",
17+
"bumpp": "^10.2.3",
18+
"eslint": "^9.34.0",
19+
"jiti": "^2.5.1",
20+
"tsdown": "^0.14.2",
21+
"tsx": "^4.20.5",
22+
"typescript": "^5.9.2"
23+
}
624
}

pkg/backend/alibaba/README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@ Scripts used to scrape the `voices.json`:
33
> Can be directly executed within the browser
44
55
```javascript
6+
// eslint-disable-next-line sonarjs/no-implicit-global
67
rows = Array.from(document.querySelector('#eca844883b0ox > tbody').children)
78

8-
data = rows.map(r => {
9+
// eslint-disable-next-line sonarjs/no-implicit-global
10+
data = rows.map((r) => {
911
const colsValues = []
1012
const columns = Array.from((r.children))
1113
for (const col of columns) {
12-
const audio = col.querySelector('audio')
13-
if (!audio) colsValues.push(col.innerText)
14-
else colsValues.push(audio.src)
14+
const audio = col.querySelector('audio')
15+
if (!audio)
16+
colsValues.push(col.textContent)
17+
else colsValues.push(audio.src)
1518
}
1619

1720
return colsValues
1821
})
1922

23+
// eslint-disable-next-line sonarjs/no-implicit-global
2024
cols = [
2125
{ field: 'name' },
2226
{ field: 'preview_audio_url' },
@@ -28,13 +32,14 @@ cols = [
2832
{ field: 'format' }
2933
]
3034

31-
results = data.map(d => {
32-
const obj = {}
33-
for (let i = 0; i < d.length; i++) {
34-
const field = cols[i].field
35-
obj[field] = d[i]
36-
}
35+
// eslint-disable-next-line sonarjs/no-implicit-global
36+
results = data.map((d) => {
37+
const obj = {}
38+
for (let i = 0; i < d.length; i++) {
39+
const field = cols[i].field
40+
obj[field] = d[i]
41+
}
3742

38-
return obj
43+
return obj
3944
})
4045
```

0 commit comments

Comments
 (0)