declapract-typescript-ehmpathy 0.39.10 → 0.39.11
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/uuid/bad-practices/deps-file/.declapract.readme.md +1 -0
- package/dist/practices/uuid/bad-practices/deps-file/package.json.declapract.ts +23 -0
- package/dist/practices/uuid/bad-practices/deps-file/src/deps.ts.declapract.ts +3 -0
- package/dist/practices/uuid/best-practice/package.json +1 -4
- package/package.json +1 -1
- package/dist/practices/uuid/best-practice/.declapract.readme.md +0 -1
- package/dist/practices/uuid/best-practice/src/deps.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
prefer uuid-fns for a stable contract, batteries included
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FileCheckFunction, FileFixFunction } from 'declapract';
|
|
2
|
+
|
|
3
|
+
export const check: FileCheckFunction = (contents) => {
|
|
4
|
+
const packageJSONObject = JSON.parse(contents!);
|
|
5
|
+
if (Object.keys(packageJSONObject.dependencies).includes('uuid')) return; // matches
|
|
6
|
+
if (Object.keys(packageJSONObject.devDependencies).includes('@types/uuid'))
|
|
7
|
+
return; // matches
|
|
8
|
+
throw new Error('does not match bad practice');
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const fix: FileFixFunction = (contents) => {
|
|
12
|
+
if (!contents) return {}; // should not occur
|
|
13
|
+
const packageJSONObject = JSON.parse(contents);
|
|
14
|
+
const fixedPackageJSONObject = {
|
|
15
|
+
...packageJSONObject,
|
|
16
|
+
dependencies: { ...packageJSONObject.dependencies, uuid: undefined },
|
|
17
|
+
devDependencies: {
|
|
18
|
+
...packageJSONObject.dependencies,
|
|
19
|
+
'@types/uuid': undefined,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
return { contents: JSON.stringify(fixedPackageJSONObject, null, 2) };
|
|
23
|
+
};
|
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.39.
|
|
5
|
+
"version": "0.39.11",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
industry standard; the community has converged on it
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { v4 as uuid } from 'uuid';
|