Skip to content

Commit 1ba1207

Browse files
committed
tweak eslint config setups
1 parent 17219fc commit 1ba1207

File tree

12 files changed

+107
-48
lines changed

12 files changed

+107
-48
lines changed

assistant/eslint-standardization-roadmap.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,16 +572,18 @@ export default [
572572
- [ ] Create package-specific templates (skipped - going directly to implementation)
573573
- [ ] Test base configuration with simple TypeScript file (skipped - applying to full codebase)
574574

575-
### ✅ Week 2: Backend Migration
576-
- [ ] Create ESLint config for `common` package
577-
- [ ] Create ESLint config for `db` package
578-
- [ ] Update ESLint config for `express` package
579-
- [ ] Create ESLint config for `e2e-db` package
580-
- [ ] Add lint scripts to all backend package.json files
581-
- [ ] Test: `yarn workspace @vue-skuilder/common lint`
582-
- [ ] Test: `yarn workspace @vue-skuilder/db lint`
583-
- [ ] Test: `yarn workspace @vue-skuilder/express lint`
584-
- [ ] Test: `yarn workspace @vue-skuilder/e2e-db lint`
575+
### ✅ Week 2: Backend Migration - COMPLETED
576+
- [x] Create ESLint config for `common` package
577+
- [x] Create ESLint config for `db` package
578+
- [x] Update ESLint config for `express` package
579+
- [x] Create ESLint config for `e2e-db` package
580+
- [x] Add lint scripts to all backend package.json files
581+
- [x] Test: `yarn workspace @vue-skuilder/common lint:check` (11 warnings found)
582+
- [x] Test: `yarn workspace @vue-skuilder/db lint:check` (extensive issues found)
583+
- [x] Test: `yarn workspace @vue-skuilder/express lint:check` (53 problems found)
584+
- [x] Test: `yarn workspace @vue-skuilder/e2e-db lint:check` (28 problems found)
585+
- [x] Fix ESLint config file extensions (.js → .mjs for non-module packages)
586+
- [x] Add appropriate ignore patterns for each package
585587

586588
### ✅ Week 3: Frontend Migration
587589
- [ ] Update `platform-ui` ESLint config to use shared base

eslint.config.backend.js renamed to eslint.config.backend.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import tseslint from 'typescript-eslint';
2-
import baseConfig from './eslint.config.base.js';
2+
import baseConfig from './eslint.config.base.mjs';
33

44
export default tseslint.config(
55
...baseConfig,

eslint.config.base.js renamed to eslint.config.base.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default tseslint.config(
2020
},
2121
],
2222
'@typescript-eslint/no-explicit-any': 'warn',
23-
'@typescript-eslint/prefer-const': 'error',
23+
2424
'@typescript-eslint/no-var-requires': 'error',
2525
'prefer-const': 'error',
2626
'no-var': 'error',

eslint.config.frontend.js renamed to eslint.config.frontend.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import tseslint from 'typescript-eslint';
2-
import baseConfig from './eslint.config.base.js';
2+
import baseConfig from './eslint.config.base.mjs';
33

44
export default tseslint.config(
55
...baseConfig,

packages/common/eslint.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import backendConfig from '../../eslint.config.backend.mjs';
2+
3+
export default [
4+
...backendConfig,
5+
{
6+
ignores: ['node_modules/**', 'dist/**', 'dist-esm/**', 'eslint.config.js'],
7+
},
8+
{
9+
languageOptions: {
10+
parserOptions: {
11+
project: './tsconfig.json',
12+
tsconfigRootDir: import.meta.dirname,
13+
},
14+
},
15+
},
16+
];

packages/common/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
},
1616
"scripts": {
1717
"build": "rm -rf dist dist-esm && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && find dist-esm -name '*.js' -exec sed -i \"s/\\.js'/\\.mjs'/g; s/\\.js\\\"/\\.mjs\\\"/g\" {} \\; && find dist-esm -name '*.js' -exec sh -c 'mv \"$1\" \"${1%.js}.mjs\"' _ {} \\; && cp -r dist-esm/* dist/ && rm -rf dist-esm",
18-
"dev": "tsc --watch"
18+
"dev": "tsc --watch",
19+
"lint": "npx eslint .",
20+
"lint:fix": "npx eslint . --fix",
21+
"lint:check": "npx eslint . --max-warnings 0"
1922
},
2023
"packageManager": "yarn@4.6.0",
2124
"devDependencies": {

packages/db/eslint.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import backendConfig from '../../eslint.config.backend.mjs';
2+
3+
export default [
4+
...backendConfig,
5+
{
6+
ignores: ['node_modules/**', 'dist/**', 'eslint.config.mjs'],
7+
},
8+
{
9+
languageOptions: {
10+
parserOptions: {
11+
project: './tsconfig.json',
12+
tsconfigRootDir: import.meta.dirname,
13+
},
14+
},
15+
rules: {
16+
// Database-specific rules
17+
'@typescript-eslint/no-explicit-any': 'off', // PouchDB types often use any
18+
},
19+
},
20+
];

packages/db/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
"scripts": {
2626
"build": "tsup",
2727
"build:debug": "tsup --sourcemap inline",
28-
"dev": "tsup --watch"
28+
"dev": "tsup --watch",
29+
"lint": "npx eslint .",
30+
"lint:fix": "npx eslint . --fix",
31+
"lint:check": "npx eslint . --max-warnings 0"
2932
},
3033
"dependencies": {
3134
"@nilock2/pouchdb-authentication": "^1.0.2",

packages/e2e-db/eslint.config.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import backendConfig from '../../eslint.config.backend.mjs';
2+
3+
export default [
4+
...backendConfig,
5+
{
6+
ignores: ['node_modules/**', 'userdb-*/**', 'eslint.config.mjs', 'jest.config.js'],
7+
},
8+
{
9+
languageOptions: {
10+
parserOptions: {
11+
project: './tsconfig.json',
12+
tsconfigRootDir: import.meta.dirname,
13+
},
14+
globals: {
15+
// Jest globals
16+
describe: 'readonly',
17+
it: 'readonly',
18+
expect: 'readonly',
19+
beforeEach: 'readonly',
20+
afterEach: 'readonly',
21+
beforeAll: 'readonly',
22+
afterAll: 'readonly',
23+
jest: 'readonly',
24+
},
25+
},
26+
rules: {
27+
// Testing-specific rules
28+
'@typescript-eslint/no-explicit-any': 'off', // Tests often need any for mocking
29+
'@typescript-eslint/explicit-function-return-type': 'off', // Test functions don't need return types
30+
},
31+
},
32+
];

packages/e2e-db/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
"db:start": "cd ../../ && yarn couchdb:start",
1111
"db:stop": "cd ../../ && yarn couchdb:stop",
1212
"test:e2e": "yarn db:start && yarn test && yarn db:stop",
13-
"type-check": "tsc --noEmit"
13+
"type-check": "tsc --noEmit",
14+
"lint": "npx eslint .",
15+
"lint:fix": "npx eslint . --fix",
16+
"lint:check": "npx eslint . --max-warnings 0"
1417
},
1518
"dependencies": {
1619
"@vue-skuilder/common": "workspace:*",

0 commit comments

Comments
 (0)