@icebreakers/eslint-config 0.3.9 → 0.3.11
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/README.md +2 -14
- package/dist/index.cjs +92 -13
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/{index.mjs → index.js} +69 -11
- package/package.json +8 -7
- package/dist/index.d.mts +0 -13
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @icebreakers/eslint-config
|
|
2
2
|
|
|
3
|
-
> extend [@antfu/eslint-config](https://www.npmjs.com/package/@antfu/eslint-config) and add `prettier` support!
|
|
3
|
+
> extend [@antfu/eslint-config](https://www.npmjs.com/package/@antfu/eslint-config) and add `tailwindcss` , `mdx` , and `prettier` format support!
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -15,20 +15,8 @@ import { icebreaker } from '@icebreakers/eslint-config'
|
|
|
15
15
|
export default icebreaker()
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
or use with `prettier`:
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
// eslint.config.mjs
|
|
22
|
-
import { icebreaker } from '@icebreakers/eslint-config'
|
|
23
|
-
|
|
24
|
-
export default icebreaker({
|
|
25
|
-
prettier: true,
|
|
26
|
-
stylistic: false,
|
|
27
|
-
})
|
|
28
|
-
```
|
|
29
|
-
|
|
30
18
|
## VS Code support
|
|
31
19
|
|
|
32
20
|
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
33
21
|
|
|
34
|
-
Version: `^3.0.
|
|
22
|
+
Version: `^3.0.10` ( >=`3.0.10`)
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,44 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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 =
|
|
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,17 @@ 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
|
-
|
|
133
|
+
// https://typescript-eslint.io/rules/no-unused-vars/
|
|
134
|
+
"no-unused-vars": "off",
|
|
135
|
+
"ts/no-unused-vars": "error"
|
|
81
136
|
}
|
|
82
137
|
}
|
|
83
138
|
];
|
|
84
139
|
if (enableTailwindcss) {
|
|
85
140
|
presets.push(
|
|
86
|
-
|
|
141
|
+
(0, antfu_exports.interopDefault)(
|
|
87
142
|
// @ts-ignore
|
|
88
|
-
import(
|
|
143
|
+
import("eslint-plugin-tailwindcss")
|
|
89
144
|
).then((tailwind) => {
|
|
90
145
|
return tailwind.configs["flat/recommended"];
|
|
91
146
|
})
|
|
@@ -97,7 +152,7 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
97
152
|
});
|
|
98
153
|
}
|
|
99
154
|
if (enableMDX) {
|
|
100
|
-
presets.push(
|
|
155
|
+
presets.push((0, antfu_exports.interopDefault)(import("eslint-plugin-mdx")).then((mdx) => {
|
|
101
156
|
return [
|
|
102
157
|
{
|
|
103
158
|
...mdx.flat,
|
|
@@ -115,7 +170,31 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
115
170
|
];
|
|
116
171
|
}));
|
|
117
172
|
}
|
|
118
|
-
|
|
173
|
+
if (enableA11y) {
|
|
174
|
+
if (opts.vue) {
|
|
175
|
+
presets.push(
|
|
176
|
+
(0, antfu_exports.interopDefault)(
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
import("eslint-plugin-vuejs-accessibility")
|
|
179
|
+
).then((pluginVueA11y) => {
|
|
180
|
+
return pluginVueA11y.configs["flat/recommended"];
|
|
181
|
+
})
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
if (opts.react) {
|
|
185
|
+
presets.push(
|
|
186
|
+
(0, antfu_exports.interopDefault)(
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
import("eslint-plugin-jsx-a11y")
|
|
189
|
+
).then((jsxA11y) => {
|
|
190
|
+
return jsxA11y.flatConfigs.recommended;
|
|
191
|
+
})
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return (0, antfu_exports.antfu)(opts, ...presets, ...userConfigs);
|
|
119
196
|
}
|
|
120
|
-
|
|
121
|
-
exports
|
|
197
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
198
|
+
0 && (module.exports = {
|
|
199
|
+
icebreaker
|
|
200
|
+
});
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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,17 @@ 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
|
-
|
|
111
|
+
// https://typescript-eslint.io/rules/no-unused-vars/
|
|
112
|
+
"no-unused-vars": "off",
|
|
113
|
+
"ts/no-unused-vars": "error"
|
|
79
114
|
}
|
|
80
115
|
}
|
|
81
116
|
];
|
|
82
117
|
if (enableTailwindcss) {
|
|
83
118
|
presets.push(
|
|
84
|
-
interopDefault(
|
|
119
|
+
(0, antfu_exports.interopDefault)(
|
|
85
120
|
// @ts-ignore
|
|
86
|
-
import(
|
|
121
|
+
import("eslint-plugin-tailwindcss")
|
|
87
122
|
).then((tailwind) => {
|
|
88
123
|
return tailwind.configs["flat/recommended"];
|
|
89
124
|
})
|
|
@@ -95,7 +130,7 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
95
130
|
});
|
|
96
131
|
}
|
|
97
132
|
if (enableMDX) {
|
|
98
|
-
presets.push(interopDefault(import(
|
|
133
|
+
presets.push((0, antfu_exports.interopDefault)(import("eslint-plugin-mdx")).then((mdx) => {
|
|
99
134
|
return [
|
|
100
135
|
{
|
|
101
136
|
...mdx.flat,
|
|
@@ -113,7 +148,30 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
113
148
|
];
|
|
114
149
|
}));
|
|
115
150
|
}
|
|
116
|
-
|
|
151
|
+
if (enableA11y) {
|
|
152
|
+
if (opts.vue) {
|
|
153
|
+
presets.push(
|
|
154
|
+
(0, antfu_exports.interopDefault)(
|
|
155
|
+
// @ts-ignore
|
|
156
|
+
import("eslint-plugin-vuejs-accessibility")
|
|
157
|
+
).then((pluginVueA11y) => {
|
|
158
|
+
return pluginVueA11y.configs["flat/recommended"];
|
|
159
|
+
})
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
if (opts.react) {
|
|
163
|
+
presets.push(
|
|
164
|
+
(0, antfu_exports.interopDefault)(
|
|
165
|
+
// @ts-ignore
|
|
166
|
+
import("eslint-plugin-jsx-a11y")
|
|
167
|
+
).then((jsxA11y) => {
|
|
168
|
+
return jsxA11y.flatConfigs.recommended;
|
|
169
|
+
})
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return (0, antfu_exports.antfu)(opts, ...presets, ...userConfigs);
|
|
117
174
|
}
|
|
118
|
-
|
|
119
|
-
|
|
175
|
+
export {
|
|
176
|
+
icebreaker
|
|
177
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.11",
|
|
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.
|
|
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.
|
|
22
|
+
"module": "./dist/index.js",
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
24
|
"typesVersions": {
|
|
25
25
|
"*": {
|
|
@@ -33,10 +33,12 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@antfu/eslint-config": "2.21.
|
|
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": "
|
|
48
|
-
"build": "
|
|
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 };
|