declapract-typescript-ehmpathy 0.43.3 → 0.43.4
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/errors/bad-practices/error-fns/src/<star><star>/<star>.ts.declapract.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
import { type FileCheckFunction, type FileFixFunction } from 'declapract';
|
|
3
|
+
|
|
4
|
+
export const check: FileCheckFunction = (contents) => {
|
|
5
|
+
if (contents?.includes("from '@ehmpathy/error-fns'")) return; // matches if it includes this
|
|
6
|
+
throw new Error('does not match bad practice'); // does not otherwise
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const fix: FileFixFunction = (contents) => {
|
|
10
|
+
if (!contents) return {}; // do nothing if no contents
|
|
11
|
+
return {
|
|
12
|
+
contents: contents.replace(
|
|
13
|
+
/from '@ehmpathy\/error-fns'/g,
|
|
14
|
+
"from 'helpful-errors'",
|
|
15
|
+
),
|
|
16
|
+
};
|
|
17
|
+
};
|
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.4",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|