Skip to content

Commit

Permalink
chore: eslint with ts config
Browse files Browse the repository at this point in the history
  • Loading branch information
7185 committed Dec 2, 2024
1 parent d3b6c16 commit 12b63ee
Show file tree
Hide file tree
Showing 28 changed files with 727 additions and 921 deletions.
51 changes: 0 additions & 51 deletions action-parser/eslint.config.mjs

This file was deleted.

23 changes: 23 additions & 0 deletions action-parser/eslint.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.strict,
tseslint.configs.stylistic,
{
rules: {
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'never'],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public'
}
]
}
}
)
9 changes: 4 additions & 5 deletions action-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,24 @@
"test:watch": "vitest",
"test:cov": "vitest run --coverage",
"test:debug": "vitest --inspect-brk --inspect --logHeapUsage --no-file-parallelism",
"lint": "eslint \"{src,test}/**/*.ts\"",
"format": "prettier --write \"**/*.{t,mj}s\""
"lint": "eslint --flag unstable_ts_config \"{src,test}/**/*.ts\"",
"format": "prettier --write \"{src,test}/**/*.{m,}ts\" \"*.{m,}ts\""
},
"license": "MIT",
"dependencies": {
"chevrotain": "^11.0.3"
},
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.10.0",
"@swc/core": "^1.9.3",
"@typescript-eslint/eslint-plugin": "^8.10.0",
"@typescript-eslint/parser": "^8.10.0",
"@vitest/coverage-v8": "^2.1.6",
"eslint": "^9.16.0",
"globals": "^15.13.0",
"jiti": "^2.4.1",
"prettier": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"unplugin-swc": "^1.5.1",
"vitest": "^2.1.6"
}
Expand Down
5 changes: 1 addition & 4 deletions action-parser/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ export default defineConfig({
globals: true,
root: './',
coverage: {
exclude: [
...configDefaults.coverage.exclude ?? [],
'*/*.interfaces.ts'
]
exclude: [...(configDefaults.coverage.exclude ?? []), '*/*.interfaces.ts']
}
},
plugins: [
Expand Down
66 changes: 0 additions & 66 deletions backend/eslint.config.mjs

This file was deleted.

38 changes: 38 additions & 0 deletions backend/eslint.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.strict,
tseslint.configs.stylistic,
{
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-extraneous-class': [
'error',
{allowWithDecorator: true}
],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public'
}
],
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true
}
]
}
}
)
16 changes: 6 additions & 10 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
"license": "MIT",
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.{m,}ts\" \"test/**/*.{m,}ts\"",
"format": "prettier --write \"{src,test}/**/*.{m,}ts\" \"*.{m,}ts\"",
"nest": "nest",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,test}/**/*.ts\"",
"lint:fix": "eslint \"{src,test}/**/*.{m,}ts\" --fix",
"lint": "eslint --flag unstable_ts_config \"{src,test}/**/*.ts\"",
"lint:fix": "eslint --flag unstable_ts_config \"{src,test}/**/*.{m,}ts\" --fix",
"test": "vitest run",
"test:watch": "vitest",
"test:cov": "vitest run --coverage",
Expand Down Expand Up @@ -46,8 +46,7 @@
"ws": "^8.18.0"
},
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.13.0",
"@eslint/js": "^9.10.0",
"@nestjs/cli": "^10.4.8",
"@nestjs/schematics": "^10.2.3",
"@nestjs/testing": "^10.4.12",
Expand All @@ -56,13 +55,9 @@
"@types/node": "^20.17.7",
"@types/supertest": "^6.0.2",
"@types/ws": "^8.5.13",
"@typescript-eslint/eslint-plugin": "^8.10.0",
"@typescript-eslint/parser": "^8.10.0",
"@vitest/coverage-v8": "^2.1.6",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.13.0",
"jiti": "^2.4.1",
"prettier": "^3.4.1",
"prisma": "^6.0.0",
"source-map-support": "^0.5.21",
Expand All @@ -71,6 +66,7 @@
"ts-node": "^10.9.2",
"tsconfig-paths": "4.2.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"unplugin-swc": "^1.5.1",
"vitest": "^2.1.6"
}
Expand Down
3 changes: 1 addition & 2 deletions backend/src/world/world.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ export class WorldService {

async getTerrainPage(wid: number, pageX: number, pageZ: number) {
const cacheKey = `T-${wid}-${pageX}-${pageZ}`
let page: Partial<{[key: number]: [number, number]}> | undefined =
let page: Partial<Record<number, [number, number]>> | undefined =
await this.cache.get(cacheKey)

if (page == null) {
page = {}
for (const elev of await this.db.elev.findMany({
Expand Down
52 changes: 0 additions & 52 deletions bot/eslint.config.mjs

This file was deleted.

23 changes: 23 additions & 0 deletions bot/eslint.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.strict,
tseslint.configs.stylistic,
{
rules: {
indent: ['error', 2, {SwitchCase: 1}],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single', {avoidEscape: true}],
semi: ['error', 'never'],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public'
}
]
}
}
)
12 changes: 5 additions & 7 deletions bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,23 @@
"type": "module",
"scripts": {
"start": "node --import 'data:text/javascript,import {register} from \"node:module\"; import {pathToFileURL} from \"node:url\"; register(\"ts-node/esm\", pathToFileURL(\"./\"));' src/bonobot.ts",
"format": "prettier --write \"**/*.{t,cj}s\"",
"lint": "eslint \"src/**/*.ts\""
"format": "prettier --write \"src/**/*.ts\" \"*.{m,}ts\"",
"lint": "eslint --flag unstable_ts_config \"src/**/*.ts\""
},
"license": "MIT",
"dependencies": {
"axios": "^1.7.8",
"ws": "^8.18.0"
},
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.10.0",
"@types/node": "^20.17.7",
"@types/ws": "^8.5.13",
"@typescript-eslint/eslint-plugin": "^8.10.0",
"@typescript-eslint/parser": "^8.10.0",
"eslint": "^9.16.0",
"globals": "^15.13.0",
"jiti": "^2.4.1",
"prettier": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5.7.2"
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0"
}
}
Loading

0 comments on commit 12b63ee

Please sign in to comment.