@sklv-labs/dev-configs 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -18
- package/README.md +50 -32
- package/commitlint.js +13 -0
- package/lint-staged.js +5 -0
- package/oxlint/base.json +30 -0
- package/oxlint/nestjs.json +8 -0
- package/package.json +28 -31
- package/{presets/base/prettier.js → prettier.js} +2 -4
- package/{presets/base/tsconfig.json → tsconfig/base.json} +2 -6
- package/tsconfig/nestjs.json +9 -0
- package/configs/git/commitlint.js +0 -28
- package/configs/git/lint-staged.js +0 -4
- package/presets/base/eslint.config.mjs +0 -97
- package/presets/base/jest.config.js +0 -28
- package/presets/base/tsconfig.spec.json +0 -10
- package/presets/nestjs/eslint.config.mjs +0 -102
- package/presets/nestjs/jest.config.js +0 -33
- package/presets/nestjs/tsconfig.json +0 -26
- package/presets/nestjs/tsconfig.spec.json +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,31 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ca25d0e: Turn off `typescript/consistent-type-imports` in the NestJS oxlint preset.
|
|
8
|
+
|
|
9
|
+
NestJS resolves constructor parameters from `design:paramtypes` metadata at runtime, and
|
|
10
|
+
`ValidationPipe` needs the DTO class itself to run class-validator. The rule cannot see either, so
|
|
11
|
+
it reports injected classes and DTOs as type-only imports — and applying its fix erases the
|
|
12
|
+
metadata, breaking dependency injection and request validation with no compile error.
|
|
13
|
+
|
|
14
|
+
## 0.2.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 7cbc371: Move the toolchain to TypeScript 7, oxlint and Vitest.
|
|
19
|
+
|
|
20
|
+
`@sklv-labs/dev-configs` replaces its ESLint and Jest presets with oxlint configuration and drops
|
|
21
|
+
all six of its runtime dependencies. `presets/base/*` and `presets/nestjs/*` move to
|
|
22
|
+
`tsconfig/base.json` and `tsconfig/nestjs.json`, and the Prettier, commitlint and lint-staged
|
|
23
|
+
configs are now exported as `./prettier`, `./commitlint` and `./lint-staged`. This is a breaking
|
|
24
|
+
change for anything importing the old paths.
|
|
25
|
+
|
|
26
|
+
`@sklv-labs/nestjs-config` drops `@nestjs/core` and `rxjs` from its peer dependencies — neither was
|
|
27
|
+
imported. `exports` now uses a single `default` condition instead of claiming both `import` and
|
|
28
|
+
`require` for the same CommonJS file.
|
|
29
|
+
|
|
30
|
+
`@sklv-labs/core` fixes `getEnvironment`, which cast `NODE_ENV` to `Environments` without checking
|
|
31
|
+
it, so any string was reported as a valid environment. It now returns `undefined` for values
|
|
32
|
+
outside the enum. The `Uuid` brand moved to a `unique symbol`, which is a type-level change only.
|
|
33
|
+
|
|
3
34
|
All notable changes to this project will be documented in this file.
|
|
4
35
|
|
|
5
36
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
37
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
38
|
|
|
8
|
-
##
|
|
39
|
+
## 0.1.0
|
|
9
40
|
|
|
10
41
|
First release from the [sklv-labs/ts](https://github.com/sklv-labs/ts) monorepo, replacing the
|
|
11
42
|
standalone `@sklv-labs/ts-dev-configs` package.
|
|
12
43
|
|
|
13
44
|
### Added
|
|
14
45
|
|
|
15
|
-
- `base` and `nestjs`
|
|
16
|
-
- `presets/base/tsconfig.spec.json`, so non-NestJS packages no longer borrow the NestJS one.
|
|
17
|
-
- ESLint plugins are now declared as real `dependencies`, so the presets resolve under pnpm's
|
|
18
|
-
strict `node_modules` layout without hoisting workarounds.
|
|
19
|
-
|
|
20
|
-
### Removed
|
|
21
|
-
|
|
22
|
-
- `src/index.ts` and the `presets/*/index.js` shims, which restated every path already declared
|
|
23
|
-
in `exports`. Reference the subpath exports directly.
|
|
24
|
-
- The unused `react` preset and the vite / vitest / webpack / vscode configs.
|
|
25
|
-
|
|
26
|
-
### Fixed
|
|
27
|
-
|
|
28
|
-
- Presets no longer set `tsconfigRootDir` to their own location inside `node_modules`, which broke
|
|
29
|
-
type-checked linting for consumers.
|
|
30
|
-
- Dropped rules for uninstalled plugins (`@darraghor/nestjs-typed/*`) and for
|
|
31
|
-
`@typescript-eslint/interface-name-prefix`, which no longer exists.
|
|
46
|
+
- `base` and `nestjs` TypeScript presets, plus Prettier and commitlint configuration.
|
package/README.md
CHANGED
|
@@ -1,57 +1,75 @@
|
|
|
1
1
|
# @sklv-labs/dev-configs
|
|
2
2
|
|
|
3
|
-
Shared TypeScript,
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
3
|
+
Shared TypeScript, oxlint, Prettier and commitlint configuration.
|
|
6
4
|
|
|
7
5
|
```bash
|
|
8
|
-
pnpm add -D @sklv-labs/dev-configs
|
|
9
|
-
# add jest + ts-jest too if you use the jest presets
|
|
6
|
+
pnpm add -D @sklv-labs/dev-configs typescript oxlint oxlint-tsgolint prettier
|
|
10
7
|
```
|
|
11
8
|
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
Two flavours: `base` for plain TypeScript, `nestjs` for NestJS packages (adds decorator metadata,
|
|
15
|
-
`prettier/prettier` as an error, and coverage thresholds).
|
|
16
|
-
|
|
17
|
-
`tsconfig.json`
|
|
9
|
+
## TypeScript
|
|
18
10
|
|
|
19
11
|
```json
|
|
20
12
|
{
|
|
21
|
-
"extends": "@sklv-labs/dev-configs/
|
|
13
|
+
"extends": "@sklv-labs/dev-configs/tsconfig/base.json",
|
|
22
14
|
"compilerOptions": { "outDir": "./dist", "rootDir": "./src" },
|
|
23
|
-
"include": ["src/**/*"]
|
|
15
|
+
"include": ["src/**/*"],
|
|
16
|
+
"exclude": ["**/*.test.ts"]
|
|
24
17
|
}
|
|
25
18
|
```
|
|
26
19
|
|
|
27
|
-
`
|
|
20
|
+
`tsconfig/nestjs.json` adds `experimentalDecorators`, `emitDecoratorMetadata` and relaxes
|
|
21
|
+
`strictPropertyInitialization`, which NestJS needs.
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
import baseEslint from '@sklv-labs/dev-configs/eslint/base';
|
|
31
|
-
import { defineConfig } from 'eslint/config';
|
|
23
|
+
Both target ES2024 with `module: nodenext` and enable `strict` plus `noUncheckedIndexedAccess`.
|
|
32
24
|
|
|
33
|
-
|
|
34
|
-
```
|
|
25
|
+
## oxlint
|
|
35
26
|
|
|
36
|
-
`
|
|
27
|
+
oxlint resolves `extends` as a **file path**, not a package specifier, so the path goes through
|
|
28
|
+
`node_modules`:
|
|
37
29
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
module.exports = require('@sklv-labs/dev-configs/configs/git/lint-staged.js');
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"extends": ["./node_modules/@sklv-labs/dev-configs/oxlint/base.json"]
|
|
33
|
+
}
|
|
43
34
|
```
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
Use `oxlint/nestjs.json` for NestJS code. Run with `oxlint --type-aware` to enable the rules that
|
|
37
|
+
need type information; that requires `oxlint-tsgolint`.
|
|
38
|
+
|
|
39
|
+
`base.json` turns two rules off deliberately:
|
|
47
40
|
|
|
48
|
-
|
|
41
|
+
- `typescript/no-unsafe-type-assertion` — branded types cannot be produced without an assertion,
|
|
42
|
+
so the rule fires on correct code.
|
|
43
|
+
- `typescript/no-unnecessary-type-parameters` — a branded-type helper takes the brand as a type
|
|
44
|
+
parameter used once by design; that is the API, not an accident.
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
`nestjs.json` additionally turns off two rules:
|
|
47
|
+
|
|
48
|
+
- `typescript/no-extraneous-class` — a Nest module is a class whose only members are static
|
|
49
|
+
factories.
|
|
50
|
+
- `typescript/consistent-type-imports` — Nest reads constructor parameter types from
|
|
51
|
+
`design:paramtypes` at runtime and `ValidationPipe` needs the DTO class itself, neither of which
|
|
52
|
+
the rule can see. Taking its advice erases the metadata and breaks dependency injection and
|
|
53
|
+
request validation with no compile error.
|
|
54
|
+
|
|
55
|
+
## Prettier, commitlint, lint-staged
|
|
56
|
+
|
|
57
|
+
```jsonc
|
|
58
|
+
// .prettierrc
|
|
59
|
+
"@sklv-labs/dev-configs/prettier"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
// .commitlintrc.json
|
|
64
|
+
{ "extends": ["@sklv-labs/dev-configs/commitlint"] }
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
// package.json "lint-staged", or .lintstagedrc.js
|
|
69
|
+
module.exports = require('@sklv-labs/dev-configs/lint-staged');
|
|
70
|
+
```
|
|
52
71
|
|
|
53
|
-
|
|
54
|
-
the presets import are ordinary dependencies, so they resolve under pnpm without hoisting.
|
|
72
|
+
commitlint extends `@commitlint/config-conventional`; install it alongside.
|
|
55
73
|
|
|
56
74
|
## License
|
|
57
75
|
|
package/commitlint.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Shared commitlint config. Reference as `"@sklv-labs/dev-configs/commitlint"`. */
|
|
2
|
+
module.exports = {
|
|
3
|
+
extends: ['@commitlint/config-conventional'],
|
|
4
|
+
rules: {
|
|
5
|
+
'type-enum': [
|
|
6
|
+
2,
|
|
7
|
+
'always',
|
|
8
|
+
['feat', 'fix', 'docs', 'refactor', 'perf', 'test', 'chore', 'revert', 'build', 'ci'],
|
|
9
|
+
],
|
|
10
|
+
'subject-full-stop': [2, 'never', '.'],
|
|
11
|
+
'header-max-length': [2, 'always', 100],
|
|
12
|
+
},
|
|
13
|
+
};
|
package/lint-staged.js
ADDED
package/oxlint/base.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["typescript", "import", "unicorn", "promise"],
|
|
4
|
+
"categories": {
|
|
5
|
+
"correctness": "error",
|
|
6
|
+
"suspicious": "warn",
|
|
7
|
+
"perf": "warn",
|
|
8
|
+
"pedantic": "off",
|
|
9
|
+
"style": "off"
|
|
10
|
+
},
|
|
11
|
+
"rules": {
|
|
12
|
+
"no-console": [
|
|
13
|
+
"warn",
|
|
14
|
+
{
|
|
15
|
+
"allow": ["warn", "error"]
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"no-debugger": "error",
|
|
19
|
+
"typescript/no-explicit-any": "warn",
|
|
20
|
+
"typescript/no-non-null-assertion": "warn",
|
|
21
|
+
"typescript/consistent-type-imports": "error",
|
|
22
|
+
"typescript/no-floating-promises": "error",
|
|
23
|
+
"typescript/no-misused-promises": "error",
|
|
24
|
+
"import/no-duplicates": "error",
|
|
25
|
+
"unicorn/prefer-node-protocol": "error",
|
|
26
|
+
"typescript/no-unsafe-type-assertion": "off",
|
|
27
|
+
"typescript/no-unnecessary-type-parameters": "off"
|
|
28
|
+
},
|
|
29
|
+
"ignorePatterns": ["dist", "coverage", "*.d.ts"]
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sklv-labs/dev-configs",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"description": "Shared TypeScript, oxlint, Prettier and commitlint configuration for sklv-labs projects",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"typescript",
|
|
7
|
-
"
|
|
8
|
+
"oxlint",
|
|
8
9
|
"prettier",
|
|
9
|
-
"
|
|
10
|
+
"commitlint",
|
|
10
11
|
"config",
|
|
11
12
|
"preset",
|
|
12
13
|
"nestjs"
|
|
@@ -23,45 +24,41 @@
|
|
|
23
24
|
"provenance": true
|
|
24
25
|
},
|
|
25
26
|
"exports": {
|
|
26
|
-
"./
|
|
27
|
-
"./
|
|
28
|
-
"./
|
|
29
|
-
"./
|
|
30
|
-
"./
|
|
31
|
-
"./
|
|
32
|
-
"./
|
|
33
|
-
"./eslint/base": "./presets/base/eslint.config.mjs",
|
|
34
|
-
"./eslint/nestjs": "./presets/nestjs/eslint.config.mjs",
|
|
35
|
-
"./configs/git/commitlint.js": "./configs/git/commitlint.js",
|
|
36
|
-
"./configs/git/lint-staged.js": "./configs/git/lint-staged.js"
|
|
27
|
+
"./oxlint/base.json": "./oxlint/base.json",
|
|
28
|
+
"./oxlint/nestjs.json": "./oxlint/nestjs.json",
|
|
29
|
+
"./prettier": "./prettier.js",
|
|
30
|
+
"./commitlint": "./commitlint.js",
|
|
31
|
+
"./lint-staged": "./lint-staged.js",
|
|
32
|
+
"./tsconfig/base.json": "./tsconfig/base.json",
|
|
33
|
+
"./tsconfig/nestjs.json": "./tsconfig/nestjs.json"
|
|
37
34
|
},
|
|
38
35
|
"files": [
|
|
39
|
-
"
|
|
40
|
-
"
|
|
36
|
+
"tsconfig",
|
|
37
|
+
"oxlint",
|
|
38
|
+
"prettier.js",
|
|
39
|
+
"commitlint.js",
|
|
40
|
+
"lint-staged.js",
|
|
41
41
|
"README.md",
|
|
42
42
|
"CHANGELOG.md",
|
|
43
43
|
"LICENSE"
|
|
44
44
|
],
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"@eslint/js": "^10.0.1",
|
|
47
|
-
"eslint-config-prettier": "^10.1.8",
|
|
48
|
-
"eslint-plugin-import-x": "^4.17.1",
|
|
49
|
-
"eslint-plugin-prettier": "^5.5.6",
|
|
50
|
-
"globals": "^17.12.0",
|
|
51
|
-
"typescript-eslint": "^8.69.0"
|
|
52
|
-
},
|
|
53
45
|
"peerDependencies": {
|
|
54
|
-
"
|
|
55
|
-
"
|
|
46
|
+
"@commitlint/config-conventional": "^21.0.0",
|
|
47
|
+
"oxlint": "^1.81.0",
|
|
56
48
|
"prettier": "^3.6.0",
|
|
57
|
-
"
|
|
58
|
-
"typescript": "^5.9.0 || ^6.0.0"
|
|
49
|
+
"typescript": ">=6.0.0"
|
|
59
50
|
},
|
|
60
51
|
"peerDependenciesMeta": {
|
|
61
|
-
"
|
|
52
|
+
"@commitlint/config-conventional": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"oxlint": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"prettier": {
|
|
62
59
|
"optional": true
|
|
63
60
|
},
|
|
64
|
-
"
|
|
61
|
+
"typescript": {
|
|
65
62
|
"optional": true
|
|
66
63
|
}
|
|
67
64
|
},
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
/** Shared Prettier options. Reference as `"@sklv-labs/dev-configs/prettier"`. */
|
|
1
2
|
module.exports = {
|
|
2
3
|
semi: true,
|
|
3
|
-
trailingComma: 'es5',
|
|
4
4
|
singleQuote: true,
|
|
5
|
+
trailingComma: 'all',
|
|
5
6
|
printWidth: 100,
|
|
6
7
|
tabWidth: 2,
|
|
7
|
-
useTabs: false,
|
|
8
8
|
arrowParens: 'always',
|
|
9
9
|
endOfLine: 'lf',
|
|
10
|
-
bracketSpacing: true,
|
|
11
|
-
bracketSameLine: false,
|
|
12
10
|
};
|
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
"lib": ["ES2024"],
|
|
7
7
|
"moduleResolution": "nodenext",
|
|
8
8
|
"resolveJsonModule": true,
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
"checkJs": false,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"rootDir": "./",
|
|
13
9
|
"strict": true,
|
|
14
10
|
"esModuleInterop": true,
|
|
15
11
|
"skipLibCheck": true,
|
|
@@ -22,7 +18,7 @@
|
|
|
22
18
|
"noImplicitReturns": true,
|
|
23
19
|
"noFallthroughCasesInSwitch": true,
|
|
24
20
|
"isolatedModules": true,
|
|
25
|
-
"
|
|
26
|
-
"
|
|
21
|
+
"types": ["node"],
|
|
22
|
+
"noUncheckedIndexedAccess": true
|
|
27
23
|
}
|
|
28
24
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: ['@commitlint/config-conventional'],
|
|
3
|
-
rules: {
|
|
4
|
-
'type-enum': [
|
|
5
|
-
2,
|
|
6
|
-
'always',
|
|
7
|
-
[
|
|
8
|
-
'feat',
|
|
9
|
-
'fix',
|
|
10
|
-
'docs',
|
|
11
|
-
'style',
|
|
12
|
-
'refactor',
|
|
13
|
-
'perf',
|
|
14
|
-
'test',
|
|
15
|
-
'chore',
|
|
16
|
-
'revert',
|
|
17
|
-
'build',
|
|
18
|
-
'ci',
|
|
19
|
-
],
|
|
20
|
-
],
|
|
21
|
-
'type-case': [2, 'always', 'lower-case'],
|
|
22
|
-
'type-empty': [2, 'never'],
|
|
23
|
-
'scope-case': [2, 'always', 'lower-case'],
|
|
24
|
-
'subject-empty': [2, 'never'],
|
|
25
|
-
'subject-full-stop': [2, 'never', '.'],
|
|
26
|
-
'header-max-length': [2, 'always', 100],
|
|
27
|
-
},
|
|
28
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import eslint from '@eslint/js';
|
|
2
|
-
import { defineConfig } from 'eslint/config';
|
|
3
|
-
import tseslint from 'typescript-eslint';
|
|
4
|
-
import importPlugin from 'eslint-plugin-import-x';
|
|
5
|
-
import globals from 'globals';
|
|
6
|
-
import prettier from 'eslint-config-prettier';
|
|
7
|
-
|
|
8
|
-
export default defineConfig([
|
|
9
|
-
// Base recommended configs
|
|
10
|
-
eslint.configs.recommended,
|
|
11
|
-
...tseslint.configs.recommended,
|
|
12
|
-
...tseslint.configs.recommendedTypeChecked,
|
|
13
|
-
|
|
14
|
-
// Global ignores
|
|
15
|
-
{
|
|
16
|
-
ignores: [
|
|
17
|
-
'dist/**',
|
|
18
|
-
'build/**',
|
|
19
|
-
'node_modules/**',
|
|
20
|
-
'coverage/**',
|
|
21
|
-
'*.config.js',
|
|
22
|
-
'*.config.ts',
|
|
23
|
-
'*.config.mjs',
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
// TypeScript files configuration
|
|
28
|
-
{
|
|
29
|
-
files: ['**/*.{ts,tsx}'],
|
|
30
|
-
languageOptions: {
|
|
31
|
-
ecmaVersion: 2024,
|
|
32
|
-
sourceType: 'module',
|
|
33
|
-
globals: {
|
|
34
|
-
...globals.node,
|
|
35
|
-
...globals.es2024,
|
|
36
|
-
},
|
|
37
|
-
parser: tseslint.parser,
|
|
38
|
-
parserOptions: {
|
|
39
|
-
projectService: true,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
plugins: {
|
|
43
|
-
'@typescript-eslint': tseslint.plugin,
|
|
44
|
-
'import-x': importPlugin,
|
|
45
|
-
},
|
|
46
|
-
rules: {
|
|
47
|
-
// TypeScript specific rules
|
|
48
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
49
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
50
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
51
|
-
'@typescript-eslint/no-unused-vars': [
|
|
52
|
-
'error',
|
|
53
|
-
{
|
|
54
|
-
argsIgnorePattern: '^_',
|
|
55
|
-
varsIgnorePattern: '^_',
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
59
|
-
|
|
60
|
-
// General best practices
|
|
61
|
-
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
62
|
-
'no-debugger': 'error',
|
|
63
|
-
'no-duplicate-imports': 'error',
|
|
64
|
-
'no-unused-expressions': 'error',
|
|
65
|
-
'prefer-const': 'error',
|
|
66
|
-
'prefer-arrow-callback': 'error',
|
|
67
|
-
'prefer-template': 'error',
|
|
68
|
-
|
|
69
|
-
// Import order rules
|
|
70
|
-
'import-x/order': [
|
|
71
|
-
'error',
|
|
72
|
-
{
|
|
73
|
-
groups: [
|
|
74
|
-
'builtin',
|
|
75
|
-
'external',
|
|
76
|
-
'internal',
|
|
77
|
-
'parent',
|
|
78
|
-
'sibling',
|
|
79
|
-
'index',
|
|
80
|
-
'object',
|
|
81
|
-
'type',
|
|
82
|
-
],
|
|
83
|
-
'newlines-between': 'always',
|
|
84
|
-
alphabetize: {
|
|
85
|
-
order: 'asc',
|
|
86
|
-
caseInsensitive: true,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
'import-x/no-duplicates': 'error',
|
|
91
|
-
'import-x/no-unresolved': 'off', // TypeScript handles this
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
// Prettier config (must be last to override formatting rules)
|
|
96
|
-
prettier,
|
|
97
|
-
]);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
preset: 'ts-jest',
|
|
3
|
-
testEnvironment: 'node',
|
|
4
|
-
roots: ['<rootDir>/src', '<rootDir>/test'],
|
|
5
|
-
testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
|
|
6
|
-
transform: {
|
|
7
|
-
'^.+\\.ts$': [
|
|
8
|
-
'ts-jest',
|
|
9
|
-
{
|
|
10
|
-
tsconfig: {
|
|
11
|
-
compilerOptions: {
|
|
12
|
-
module: 'nodenext',
|
|
13
|
-
target: 'ES2024',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts', '!src/**/*.test.ts', '!src/**/*.spec.ts'],
|
|
20
|
-
coverageDirectory: 'coverage',
|
|
21
|
-
coverageReporters: ['text', 'lcov', 'html', 'json'],
|
|
22
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
|
23
|
-
verbose: true,
|
|
24
|
-
clearMocks: true,
|
|
25
|
-
resetMocks: true,
|
|
26
|
-
restoreMocks: true,
|
|
27
|
-
testTimeout: 10000,
|
|
28
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import eslint from '@eslint/js';
|
|
2
|
-
import { defineConfig } from 'eslint/config';
|
|
3
|
-
import tseslint from 'typescript-eslint';
|
|
4
|
-
import importPlugin from 'eslint-plugin-import-x';
|
|
5
|
-
import globals from 'globals';
|
|
6
|
-
import prettier from 'eslint-config-prettier';
|
|
7
|
-
import prettierPlugin from 'eslint-plugin-prettier';
|
|
8
|
-
|
|
9
|
-
export default defineConfig([
|
|
10
|
-
// Base recommended configs
|
|
11
|
-
eslint.configs.recommended,
|
|
12
|
-
...tseslint.configs.recommended,
|
|
13
|
-
...tseslint.configs.recommendedTypeChecked,
|
|
14
|
-
|
|
15
|
-
// Global ignores
|
|
16
|
-
{
|
|
17
|
-
ignores: [
|
|
18
|
-
'dist/**',
|
|
19
|
-
'build/**',
|
|
20
|
-
'node_modules/**',
|
|
21
|
-
'coverage/**',
|
|
22
|
-
'*.config.js',
|
|
23
|
-
'*.config.ts',
|
|
24
|
-
'*.config.mjs',
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
// TypeScript files configuration
|
|
29
|
-
{
|
|
30
|
-
files: ['**/*.ts'],
|
|
31
|
-
languageOptions: {
|
|
32
|
-
ecmaVersion: 2024,
|
|
33
|
-
sourceType: 'module',
|
|
34
|
-
globals: {
|
|
35
|
-
...globals.node,
|
|
36
|
-
...globals.es2024,
|
|
37
|
-
},
|
|
38
|
-
parser: tseslint.parser,
|
|
39
|
-
parserOptions: {
|
|
40
|
-
projectService: true,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
plugins: {
|
|
44
|
-
'@typescript-eslint': tseslint.plugin,
|
|
45
|
-
'import-x': importPlugin,
|
|
46
|
-
prettier: prettierPlugin,
|
|
47
|
-
},
|
|
48
|
-
rules: {
|
|
49
|
-
// TypeScript specific rules
|
|
50
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
51
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
52
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
53
|
-
'@typescript-eslint/no-unused-vars': [
|
|
54
|
-
'error',
|
|
55
|
-
{
|
|
56
|
-
argsIgnorePattern: '^_',
|
|
57
|
-
varsIgnorePattern: '^_',
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
61
|
-
|
|
62
|
-
// General best practices
|
|
63
|
-
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
64
|
-
'no-debugger': 'error',
|
|
65
|
-
'no-duplicate-imports': 'error',
|
|
66
|
-
'no-unused-expressions': 'error',
|
|
67
|
-
'prefer-const': 'error',
|
|
68
|
-
'prefer-arrow-callback': 'error',
|
|
69
|
-
'prefer-template': 'error',
|
|
70
|
-
|
|
71
|
-
// Import order rules
|
|
72
|
-
'import-x/order': [
|
|
73
|
-
'error',
|
|
74
|
-
{
|
|
75
|
-
groups: [
|
|
76
|
-
'builtin',
|
|
77
|
-
'external',
|
|
78
|
-
'internal',
|
|
79
|
-
'parent',
|
|
80
|
-
'sibling',
|
|
81
|
-
'index',
|
|
82
|
-
'object',
|
|
83
|
-
'type',
|
|
84
|
-
],
|
|
85
|
-
'newlines-between': 'always',
|
|
86
|
-
alphabetize: {
|
|
87
|
-
order: 'asc',
|
|
88
|
-
caseInsensitive: true,
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
'import-x/no-duplicates': 'error',
|
|
93
|
-
'import-x/no-unresolved': 'off', // TypeScript handles this
|
|
94
|
-
|
|
95
|
-
// Prettier rules
|
|
96
|
-
'prettier/prettier': 'error',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
// Prettier config (must be last to override formatting rules)
|
|
101
|
-
prettier,
|
|
102
|
-
]);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const baseJest = require('../base/jest.config.js');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
...baseJest,
|
|
5
|
-
roots: ['<rootDir>/src'],
|
|
6
|
-
moduleNameMapper: {
|
|
7
|
-
'^src/(.*)$': '<rootDir>/src/$1',
|
|
8
|
-
},
|
|
9
|
-
testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
|
|
10
|
-
transform: {
|
|
11
|
-
'^.+\\.ts$': [
|
|
12
|
-
'ts-jest',
|
|
13
|
-
{
|
|
14
|
-
tsconfig: 'tsconfig.spec.json',
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
collectCoverageFrom: [
|
|
19
|
-
'src/**/*.ts',
|
|
20
|
-
'!src/**/*.d.ts',
|
|
21
|
-
'!src/**/*.spec.ts',
|
|
22
|
-
'!src/**/*.interface.ts',
|
|
23
|
-
'!src/main.ts',
|
|
24
|
-
],
|
|
25
|
-
coverageThreshold: {
|
|
26
|
-
global: {
|
|
27
|
-
branches: 80,
|
|
28
|
-
functions: 80,
|
|
29
|
-
lines: 80,
|
|
30
|
-
statements: 80,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"extends": "../base/tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"module": "NodeNext",
|
|
6
|
-
"moduleResolution": "NodeNext",
|
|
7
|
-
"target": "ES2024",
|
|
8
|
-
"lib": ["ES2024"],
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"removeComments": true,
|
|
11
|
-
"emitDecoratorMetadata": true,
|
|
12
|
-
"experimentalDecorators": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"incremental": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"strictNullChecks": true,
|
|
18
|
-
"strictPropertyInitialization": false,
|
|
19
|
-
"noImplicitAny": true,
|
|
20
|
-
"strictBindCallApply": true,
|
|
21
|
-
"forceConsistentCasingInFileNames": true,
|
|
22
|
-
"noFallthroughCasesInSwitch": true,
|
|
23
|
-
"types": ["node", "jest"]
|
|
24
|
-
},
|
|
25
|
-
"files": []
|
|
26
|
-
}
|