@icebreakers/eslint-config 0.2.0 → 0.3.0
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 +44 -2
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +31 -2
- package/package.json +7 -13
- package/dist/antfu.cjs +0 -9
- package/dist/antfu.d.cts +0 -1
- package/dist/antfu.d.mts +0 -1
- package/dist/antfu.d.ts +0 -1
- package/dist/antfu.mjs +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3,15 +3,34 @@
|
|
|
3
3
|
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
|
|
4
4
|
const eslintrc = require('@eslint/eslintrc');
|
|
5
5
|
const localPkg = require('local-pkg');
|
|
6
|
+
const mdx = require('eslint-plugin-mdx');
|
|
6
7
|
const eslintConfig = require('@antfu/eslint-config');
|
|
7
8
|
|
|
8
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
9
10
|
|
|
11
|
+
function _interopNamespaceCompat(e) {
|
|
12
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
13
|
+
const n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
for (const k in e) {
|
|
16
|
+
n[k] = e[k];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
|
|
10
23
|
const eslintPluginPrettierRecommended__default = /*#__PURE__*/_interopDefaultCompat(eslintPluginPrettierRecommended);
|
|
24
|
+
const mdx__namespace = /*#__PURE__*/_interopNamespaceCompat(mdx);
|
|
11
25
|
|
|
12
26
|
const compat = new eslintrc.FlatCompat();
|
|
13
27
|
function icebreaker(options = {}, ...userConfigs) {
|
|
14
|
-
const {
|
|
28
|
+
const {
|
|
29
|
+
prettier: enablePrettier,
|
|
30
|
+
tailwindcss: enableTailwindcss = localPkg.isPackageExists("tailwindcss"),
|
|
31
|
+
mdx: enableMDX,
|
|
32
|
+
...opts
|
|
33
|
+
} = options;
|
|
15
34
|
const presets = [
|
|
16
35
|
{
|
|
17
36
|
rules: {
|
|
@@ -22,7 +41,7 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
22
41
|
}
|
|
23
42
|
}
|
|
24
43
|
];
|
|
25
|
-
if (
|
|
44
|
+
if (enablePrettier) {
|
|
26
45
|
presets.push(eslintPluginPrettierRecommended__default);
|
|
27
46
|
}
|
|
28
47
|
if (enableTailwindcss) {
|
|
@@ -30,6 +49,29 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
30
49
|
extends: ["plugin:tailwindcss/recommended"]
|
|
31
50
|
}));
|
|
32
51
|
}
|
|
52
|
+
if (enableMDX) {
|
|
53
|
+
presets.push({
|
|
54
|
+
...mdx__namespace.flat,
|
|
55
|
+
// optional, if you want to lint code blocks at the same
|
|
56
|
+
processor: mdx__namespace.createRemarkProcessor({
|
|
57
|
+
lintCodeBlocks: true,
|
|
58
|
+
// optional, if you want to disable language mapper, set it to `false`
|
|
59
|
+
// if you want to override the default language mapper inside, you can provide your own
|
|
60
|
+
languageMapper: {}
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
presets.push(
|
|
64
|
+
{
|
|
65
|
+
...mdx__namespace.flatCodeBlocks,
|
|
66
|
+
rules: {
|
|
67
|
+
...mdx__namespace.flatCodeBlocks.rules
|
|
68
|
+
// if you want to override some rules for code blocks
|
|
69
|
+
// 'no-var': 'error',
|
|
70
|
+
// 'prefer-const': 'error',
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
33
75
|
return eslintConfig.antfu(opts, ...presets, ...userConfigs);
|
|
34
76
|
}
|
|
35
77
|
|
package/dist/index.d.cts
CHANGED
|
@@ -5,6 +5,7 @@ import { Linter } from 'eslint';
|
|
|
5
5
|
type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
|
|
6
6
|
prettier?: boolean;
|
|
7
7
|
tailwindcss?: boolean;
|
|
8
|
+
mdx?: boolean;
|
|
8
9
|
};
|
|
9
10
|
type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>;
|
|
10
11
|
|
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ import { Linter } from 'eslint';
|
|
|
5
5
|
type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
|
|
6
6
|
prettier?: boolean;
|
|
7
7
|
tailwindcss?: boolean;
|
|
8
|
+
mdx?: 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
|
prettier?: boolean;
|
|
7
7
|
tailwindcss?: boolean;
|
|
8
|
+
mdx?: boolean;
|
|
8
9
|
};
|
|
9
10
|
type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>;
|
|
10
11
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
2
2
|
import { FlatCompat } from '@eslint/eslintrc';
|
|
3
3
|
import { isPackageExists } from 'local-pkg';
|
|
4
|
+
import * as mdx from 'eslint-plugin-mdx';
|
|
4
5
|
import { antfu } from '@antfu/eslint-config';
|
|
5
6
|
|
|
6
7
|
const compat = new FlatCompat();
|
|
7
8
|
function icebreaker(options = {}, ...userConfigs) {
|
|
8
|
-
const {
|
|
9
|
+
const {
|
|
10
|
+
prettier: enablePrettier,
|
|
11
|
+
tailwindcss: enableTailwindcss = isPackageExists("tailwindcss"),
|
|
12
|
+
mdx: enableMDX,
|
|
13
|
+
...opts
|
|
14
|
+
} = options;
|
|
9
15
|
const presets = [
|
|
10
16
|
{
|
|
11
17
|
rules: {
|
|
@@ -16,7 +22,7 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
24
|
];
|
|
19
|
-
if (
|
|
25
|
+
if (enablePrettier) {
|
|
20
26
|
presets.push(eslintPluginPrettierRecommended);
|
|
21
27
|
}
|
|
22
28
|
if (enableTailwindcss) {
|
|
@@ -24,6 +30,29 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
24
30
|
extends: ["plugin:tailwindcss/recommended"]
|
|
25
31
|
}));
|
|
26
32
|
}
|
|
33
|
+
if (enableMDX) {
|
|
34
|
+
presets.push({
|
|
35
|
+
...mdx.flat,
|
|
36
|
+
// optional, if you want to lint code blocks at the same
|
|
37
|
+
processor: mdx.createRemarkProcessor({
|
|
38
|
+
lintCodeBlocks: true,
|
|
39
|
+
// optional, if you want to disable language mapper, set it to `false`
|
|
40
|
+
// if you want to override the default language mapper inside, you can provide your own
|
|
41
|
+
languageMapper: {}
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
presets.push(
|
|
45
|
+
{
|
|
46
|
+
...mdx.flatCodeBlocks,
|
|
47
|
+
rules: {
|
|
48
|
+
...mdx.flatCodeBlocks.rules
|
|
49
|
+
// if you want to override some rules for code blocks
|
|
50
|
+
// 'no-var': 'error',
|
|
51
|
+
// 'prefer-const': 'error',
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
27
56
|
return antfu(opts, ...presets, ...userConfigs);
|
|
28
57
|
}
|
|
29
58
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "icebreakers's eslint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config",
|
|
7
|
-
"prettier"
|
|
7
|
+
"prettier",
|
|
8
|
+
"icebreaker"
|
|
8
9
|
],
|
|
9
10
|
"author": "",
|
|
10
11
|
"license": "MIT",
|
|
@@ -15,11 +16,6 @@
|
|
|
15
16
|
"import": "./dist/index.mjs",
|
|
16
17
|
"require": "./dist/index.cjs"
|
|
17
18
|
},
|
|
18
|
-
"./antfu": {
|
|
19
|
-
"types": "./dist/antfu.d.ts",
|
|
20
|
-
"import": "./dist/antfu.mjs",
|
|
21
|
-
"require": "./dist/antfu.cjs"
|
|
22
|
-
},
|
|
23
19
|
"./*": "./*"
|
|
24
20
|
},
|
|
25
21
|
"main": "./dist/index.cjs",
|
|
@@ -37,16 +33,14 @@
|
|
|
37
33
|
}
|
|
38
34
|
},
|
|
39
35
|
"dependencies": {
|
|
40
|
-
"@antfu/eslint-config": "2.18.
|
|
41
|
-
"@eslint/eslintrc": "^3.0
|
|
36
|
+
"@antfu/eslint-config": "2.18.1",
|
|
37
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
42
38
|
"eslint-config-prettier": "^9.1.0",
|
|
39
|
+
"eslint-plugin-mdx": "^3.1.5",
|
|
43
40
|
"eslint-plugin-prettier": "^5.1.3",
|
|
44
|
-
"eslint-plugin-tailwindcss": "^3.15.
|
|
41
|
+
"eslint-plugin-tailwindcss": "^3.15.2",
|
|
45
42
|
"local-pkg": "^0.5.0"
|
|
46
43
|
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"eslint": "^9.2.0"
|
|
49
|
-
},
|
|
50
44
|
"scripts": {
|
|
51
45
|
"dev": "unbuild --sourcemap",
|
|
52
46
|
"build": "unbuild",
|
package/dist/antfu.cjs
DELETED
package/dist/antfu.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@antfu/eslint-config';
|
package/dist/antfu.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@antfu/eslint-config';
|
package/dist/antfu.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@antfu/eslint-config';
|
package/dist/antfu.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@antfu/eslint-config';
|