@icebreakers/eslint-config 0.3.6 → 0.3.8

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