@danielgindi/dom-utils 1.0.8 → 1.0.10

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,136 @@
1
+ import globals from "globals";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import js from "@eslint/js";
5
+ import { FlatCompat } from "@eslint/eslintrc";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const compat = new FlatCompat({
10
+ baseDirectory: __dirname,
11
+ recommendedConfig: js.configs.recommended,
12
+ allConfig: js.configs.all,
13
+ });
14
+
15
+ export default [
16
+ {
17
+ ignores: [
18
+ "tests/**/*",
19
+ "test/**/*",
20
+ "!tests/**/*tests.js",
21
+ "!test/**/*tests.js",
22
+ "!tests/**/*_test.js",
23
+ "!test/**/*_test.js",
24
+ "!tests/**/*_helpers.js",
25
+ "!test/**/*_helpers.js",
26
+ "dist/**/*",
27
+ "example/**/*",
28
+ ],
29
+ },
30
+ ...compat.extends("eslint:recommended"),
31
+ {
32
+ languageOptions: {
33
+ globals: {
34
+ ...Object.fromEntries(Object.entries(globals.node).map(([key]) => [key, "off"])),
35
+ ...globals.browser,
36
+ },
37
+
38
+ ecmaVersion: 2020,
39
+ sourceType: "module",
40
+ },
41
+
42
+ rules: {
43
+ semi: ["warn", "always"],
44
+ "comma-dangle": ["warn", "always-multiline"],
45
+ "comma-style": ["warn", "last"],
46
+ "no-var": ["warn"],
47
+
48
+ "arrow-spacing": ["warn", {
49
+ before: true,
50
+ after: true,
51
+ }],
52
+
53
+ "space-infix-ops": ["warn", {
54
+ int32Hint: true,
55
+ }],
56
+
57
+ "keyword-spacing": ["warn", {
58
+ before: true,
59
+ after: true,
60
+ }],
61
+
62
+ "space-unary-ops": ["warn", {
63
+ words: true,
64
+ nonwords: false,
65
+ }],
66
+
67
+ "comma-spacing": ["warn", {
68
+ before: false,
69
+ after: true,
70
+ }],
71
+
72
+ "object-curly-spacing": ["warn", "always"],
73
+
74
+ "no-unused-vars": ["warn", {
75
+ vars: "all",
76
+ args: "after-used",
77
+ varsIgnorePattern: "[iIgnored]|^_",
78
+ ignoreRestSiblings: false,
79
+ argsIgnorePattern: "^_",
80
+ caughtErrors: "all",
81
+ caughtErrorsIgnorePattern: "^ignore",
82
+ }],
83
+
84
+ "no-console": "warn",
85
+ "no-extra-semi": "warn",
86
+ "no-unreachable": "warn",
87
+
88
+ "no-fallthrough": ["error", {
89
+ commentPattern: "break[\\s\\w]*omitted|fallthrough",
90
+ }],
91
+
92
+ "no-useless-escape": "warn",
93
+ "no-constant-condition": "warn",
94
+ "no-return-await": "warn",
95
+ "no-async-promise-executor": "warn",
96
+ },
97
+ },
98
+ {
99
+ files: [
100
+ "tests/**/*tests.js",
101
+ "test/**/*tests.js",
102
+ "tests/**/*_test.js",
103
+ "test/**/*_test.js",
104
+ ],
105
+
106
+ languageOptions: {
107
+ globals: {
108
+ ...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, "off"])),
109
+ ...globals.node,
110
+ ...globals.mocha,
111
+ ...globals.jest,
112
+ },
113
+ },
114
+
115
+ rules: {
116
+ "no-console": "off",
117
+ },
118
+ },
119
+ {
120
+ files: ["*db*/**/migrations/**/*.js"],
121
+
122
+ rules: {
123
+ "no-console": "off",
124
+ },
125
+ },
126
+ {
127
+ files: ["scripts/**/*.js", "**/eslint.config.mjs"],
128
+
129
+ languageOptions: {
130
+ globals: {
131
+ ...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, "off"])),
132
+ ...globals.node,
133
+ },
134
+ },
135
+ },
136
+ ];
package/lib/DomCompat.js CHANGED
@@ -44,8 +44,7 @@ const remove = function (el) {
44
44
 
45
45
  if ('remove' in el)
46
46
  el.remove();
47
-
48
- if (el.parentNode)
47
+ else if (el.parentNode)
49
48
  el.parentNode.removeChild(el);
50
49
  };
51
50
 
@@ -178,7 +177,7 @@ const detectScopedSelectorFeature = () => {
178
177
  try {
179
178
  document.createElement('div').querySelector(':scope > div');
180
179
  hasScopedQuerySelector = true;
181
- } catch (err) {
180
+ } catch (ignored) {
182
181
  hasScopedQuerySelector = false;
183
182
  }
184
183
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielgindi/dom-utils",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "A collection of dom utilities. So you can work natively with the dom without dom frameworks.",
5
5
  "main": "dist/lib.cjs.min.js",
6
6
  "module": "lib/index.js",
@@ -16,11 +16,11 @@
16
16
  },
17
17
  "scripts": {
18
18
  "build": "npm run lint && node ./scripts/build.js",
19
- "lint": "eslint .",
20
- "lint-fix": "eslint . --fix",
21
- "_postinstall": "husky install",
22
- "prepublishOnly": "pinst --disable && npm run build",
23
- "postpublish": "pinst --enable"
19
+ "lint": "eslint -f codeframe ./",
20
+ "lint-fix": "eslint -f codeframe --fix ./",
21
+ "postinstall": "husky install",
22
+ "prepublishOnly": "npm run build",
23
+ "prepare": "husky"
24
24
  },
25
25
  "bugs": {
26
26
  "url": "https://github.com/danielgindi/dom-utils/issues"
@@ -28,20 +28,21 @@
28
28
  "homepage": "https://github.com/danielgindi/dom-utils#readme",
29
29
  "license": "MIT",
30
30
  "devDependencies": {
31
- "@babel/core": "^7.17.8",
32
- "@babel/preset-env": "^7.16.11",
33
- "@babel/runtime": "^7.17.8",
34
- "@rollup/plugin-babel": "^5.3.1",
35
- "@rollup/plugin-commonjs": "^21.0.3",
36
- "@rollup/plugin-node-resolve": "^13.1.3",
31
+ "@babel/core": "^7.26.9",
32
+ "@babel/preset-env": "^7.26.9",
33
+ "@babel/runtime": "^7.26.9",
34
+ "@rollup/plugin-babel": "^6.0.4",
35
+ "@rollup/plugin-commonjs": "^28.0.2",
36
+ "@rollup/plugin-node-resolve": "^16.0.0",
37
+ "@rollup/plugin-terser": "^0.4.4",
37
38
  "babelify": "^10.0.0",
38
- "core-js": "^3.21.1",
39
- "eslint": "^7.32.0",
40
- "fs-extra": "^10.0.1",
41
- "husky": "^7.0.4",
42
- "pinst": "^2.1.4",
43
- "rollup": "^2.70.1",
44
- "rollup-plugin-terser": "^7.0.2"
45
- },
46
- "dependencies": {}
39
+ "core-js": "^3.40.0",
40
+ "eslint": "^9.20.1",
41
+ "eslint-formatter-codeframe": "^7.32.1",
42
+ "fs-extra": "^11.3.0",
43
+ "globals": "^15.15.0",
44
+ "husky": "^9.1.7",
45
+ "pinst": "^3.0.0",
46
+ "rollup": "^4.34.8"
47
+ }
47
48
  }