declapract-typescript-ehmpathy 0.42.1 → 0.42.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.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FileCheckFunction, FileFixFunction } from 'declapract';
|
|
2
|
+
|
|
3
|
+
export const check: FileCheckFunction = (contents) => {
|
|
4
|
+
if (!contents) throw new Error('does not match bad practice');
|
|
5
|
+
const packageJSONObject = JSON.parse(contents);
|
|
6
|
+
if (Object.keys(packageJSONObject.scripts).includes('postinstall')) return; // matches
|
|
7
|
+
throw new Error('does not match bad practice');
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const fix: FileFixFunction = (contents) => {
|
|
11
|
+
if (!contents) return {}; // should not occur
|
|
12
|
+
const packageJSONObject = JSON.parse(contents);
|
|
13
|
+
const fixedPackageJSONObject = {
|
|
14
|
+
...packageJSONObject,
|
|
15
|
+
scripts: { ...packageJSONObject.scripts, postinstall: undefined }, // drop postinstall
|
|
16
|
+
};
|
|
17
|
+
return { contents: JSON.stringify(fixedPackageJSONObject, null, 2) };
|
|
18
|
+
};
|
|
@@ -5,10 +5,11 @@ ignores:
|
|
|
5
5
|
- '@commitlint/config-conventional'
|
|
6
6
|
- '@trivago/prettier-plugin-sort-imports'
|
|
7
7
|
- '@tsconfig/node-lts-strictest'
|
|
8
|
+
- babel-jest
|
|
8
9
|
- core-js
|
|
9
10
|
- ts-jest
|
|
10
|
-
-
|
|
11
|
-
- test-fns
|
|
12
|
-
- helpful-errors
|
|
11
|
+
- tsx
|
|
13
12
|
- husky
|
|
14
13
|
- if-env
|
|
14
|
+
- test-fns
|
|
15
|
+
- helpful-errors
|
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.42.
|
|
5
|
+
"version": "0.42.2",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|