@icebreakers/eslint-config 0.3.6 → 0.3.7

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/index.cjs CHANGED
@@ -8,13 +8,71 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  const eslintPluginPrettierRecommended__default = /*#__PURE__*/_interopDefaultCompat(eslintPluginPrettierRecommended);
10
10
 
11
+ function isPlainObject(value) {
12
+ if (value === null || typeof value !== "object") {
13
+ return false;
14
+ }
15
+ const prototype = Object.getPrototypeOf(value);
16
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
17
+ return false;
18
+ }
19
+ if (Symbol.iterator in value) {
20
+ return false;
21
+ }
22
+ if (Symbol.toStringTag in value) {
23
+ return Object.prototype.toString.call(value) === "[object Module]";
24
+ }
25
+ return true;
26
+ }
27
+
28
+ function _defu(baseObject, defaults, namespace = ".", merger) {
29
+ if (!isPlainObject(defaults)) {
30
+ return _defu(baseObject, {}, namespace, merger);
31
+ }
32
+ const object = Object.assign({}, defaults);
33
+ for (const key in baseObject) {
34
+ if (key === "__proto__" || key === "constructor") {
35
+ continue;
36
+ }
37
+ const value = baseObject[key];
38
+ if (value === null || value === void 0) {
39
+ continue;
40
+ }
41
+ if (merger && merger(object, key, value, namespace)) {
42
+ continue;
43
+ }
44
+ if (Array.isArray(value) && Array.isArray(object[key])) {
45
+ object[key] = [...value, ...object[key]];
46
+ } else if (isPlainObject(value) && isPlainObject(object[key])) {
47
+ object[key] = _defu(
48
+ value,
49
+ object[key],
50
+ (namespace ? `${namespace}.` : "") + key.toString(),
51
+ merger
52
+ );
53
+ } else {
54
+ object[key] = value;
55
+ }
56
+ }
57
+ return object;
58
+ }
59
+ function createDefu(merger) {
60
+ return (...arguments_) => (
61
+ // eslint-disable-next-line unicorn/no-array-reduce
62
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
63
+ );
64
+ }
65
+ const defu = createDefu();
66
+
11
67
  function icebreaker(options = {}, ...userConfigs) {
12
68
  const {
13
69
  prettier: enablePrettier,
14
70
  tailwindcss: enableTailwindcss = localPkg.isPackageExists("tailwindcss"),
15
71
  mdx: enableMDX,
16
72
  ...opts
17
- } = options;
73
+ } = defu(options, {
74
+ formatters: true
75
+ });
18
76
  const presets = [
19
77
  {
20
78
  rules: {
package/dist/index.mjs CHANGED
@@ -2,13 +2,71 @@ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
2
2
  import { isPackageExists } from 'local-pkg';
3
3
  import { interopDefault, antfu } from '@antfu/eslint-config';
4
4
 
5
+ function isPlainObject(value) {
6
+ if (value === null || typeof value !== "object") {
7
+ return false;
8
+ }
9
+ const prototype = Object.getPrototypeOf(value);
10
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
11
+ return false;
12
+ }
13
+ if (Symbol.iterator in value) {
14
+ return false;
15
+ }
16
+ if (Symbol.toStringTag in value) {
17
+ return Object.prototype.toString.call(value) === "[object Module]";
18
+ }
19
+ return true;
20
+ }
21
+
22
+ function _defu(baseObject, defaults, namespace = ".", merger) {
23
+ if (!isPlainObject(defaults)) {
24
+ return _defu(baseObject, {}, namespace, merger);
25
+ }
26
+ const object = Object.assign({}, defaults);
27
+ for (const key in baseObject) {
28
+ if (key === "__proto__" || key === "constructor") {
29
+ continue;
30
+ }
31
+ const value = baseObject[key];
32
+ if (value === null || value === void 0) {
33
+ continue;
34
+ }
35
+ if (merger && merger(object, key, value, namespace)) {
36
+ continue;
37
+ }
38
+ if (Array.isArray(value) && Array.isArray(object[key])) {
39
+ object[key] = [...value, ...object[key]];
40
+ } else if (isPlainObject(value) && isPlainObject(object[key])) {
41
+ object[key] = _defu(
42
+ value,
43
+ object[key],
44
+ (namespace ? `${namespace}.` : "") + key.toString(),
45
+ merger
46
+ );
47
+ } else {
48
+ object[key] = value;
49
+ }
50
+ }
51
+ return object;
52
+ }
53
+ function createDefu(merger) {
54
+ return (...arguments_) => (
55
+ // eslint-disable-next-line unicorn/no-array-reduce
56
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
57
+ );
58
+ }
59
+ const defu = createDefu();
60
+
5
61
  function icebreaker(options = {}, ...userConfigs) {
6
62
  const {
7
63
  prettier: enablePrettier,
8
64
  tailwindcss: enableTailwindcss = isPackageExists("tailwindcss"),
9
65
  mdx: enableMDX,
10
66
  ...opts
11
- } = options;
67
+ } = defu(options, {
68
+ formatters: true
69
+ });
12
70
  const presets = [
13
71
  {
14
72
  rules: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/eslint-config",
3
3
  "type": "module",
4
- "version": "0.3.6",
4
+ "version": "0.3.7",
5
5
  "description": "icebreakers's eslint config",
6
6
  "author": "SonOfMagic <qq1324318532@gmail.com>",
7
7
  "license": "MIT",
@@ -33,11 +33,12 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@antfu/eslint-config": "2.20.0",
36
+ "@antfu/eslint-config": "2.21.0",
37
37
  "eslint-config-prettier": "^9.1.0",
38
+ "eslint-plugin-format": "^0.1.1",
38
39
  "eslint-plugin-mdx": "^3.1.5",
39
40
  "eslint-plugin-prettier": "^5.1.3",
40
- "eslint-plugin-tailwindcss": "^3.17.0",
41
+ "eslint-plugin-tailwindcss": "^3.17.3",
41
42
  "local-pkg": "^0.5.0"
42
43
  },
43
44
  "publishConfig": {