@icebreakers/eslint-config 0.3.10 → 0.3.12

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,8 +1,44 @@
1
- 'use strict';
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/index.ts
32
+ var src_exports = {};
33
+ __export(src_exports, {
34
+ icebreaker: () => icebreaker
35
+ });
36
+ module.exports = __toCommonJS(src_exports);
2
37
 
3
- const localPkg = require('local-pkg');
4
- const eslintConfig = require('@antfu/eslint-config');
38
+ // src/factory.ts
39
+ var import_local_pkg = require("local-pkg");
5
40
 
41
+ // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
6
42
  function isPlainObject(value) {
7
43
  if (value === null || typeof value !== "object") {
8
44
  return false;
@@ -19,7 +55,6 @@ function isPlainObject(value) {
19
55
  }
20
56
  return true;
21
57
  }
22
-
23
58
  function _defu(baseObject, defaults, namespace = ".", merger) {
24
59
  if (!isPlainObject(defaults)) {
25
60
  return _defu(baseObject, {}, namespace, merger);
@@ -57,12 +92,30 @@ function createDefu(merger) {
57
92
  arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
58
93
  );
59
94
  }
60
- const defu = createDefu();
95
+ var defu = createDefu();
96
+ var defuFn = createDefu((object, key, currentValue) => {
97
+ if (object[key] !== void 0 && typeof currentValue === "function") {
98
+ object[key] = currentValue(object[key]);
99
+ return true;
100
+ }
101
+ });
102
+ var defuArrayFn = createDefu((object, key, currentValue) => {
103
+ if (Array.isArray(object[key]) && typeof currentValue === "function") {
104
+ object[key] = currentValue(object[key]);
105
+ return true;
106
+ }
107
+ });
108
+
109
+ // src/antfu.ts
110
+ var antfu_exports = {};
111
+ __reExport(antfu_exports, require("@antfu/eslint-config"));
61
112
 
113
+ // src/factory.ts
62
114
  function icebreaker(options = {}, ...userConfigs) {
63
115
  const {
64
- tailwindcss: enableTailwindcss = localPkg.isPackageExists("tailwindcss"),
116
+ tailwindcss: enableTailwindcss = (0, import_local_pkg.isPackageExists)("tailwindcss"),
65
117
  mdx: enableMDX,
118
+ a11y: enableA11y,
66
119
  ...opts
67
120
  } = defu(options, {
68
121
  formatters: true
@@ -77,15 +130,25 @@ function icebreaker(options = {}, ...userConfigs) {
77
130
  "vue/attribute-hyphenation": "off",
78
131
  // 问题在于 auto fix 的时候,会直接 remove 整个 import ,而我们想让用户自己去 remove
79
132
  // 'unused-imports/no-unused-imports': 'error',
80
- "no-unused-vars": "warn"
133
+ // https://typescript-eslint.io/rules/no-unused-vars/
134
+ "no-unused-vars": "off",
135
+ "ts/no-unused-vars": ["error", {
136
+ args: "all",
137
+ argsIgnorePattern: "^_",
138
+ caughtErrors: "all",
139
+ caughtErrorsIgnorePattern: "^_",
140
+ destructuredArrayIgnorePattern: "^_",
141
+ varsIgnorePattern: "^_",
142
+ ignoreRestSiblings: true
143
+ }]
81
144
  }
82
145
  }
83
146
  ];
84
147
  if (enableTailwindcss) {
85
148
  presets.push(
86
- eslintConfig.interopDefault(
149
+ (0, antfu_exports.interopDefault)(
87
150
  // @ts-ignore
88
- import('eslint-plugin-tailwindcss')
151
+ import("eslint-plugin-tailwindcss")
89
152
  ).then((tailwind) => {
90
153
  return tailwind.configs["flat/recommended"];
91
154
  })
@@ -97,7 +160,7 @@ function icebreaker(options = {}, ...userConfigs) {
97
160
  });
98
161
  }
99
162
  if (enableMDX) {
100
- presets.push(eslintConfig.interopDefault(import('eslint-plugin-mdx')).then((mdx) => {
163
+ presets.push((0, antfu_exports.interopDefault)(import("eslint-plugin-mdx")).then((mdx) => {
101
164
  return [
102
165
  {
103
166
  ...mdx.flat,
@@ -115,7 +178,31 @@ function icebreaker(options = {}, ...userConfigs) {
115
178
  ];
116
179
  }));
117
180
  }
118
- return eslintConfig.antfu(opts, ...presets, ...userConfigs);
181
+ if (enableA11y) {
182
+ if (opts.vue) {
183
+ presets.push(
184
+ (0, antfu_exports.interopDefault)(
185
+ // @ts-ignore
186
+ import("eslint-plugin-vuejs-accessibility")
187
+ ).then((pluginVueA11y) => {
188
+ return pluginVueA11y.configs["flat/recommended"];
189
+ })
190
+ );
191
+ }
192
+ if (opts.react) {
193
+ presets.push(
194
+ (0, antfu_exports.interopDefault)(
195
+ // @ts-ignore
196
+ import("eslint-plugin-jsx-a11y")
197
+ ).then((jsxA11y) => {
198
+ return jsxA11y.flatConfigs.recommended;
199
+ })
200
+ );
201
+ }
202
+ }
203
+ return (0, antfu_exports.antfu)(opts, ...presets, ...userConfigs);
119
204
  }
120
-
121
- exports.icebreaker = icebreaker;
205
+ // Annotate the CommonJS export names for ESM import in node:
206
+ 0 && (module.exports = {
207
+ icebreaker
208
+ });
package/dist/index.d.cts CHANGED
@@ -5,6 +5,7 @@ import { Linter } from 'eslint';
5
5
  type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
6
6
  tailwindcss?: boolean;
7
7
  mdx?: boolean;
8
+ a11y?: boolean;
8
9
  };
9
10
  type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>;
10
11
 
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { Linter } from 'eslint';
5
5
  type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
6
6
  tailwindcss?: boolean;
7
7
  mdx?: boolean;
8
+ a11y?: boolean;
8
9
  };
9
10
  type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>;
10
11
 
@@ -1,6 +1,21 @@
1
- import { isPackageExists } from 'local-pkg';
2
- import { interopDefault, antfu } from '@antfu/eslint-config';
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+
15
+ // src/factory.ts
16
+ import { isPackageExists } from "local-pkg";
3
17
 
18
+ // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
4
19
  function isPlainObject(value) {
5
20
  if (value === null || typeof value !== "object") {
6
21
  return false;
@@ -17,7 +32,6 @@ function isPlainObject(value) {
17
32
  }
18
33
  return true;
19
34
  }
20
-
21
35
  function _defu(baseObject, defaults, namespace = ".", merger) {
22
36
  if (!isPlainObject(defaults)) {
23
37
  return _defu(baseObject, {}, namespace, merger);
@@ -55,12 +69,31 @@ function createDefu(merger) {
55
69
  arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
56
70
  );
57
71
  }
58
- const defu = createDefu();
72
+ var defu = createDefu();
73
+ var defuFn = createDefu((object, key, currentValue) => {
74
+ if (object[key] !== void 0 && typeof currentValue === "function") {
75
+ object[key] = currentValue(object[key]);
76
+ return true;
77
+ }
78
+ });
79
+ var defuArrayFn = createDefu((object, key, currentValue) => {
80
+ if (Array.isArray(object[key]) && typeof currentValue === "function") {
81
+ object[key] = currentValue(object[key]);
82
+ return true;
83
+ }
84
+ });
85
+
86
+ // src/antfu.ts
87
+ var antfu_exports = {};
88
+ __reExport(antfu_exports, eslint_config_star);
89
+ import * as eslint_config_star from "@antfu/eslint-config";
59
90
 
91
+ // src/factory.ts
60
92
  function icebreaker(options = {}, ...userConfigs) {
61
93
  const {
62
94
  tailwindcss: enableTailwindcss = isPackageExists("tailwindcss"),
63
95
  mdx: enableMDX,
96
+ a11y: enableA11y,
64
97
  ...opts
65
98
  } = defu(options, {
66
99
  formatters: true
@@ -75,15 +108,25 @@ function icebreaker(options = {}, ...userConfigs) {
75
108
  "vue/attribute-hyphenation": "off",
76
109
  // 问题在于 auto fix 的时候,会直接 remove 整个 import ,而我们想让用户自己去 remove
77
110
  // 'unused-imports/no-unused-imports': 'error',
78
- "no-unused-vars": "warn"
111
+ // https://typescript-eslint.io/rules/no-unused-vars/
112
+ "no-unused-vars": "off",
113
+ "ts/no-unused-vars": ["error", {
114
+ args: "all",
115
+ argsIgnorePattern: "^_",
116
+ caughtErrors: "all",
117
+ caughtErrorsIgnorePattern: "^_",
118
+ destructuredArrayIgnorePattern: "^_",
119
+ varsIgnorePattern: "^_",
120
+ ignoreRestSiblings: true
121
+ }]
79
122
  }
80
123
  }
81
124
  ];
82
125
  if (enableTailwindcss) {
83
126
  presets.push(
84
- interopDefault(
127
+ (0, antfu_exports.interopDefault)(
85
128
  // @ts-ignore
86
- import('eslint-plugin-tailwindcss')
129
+ import("eslint-plugin-tailwindcss")
87
130
  ).then((tailwind) => {
88
131
  return tailwind.configs["flat/recommended"];
89
132
  })
@@ -95,7 +138,7 @@ function icebreaker(options = {}, ...userConfigs) {
95
138
  });
96
139
  }
97
140
  if (enableMDX) {
98
- presets.push(interopDefault(import('eslint-plugin-mdx')).then((mdx) => {
141
+ presets.push((0, antfu_exports.interopDefault)(import("eslint-plugin-mdx")).then((mdx) => {
99
142
  return [
100
143
  {
101
144
  ...mdx.flat,
@@ -113,7 +156,30 @@ function icebreaker(options = {}, ...userConfigs) {
113
156
  ];
114
157
  }));
115
158
  }
116
- return antfu(opts, ...presets, ...userConfigs);
159
+ if (enableA11y) {
160
+ if (opts.vue) {
161
+ presets.push(
162
+ (0, antfu_exports.interopDefault)(
163
+ // @ts-ignore
164
+ import("eslint-plugin-vuejs-accessibility")
165
+ ).then((pluginVueA11y) => {
166
+ return pluginVueA11y.configs["flat/recommended"];
167
+ })
168
+ );
169
+ }
170
+ if (opts.react) {
171
+ presets.push(
172
+ (0, antfu_exports.interopDefault)(
173
+ // @ts-ignore
174
+ import("eslint-plugin-jsx-a11y")
175
+ ).then((jsxA11y) => {
176
+ return jsxA11y.flatConfigs.recommended;
177
+ })
178
+ );
179
+ }
180
+ }
181
+ return (0, antfu_exports.antfu)(opts, ...presets, ...userConfigs);
117
182
  }
118
-
119
- export { icebreaker };
183
+ export {
184
+ icebreaker
185
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/eslint-config",
3
3
  "type": "module",
4
- "version": "0.3.10",
4
+ "version": "0.3.12",
5
5
  "description": "icebreakers's eslint config",
6
6
  "author": "SonOfMagic <qq1324318532@gmail.com>",
7
7
  "license": "MIT",
@@ -13,13 +13,13 @@
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
16
- "import": "./dist/index.mjs",
16
+ "import": "./dist/index.js",
17
17
  "require": "./dist/index.cjs"
18
18
  },
19
19
  "./*": "./*"
20
20
  },
21
21
  "main": "./dist/index.cjs",
22
- "module": "./dist/index.mjs",
22
+ "module": "./dist/index.js",
23
23
  "types": "./dist/index.d.ts",
24
24
  "typesVersions": {
25
25
  "*": {
@@ -35,8 +35,10 @@
35
35
  "dependencies": {
36
36
  "@antfu/eslint-config": "2.21.2",
37
37
  "eslint-plugin-format": "0.1.2",
38
+ "eslint-plugin-jsx-a11y": "^6.9.0",
38
39
  "eslint-plugin-mdx": "3.1.5",
39
40
  "eslint-plugin-tailwindcss": "3.17.4",
41
+ "eslint-plugin-vuejs-accessibility": "^2.3.1",
40
42
  "local-pkg": "0.5.0"
41
43
  },
42
44
  "publishConfig": {
@@ -44,9 +46,8 @@
44
46
  "registry": "https://registry.npmjs.org"
45
47
  },
46
48
  "scripts": {
47
- "dev": "unbuild --sourcemap",
48
- "build": "unbuild",
49
- "build:up": "tsup --format esm,cjs --clean --dts",
49
+ "dev": "tsup --watch --sourcemap",
50
+ "build": "tsup",
50
51
  "test": "vitest run",
51
52
  "test:dev": "vitest",
52
53
  "release": "pnpm publish",
package/dist/index.d.mts DELETED
@@ -1,13 +0,0 @@
1
- import { OptionsConfig, TypedFlatConfigItem, Awaitable, ConfigNames } from '@antfu/eslint-config';
2
- import { FlatConfigComposer } from 'eslint-flat-config-utils';
3
- import { Linter } from 'eslint';
4
-
5
- type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
6
- tailwindcss?: boolean;
7
- mdx?: boolean;
8
- };
9
- type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>;
10
-
11
- declare function icebreaker(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
12
-
13
- export { type UserConfigItem, type UserDefinedOptions, icebreaker };