Skip to content

Commit 92eda13

Browse files
committed
chore(lint): adopt eslint-config-codex 2.x
1.x checks indentation with ESLint's base `indent` rule, which cannot see TypeScript syntax. Indentation inside TS constructs was therefore never checked at all. 2.x uses @stylistic/indent, which reads it. 2.x ships flat config only, so .eslintrc.js becomes eslint.config.mjs, and eslint and typescript move up to satisfy it. tsconfig drops baseUrl on the way, since TypeScript 7 removes it. eslint-plugin-n rules are disabled where they resolve imports as Node does and report existing .ts files as missing. Applying the fixes is left for a separate commit; src/ is untouched.
1 parent ec65469 commit 92eda13

5 files changed

Lines changed: 1775 additions & 666 deletions

File tree

.eslintrc.js

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

eslint.config.mjs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import CodeX from 'eslint-config-codex';
2+
3+
export default [
4+
...CodeX,
5+
6+
{
7+
rules: {
8+
/**
9+
* Downgraded in .eslintrc.js, kept that way here.
10+
*/
11+
'no-shadow': 'warn',
12+
'no-unused-expressions': 'warn',
13+
14+
/**
15+
* Resolves imports as Node does and never looks for .ts.
16+
*/
17+
'n/no-missing-import': 'off',
18+
19+
/**
20+
* Demand require('process') and require('buffer') over the globals.
21+
*/
22+
'n/prefer-global/process': 'off',
23+
'n/prefer-global/buffer': 'off',
24+
},
25+
},
26+
27+
{
28+
/**
29+
* CodeX registers @typescript-eslint and jsdoc for *.ts only, and resolves
30+
* tsconfigRootDir inside its own package.
31+
*/
32+
files: ['**/*.ts'],
33+
languageOptions: {
34+
parserOptions: {
35+
project: './tsconfig.json',
36+
tsconfigRootDir: import.meta.dirname,
37+
sourceType: 'module',
38+
},
39+
},
40+
rules: {
41+
/**
42+
* Downgraded in .eslintrc.js, kept that way here. `jsdoc/require-jsdoc`
43+
* replaces the removed core `require-jsdoc`.
44+
*/
45+
'@typescript-eslint/no-unused-vars': 'warn',
46+
'@typescript-eslint/explicit-function-return-type': 'warn',
47+
'jsdoc/require-jsdoc': 'warn',
48+
},
49+
},
50+
];

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"scripts": {
77
"dev": "ts-node-dev --no-notify index.ts",
88
"start": "node index.ts",
9-
"lint": "eslint -c ./.eslintrc.js src/ --ext .ts,.js --fix",
10-
"lint-test": "eslint -c ./.eslintrc.js src/ --ext .ts,.js",
9+
"lint": "eslint ./src --fix",
10+
"lint-test": "eslint ./src",
1111
"dev:up": "docker-compose -f docker-compose.dev.yml up -d",
1212
"dev:down": "docker-compose -f docker-compose.dev.yml down",
1313
"build": "tsc",
@@ -24,16 +24,16 @@
2424
"@swc/core": "^1.3.0",
2525
"@types/jest": "^29.5.0",
2626
"@types/xml2js": "^0.4.14",
27-
"eslint": "^6.7.2",
28-
"eslint-config-codex": "1.2.4",
27+
"eslint": "^9.39.5",
28+
"eslint-config-codex": "^2.0.3",
2929
"eslint-plugin-import": "^2.19.1",
3030
"jest": "^30.2.0",
3131
"mongodb-memory-server": "^6.6.1",
3232
"nodemon": "^2.0.2",
3333
"redis-mock": "^0.56.3",
3434
"ts-jest": "^29.4.0",
3535
"ts-node": "^10.9.1",
36-
"typescript": "^4.7.4",
36+
"typescript": "^6.0.3",
3737
"xml2js": "^0.6.2"
3838
},
3939
"dependencies": {

tsconfig.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@
4141

4242
/* Module Resolution Options */
4343
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
44-
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
45-
"paths": { /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
46-
"zod/v4": ["src/types/zod-v4.d.ts"]
44+
"paths": { /* A series of entries which re-map imports to lookup locations relative to this file. */
45+
"zod/v4": ["./src/types/zod-v4.d.ts"]
4746
},
4847
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
4948
// "typeRoots": [], /* List of folders to include type definitions from. */

0 commit comments

Comments
 (0)