declapract-typescript-ehmpathy 0.43.0 → 0.43.2
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/dist/practices/environments/best-practice/src/utils/environment.ts +5 -0
- package/dist/practices/lint/best-practice/biome.json +63 -0
- package/dist/practices/lint/best-practice/package.json +2 -1
- package/dist/practices/package-json-order/best-practice/package.json.declapract.ts +1 -0
- package/dist/practices/persist-with-rds/best-practice/package.json +1 -1
- package/dist/practices/tests/bad-practices/babel/babel.config.js.declapract.ts +3 -0
- package/dist/practices/tests/bad-practices/old-test-utils-and-assets-location/.declapract.readme.md +5 -5
- package/dist/practices/tests/bad-practices/old-test-utils-and-assets-location/<star><star>/<star>.ts.declapract.ts +4 -4
- package/dist/practices/tests/bad-practices/old-test-utils-and-assets-location/<star><star>/__test_assets__/<star><star>/<star>.declapract.ts +2 -2
- package/dist/practices/tests/bad-practices/old-test-utils-and-assets-location/<star><star>/__test_utils__/<star><star>/<star>.declapract.ts +2 -2
- package/dist/practices/tests/best-practice/package.json +1 -1
- package/dist/practices/typescript/best-practice/package.json +2 -1
- package/package.json +1 -1
- /package/dist/practices/tests/{best-practice → bad-practices/babel}/babel.config.js +0 -0
|
@@ -70,6 +70,11 @@ export const getStage = (): Stage => {
|
|
|
70
70
|
if (!isOfStage(stage)) throw new Error(`invalid stage defined '${stage}'`);
|
|
71
71
|
return stage;
|
|
72
72
|
};
|
|
73
|
+
export const stage: Stage = getStage(); // todo: deprecate
|
|
74
|
+
|
|
75
|
+
// export service client stage // todo: deprecate
|
|
76
|
+
export const serviceClientStage =
|
|
77
|
+
stage === Stage.PRODUCTION ? Stage.PRODUCTION : Stage.DEVELOPMENT; // i.e., if its prod, hit prod. otherwise, dev
|
|
73
78
|
|
|
74
79
|
/**
|
|
75
80
|
* .what = infer access (prod/dev) from curernt credentials
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": true
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"includes": [
|
|
10
|
+
"**/src/**/*.ts",
|
|
11
|
+
"!**/dist",
|
|
12
|
+
"!**/coverage",
|
|
13
|
+
"!**/node_modules",
|
|
14
|
+
"!**/.artifact",
|
|
15
|
+
"!**/.generated/**"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"formatter": {
|
|
19
|
+
"enabled": true,
|
|
20
|
+
"indentStyle": "space",
|
|
21
|
+
"indentWidth": 2,
|
|
22
|
+
"lineWidth": 80
|
|
23
|
+
},
|
|
24
|
+
"javascript": {
|
|
25
|
+
"formatter": {
|
|
26
|
+
"quoteStyle": "single",
|
|
27
|
+
"trailingCommas": "all"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
|
31
|
+
"linter": {
|
|
32
|
+
"enabled": true,
|
|
33
|
+
"rules": {
|
|
34
|
+
"recommended": true,
|
|
35
|
+
"complexity": {
|
|
36
|
+
"noExcessiveCognitiveComplexity": "warn"
|
|
37
|
+
},
|
|
38
|
+
"correctness": {
|
|
39
|
+
"noUnusedImports": { "level": "error", "fix": "safe" },
|
|
40
|
+
"noUnusedVariables": "warn",
|
|
41
|
+
"useExhaustiveDependencies": "off"
|
|
42
|
+
},
|
|
43
|
+
"style": {
|
|
44
|
+
"noDefaultExport": "error",
|
|
45
|
+
"noNonNullAssertion": { "level": "warn", "fix": "none" },
|
|
46
|
+
"useImportType": "error",
|
|
47
|
+
"noParameterAssign": "off"
|
|
48
|
+
},
|
|
49
|
+
"suspicious": {
|
|
50
|
+
"noExplicitAny": "warn",
|
|
51
|
+
"noConfusingVoidType": "off",
|
|
52
|
+
"noEmptyBlockStatements": "off",
|
|
53
|
+
"noUnsafeDeclarationMerging": "off",
|
|
54
|
+
"useIterableCallbackReturn": "warn",
|
|
55
|
+
"noDuplicateTestHooks": "off"
|
|
56
|
+
},
|
|
57
|
+
"nursery": {
|
|
58
|
+
"noFloatingPromises": "error",
|
|
59
|
+
"useExplicitType": "warn"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"fix:format:biome": "biome check --write src",
|
|
8
8
|
"fix:lint": "biome check --write src",
|
|
9
9
|
"test:format:biome": "biome format src",
|
|
10
|
-
"test:lint:biome": "
|
|
10
|
+
"test:lint:biome": "biome check src",
|
|
11
|
+
"test:lint:errors": "biome check src --diagnostic-level=error",
|
|
11
12
|
"test:lint:deps": "npx depcheck -c ./.depcheckrc.yml",
|
|
12
13
|
"test:lint": "npm run test:lint:biome && npm run test:lint:deps"
|
|
13
14
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"sql-code-generator": "@declapract{check.minVersion('0.10.1')}",
|
|
8
8
|
"sql-dao-generator": "@declapract{check.minVersion('0.12.0')}",
|
|
9
|
-
"sql-schema-control": "@declapract{check.minVersion('1.
|
|
9
|
+
"sql-schema-control": "@declapract{check.minVersion('1.7.0')}",
|
|
10
10
|
"sql-schema-generator": "@declapract{check.minVersion('0.25.2')}",
|
|
11
11
|
"@types/yesql": "@declapract{check.minVersion('3.2.2')}",
|
|
12
12
|
"@types/pg": "@declapract{check.minVersion('8.6.1')}"
|
package/dist/practices/tests/bad-practices/old-test-utils-and-assets-location/.declapract.readme.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
test utilities and assets should be located in `.test
|
|
1
|
+
test utilities and assets should be located in `.test.utils/` or `.test.assets/` instead of `__test_utils__` or `__test_assets__`
|
|
2
2
|
|
|
3
|
-
the `.test
|
|
3
|
+
the `.test.utils/` directory replaces `__test_utils__` and `.test.assets/` replaces `__test_assets__` in the same relative location.
|
|
4
4
|
|
|
5
5
|
examples:
|
|
6
|
-
- `src/domain/__test_utils__/exampleUser.ts` → `src/domain/.test/
|
|
7
|
-
- `src/logic/__test_assets__/fixtures.json` → `src/logic/.test
|
|
8
|
-
- `acceptance/__test_utils__/environment.ts` → `acceptance/.test/
|
|
6
|
+
- `src/domain/__test_utils__/exampleUser.ts` → `src/domain/.test.utils/exampleUser.ts`
|
|
7
|
+
- `src/logic/__test_assets__/fixtures.json` → `src/logic/.test.assets/fixtures.json`
|
|
8
|
+
- `acceptance/__test_utils__/environment.ts` → `acceptance/.test.utils/environment.ts`
|
|
@@ -10,16 +10,16 @@ export const check: FileCheckFunction = (contents) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* replace __test_utils__ and __test_assets__ with .test
|
|
13
|
+
* replace __test_utils__ and __test_assets__ with .test.utils and .test.assets in import paths
|
|
14
14
|
*/
|
|
15
15
|
export const fix: FileFixFunction = (contents) => {
|
|
16
16
|
if (!contents) return {};
|
|
17
17
|
|
|
18
18
|
// simple string replacement - the relative path stays the same, only the directory name changes
|
|
19
|
-
// e.g., from '../__test_utils__/foo' to '../.test/
|
|
19
|
+
// e.g., from '../__test_utils__/foo' to '../.test.utils/foo'
|
|
20
20
|
const fixedContents = contents
|
|
21
|
-
.replace(/__test_utils__\//g, '.test/
|
|
22
|
-
.replace(/__test_assets__\//g, '.test
|
|
21
|
+
.replace(/__test_utils__\//g, '.test.utils/')
|
|
22
|
+
.replace(/__test_assets__\//g, '.test.assets/');
|
|
23
23
|
|
|
24
24
|
return {
|
|
25
25
|
contents: fixedContents,
|
|
@@ -4,10 +4,10 @@ import { FileCheckType } from 'declapract';
|
|
|
4
4
|
export const check = FileCheckType.EXISTS; // if files exist in __test_assets__ directories, it's bad practice
|
|
5
5
|
|
|
6
6
|
export const fix: FileFixFunction = (contents, context) => {
|
|
7
|
-
// move from any/**/__test_assets__/**/* to .test
|
|
7
|
+
// move from any/**/__test_assets__/**/* to .test.assets/**/*
|
|
8
8
|
const newPath = context.relativeFilePath.replace(
|
|
9
9
|
/__test_assets__\//g,
|
|
10
|
-
'.test
|
|
10
|
+
'.test.assets/',
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
return {
|
|
@@ -4,10 +4,10 @@ import { FileCheckType } from 'declapract';
|
|
|
4
4
|
export const check = FileCheckType.EXISTS; // if files exist in __test_utils__ directories, it's bad practice
|
|
5
5
|
|
|
6
6
|
export const fix: FileFixFunction = (contents, context) => {
|
|
7
|
-
// move from any/**/__test_utils__/**/* to .test
|
|
7
|
+
// move from any/**/__test_utils__/**/* to .test.utils/**/*
|
|
8
8
|
const newPath = context.relativeFilePath.replace(
|
|
9
9
|
/__test_utils__\//g,
|
|
10
|
-
'.test/
|
|
10
|
+
'.test.utils/',
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"devDependencies": {
|
|
3
|
-
"@types/jest": "@declapract{check.minVersion('30.
|
|
3
|
+
"@types/jest": "@declapract{check.minVersion('30.0.0')}",
|
|
4
4
|
"jest": "@declapract{check.minVersion('30.2.0')}",
|
|
5
5
|
"esbuild-register": "@declapract{check.minVersion('3.6.0')}",
|
|
6
6
|
"test-fns": "@declapract{check.minVersion('1.4.2')}",
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
"devDependencies": {
|
|
3
3
|
"typescript": "@declapract{check.minVersion('5.4.5')}",
|
|
4
4
|
"@tsconfig/node20": "@declapract{check.minVersion('20.1.5')}",
|
|
5
|
-
"@tsconfig/strictest": "@declapract{check.minVersion('2.0.5')}"
|
|
5
|
+
"@tsconfig/strictest": "@declapract{check.minVersion('2.0.5')}",
|
|
6
|
+
"@types/node": "@declapract{check.minVersion('22.15.21')}"
|
|
6
7
|
},
|
|
7
8
|
"scripts": {
|
|
8
9
|
"build:clean": "rm dist/ -rf",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "declapract-typescript-ehmpathy",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "declapract best practices declarations for typescript",
|
|
5
|
-
"version": "0.43.
|
|
5
|
+
"version": "0.43.2",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|
|
File without changes
|