@bhsd/common 0.4.5 → 0.4.6

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/bin/dev.cjs CHANGED
@@ -4,9 +4,10 @@
4
4
  const fs = require('fs'),
5
5
  {devDependencies, version} = require('@bhsd/common/package.json'),
6
6
  json = require(`${process.cwd()}/package.json`);
7
-
8
- json.devDependencies = Object.fromEntries(
9
- [...Object.entries({...devDependencies, ...json.devDependencies, '@bhsd/common': `^${version}`})]
10
- .sort(([a], [b]) => a.localeCompare(b)),
11
- );
7
+ const {dependencies} = json,
8
+ dev = Object.fromEntries(
9
+ [...Object.entries({...json.devDependencies, ...devDependencies})].sort(([a], [b]) => a.localeCompare(b)),
10
+ );
11
+ (dependencies && '@bhsd/common' in dependencies ? dependencies : dev)['@bhsd/common'] = `^${version}`;
12
+ json.devDependencies = dev;
12
13
  fs.writeFileSync('package.json', `${JSON.stringify(json, null, '\t')}\n`);
package/dist/index.js CHANGED
@@ -65,17 +65,17 @@ const splitColors = (str, hsl = true) => {
65
65
  };
66
66
  const loadScript = (src, globalConst, amd) => new Promise((resolve) => {
67
67
  const path = `${CDN}/${src}`;
68
- let obj = window;
68
+ let obj = globalThis;
69
69
  for (const prop of globalConst.split(".")) {
70
70
  obj = obj?.[prop];
71
71
  }
72
72
  if (obj) {
73
73
  resolve();
74
74
  } else if (amd && typeof define === "function" && "amd" in define) {
75
- const requirejs = window.require;
75
+ const requirejs = globalThis.require;
76
76
  requirejs.config({ paths: { [globalConst]: path } });
77
77
  requirejs([globalConst], (exports) => {
78
- Object.assign(window, { [globalConst]: exports });
78
+ Object.assign(globalThis, { [globalConst]: exports });
79
79
  resolve();
80
80
  });
81
81
  } else {
package/eslintrc.cjs CHANGED
@@ -480,6 +480,7 @@ module.exports = {
480
480
  ],
481
481
  'promise/no-multiple-resolved': 2,
482
482
  'promise/prefer-await-to-then': 2,
483
+ 'promise/spec-only': 2,
483
484
  'regexp/no-contradiction-with-assertion': 2,
484
485
  'regexp/no-dupe-disjunctions': [
485
486
  2,
@@ -540,6 +541,7 @@ module.exports = {
540
541
  name: 'e',
541
542
  },
542
543
  ],
544
+ 'unicorn/consistent-existence-index-check': 2,
543
545
  'unicorn/consistent-function-scoping': [
544
546
  2,
545
547
  {
@@ -586,9 +588,11 @@ module.exports = {
586
588
  'unicorn/prefer-array-some': 2,
587
589
  'unicorn/prefer-code-point': 2,
588
590
  'unicorn/prefer-default-parameters': 2,
591
+ 'unicorn/prefer-global-this': 2,
589
592
  'unicorn/prefer-includes': 2,
590
593
  'unicorn/prefer-keyboard-event-key': 2,
591
594
  'unicorn/prefer-logical-operator-over-ternary': 2,
595
+ 'unicorn/prefer-math-min-max': 2,
592
596
  'unicorn/prefer-native-coercion-functions': 2,
593
597
  'unicorn/prefer-negative-index': 2,
594
598
  'unicorn/prefer-optional-catch-binding': 2,
@@ -769,7 +773,7 @@ module.exports = {
769
773
  },
770
774
  ],
771
775
  'no-throw-literal': 0,
772
- '@typescript-eslint/no-throw-literal': 2,
776
+ '@typescript-eslint/only-throw-error': 2,
773
777
  'no-unused-expressions': 0,
774
778
  '@typescript-eslint/no-unused-expressions': 2,
775
779
  'no-unused-vars': 0,
@@ -810,14 +814,6 @@ module.exports = {
810
814
  '@typescript-eslint/require-await': 2,
811
815
  'unicorn/prefer-string-starts-ends-with': 0,
812
816
  '@typescript-eslint/prefer-string-starts-ends-with': 2,
813
- '@typescript-eslint/ban-types': [
814
- 2,
815
- {
816
- types: {
817
- Function: false,
818
- },
819
- },
820
- ],
821
817
  '@typescript-eslint/consistent-generic-constructors': 2,
822
818
  '@typescript-eslint/consistent-indexed-object-style': 2,
823
819
  '@typescript-eslint/consistent-type-assertions': 2,
@@ -835,14 +831,6 @@ module.exports = {
835
831
  allowIIFEs: true,
836
832
  },
837
833
  ],
838
- '@typescript-eslint/member-delimiter-style': [
839
- 2,
840
- {
841
- singleline: {
842
- delimiter: 'comma',
843
- },
844
- },
845
- ],
846
834
  '@typescript-eslint/method-signature-style': [
847
835
  2,
848
836
  'method',
@@ -850,6 +838,12 @@ module.exports = {
850
838
  '@typescript-eslint/no-confusing-non-null-assertion': 2,
851
839
  '@typescript-eslint/no-confusing-void-expression': 2,
852
840
  '@typescript-eslint/no-duplicate-type-constituents': 2,
841
+ '@typescript-eslint/no-empty-object-type': [
842
+ 2,
843
+ {
844
+ allowInterfaces: 'with-single-extends',
845
+ },
846
+ ],
853
847
  '@typescript-eslint/no-explicit-any': [
854
848
  2,
855
849
  {
@@ -899,8 +893,24 @@ module.exports = {
899
893
  '@typescript-eslint/prefer-for-of': 2,
900
894
  '@typescript-eslint/prefer-reduce-type-parameter': 2,
901
895
  '@typescript-eslint/prefer-return-this-type': 2,
902
- '@typescript-eslint/switch-exhaustiveness-check': 2,
903
- '@typescript-eslint/type-annotation-spacing': [
896
+ '@typescript-eslint/related-getter-setter-pairs': 2,
897
+ '@typescript-eslint/switch-exhaustiveness-check': [
898
+ 2,
899
+ {
900
+ considerDefaultExhaustiveForUnions: true,
901
+ },
902
+ ],
903
+ '@typescript-eslint/unified-signatures': 2,
904
+ 'func-style': 0,
905
+ '@stylistic/member-delimiter-style': [
906
+ 2,
907
+ {
908
+ singleline: {
909
+ delimiter: 'comma',
910
+ },
911
+ },
912
+ ],
913
+ '@stylistic/type-annotation-spacing': [
904
914
  2,
905
915
  {
906
916
  before: false,
@@ -912,8 +922,6 @@ module.exports = {
912
922
  },
913
923
  },
914
924
  ],
915
- '@typescript-eslint/unified-signatures': 2,
916
- 'func-style': 0,
917
925
  '@stylistic/type-generic-spacing': 2,
918
926
  '@stylistic/type-named-tuple-spacing': 2,
919
927
  'jsdoc/check-types': 0,
package/eslintrc.node.cjs CHANGED
@@ -18,7 +18,12 @@ module.exports = {
18
18
  2,
19
19
  'module.exports',
20
20
  ],
21
- 'n/no-missing-import': 2,
21
+ 'n/no-missing-import': [
22
+ 2,
23
+ {
24
+ ignoreTypeImport: true,
25
+ },
26
+ ],
22
27
  'n/no-missing-require': 2,
23
28
  'n/no-mixed-requires': 2,
24
29
  'n/no-new-require': 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/common",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "/dist/",
@@ -13,27 +13,28 @@
13
13
  },
14
14
  "scripts": {
15
15
  "build": "tsc --emitDeclarationOnly && esbuild src/index.ts --charset=utf8 --target=es2023 --format=cjs --outfile=dist/index.js",
16
- "lint": "tsc --noEmit && eslint --cache ."
16
+ "lint:ts": "tsc --noEmit && eslint --cache .",
17
+ "lint": "npm run lint:ts"
17
18
  },
18
19
  "devDependencies": {
19
- "@stylistic/eslint-plugin": "^2.3.0",
20
- "@stylistic/stylelint-plugin": "^2.0.0",
21
- "@typescript-eslint/eslint-plugin": "^7.15.0",
22
- "@typescript-eslint/parser": "^7.15.0",
23
- "esbuild": "^0.21.4",
24
- "eslint": "^8.56.0",
25
- "eslint-plugin-es-x": "^8.0.0",
20
+ "@stylistic/eslint-plugin": "^2.11.0",
21
+ "@stylistic/stylelint-plugin": "^3.1.1",
22
+ "@typescript-eslint/eslint-plugin": "^8.16.0",
23
+ "@typescript-eslint/parser": "^8.16.0",
24
+ "esbuild": "^0.24.0",
25
+ "eslint": "^8.57.1",
26
+ "eslint-plugin-es-x": "^8.4.1",
26
27
  "eslint-plugin-eslint-comments": "^3.2.0",
27
- "eslint-plugin-jsdoc": "^48.5.2",
28
+ "eslint-plugin-jsdoc": "^50.6.0",
28
29
  "eslint-plugin-json-es": "^1.6.0",
29
- "eslint-plugin-markdown": "^4.0.1",
30
- "eslint-plugin-n": "^17.9.0",
31
- "eslint-plugin-promise": "^6.2.0",
30
+ "eslint-plugin-markdown": "4.0.1",
31
+ "eslint-plugin-n": "^17.14.0",
32
+ "eslint-plugin-promise": "^7.2.1",
32
33
  "eslint-plugin-regexp": "^2.6.0",
33
- "eslint-plugin-unicorn": "^54.0.0",
34
+ "eslint-plugin-unicorn": "^56.0.1",
34
35
  "http-server": "^14.1.0",
35
- "stylelint": "^16.6.1",
36
+ "stylelint": "^16.11.0",
36
37
  "stylelint-config-recommended": "^14.0.0",
37
- "typescript": "^5.5.3"
38
+ "typescript": "^5.7.2"
38
39
  }
39
40
  }