@icebreakers/eslint-config 0.2.0 → 0.3.1

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
@@ -11,7 +11,12 @@ const eslintPluginPrettierRecommended__default = /*#__PURE__*/_interopDefaultCom
11
11
 
12
12
  const compat = new eslintrc.FlatCompat();
13
13
  function icebreaker(options = {}, ...userConfigs) {
14
- const { prettier, tailwindcss: enableTailwindcss = localPkg.isPackageExists("tailwindcss"), ...opts } = options;
14
+ const {
15
+ prettier: enablePrettier,
16
+ tailwindcss: enableTailwindcss = localPkg.isPackageExists("tailwindcss"),
17
+ mdx: enableMDX,
18
+ ...opts
19
+ } = options;
15
20
  const presets = [
16
21
  {
17
22
  rules: {
@@ -22,7 +27,7 @@ function icebreaker(options = {}, ...userConfigs) {
22
27
  }
23
28
  }
24
29
  ];
25
- if (options?.prettier) {
30
+ if (enablePrettier) {
26
31
  presets.push(eslintPluginPrettierRecommended__default);
27
32
  }
28
33
  if (enableTailwindcss) {
@@ -30,6 +35,31 @@ function icebreaker(options = {}, ...userConfigs) {
30
35
  extends: ["plugin:tailwindcss/recommended"]
31
36
  }));
32
37
  }
38
+ if (enableMDX) {
39
+ presets.push(eslintConfig.interopDefault(import('eslint-plugin-mdx')).then((mdx) => {
40
+ return [
41
+ {
42
+ ...mdx.flat,
43
+ // optional, if you want to lint code blocks at the same
44
+ processor: mdx.createRemarkProcessor({
45
+ lintCodeBlocks: true,
46
+ // optional, if you want to disable language mapper, set it to `false`
47
+ // if you want to override the default language mapper inside, you can provide your own
48
+ languageMapper: {}
49
+ })
50
+ },
51
+ {
52
+ ...mdx.flatCodeBlocks,
53
+ rules: {
54
+ ...mdx.flatCodeBlocks.rules
55
+ // if you want to override some rules for code blocks
56
+ // 'no-var': 'error',
57
+ // 'prefer-const': 'error',
58
+ }
59
+ }
60
+ ];
61
+ }));
62
+ }
33
63
  return eslintConfig.antfu(opts, ...presets, ...userConfigs);
34
64
  }
35
65
 
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,16 @@
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 { antfu } from '@antfu/eslint-config';
4
+ import { interopDefault, antfu } from '@antfu/eslint-config';
5
5
 
6
6
  const compat = new FlatCompat();
7
7
  function icebreaker(options = {}, ...userConfigs) {
8
- const { prettier, tailwindcss: enableTailwindcss = isPackageExists("tailwindcss"), ...opts } = options;
8
+ const {
9
+ prettier: enablePrettier,
10
+ tailwindcss: enableTailwindcss = isPackageExists("tailwindcss"),
11
+ mdx: enableMDX,
12
+ ...opts
13
+ } = options;
9
14
  const presets = [
10
15
  {
11
16
  rules: {
@@ -16,7 +21,7 @@ function icebreaker(options = {}, ...userConfigs) {
16
21
  }
17
22
  }
18
23
  ];
19
- if (options?.prettier) {
24
+ if (enablePrettier) {
20
25
  presets.push(eslintPluginPrettierRecommended);
21
26
  }
22
27
  if (enableTailwindcss) {
@@ -24,6 +29,31 @@ function icebreaker(options = {}, ...userConfigs) {
24
29
  extends: ["plugin:tailwindcss/recommended"]
25
30
  }));
26
31
  }
32
+ if (enableMDX) {
33
+ presets.push(interopDefault(import('eslint-plugin-mdx')).then((mdx) => {
34
+ return [
35
+ {
36
+ ...mdx.flat,
37
+ // optional, if you want to lint code blocks at the same
38
+ processor: mdx.createRemarkProcessor({
39
+ lintCodeBlocks: true,
40
+ // optional, if you want to disable language mapper, set it to `false`
41
+ // if you want to override the default language mapper inside, you can provide your own
42
+ languageMapper: {}
43
+ })
44
+ },
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
+ }));
56
+ }
27
57
  return antfu(opts, ...presets, ...userConfigs);
28
58
  }
29
59
 
package/package.json CHANGED
@@ -1,33 +1,26 @@
1
1
  {
2
2
  "name": "@icebreakers/eslint-config",
3
- "version": "0.2.0",
3
+ "type": "module",
4
+ "version": "0.3.1",
4
5
  "description": "icebreakers's eslint config",
6
+ "author": "",
7
+ "license": "MIT",
5
8
  "keywords": [
6
9
  "eslint-config",
7
- "prettier"
10
+ "prettier",
11
+ "icebreaker"
8
12
  ],
9
- "author": "",
10
- "license": "MIT",
11
- "type": "module",
12
13
  "exports": {
13
14
  ".": {
14
15
  "types": "./dist/index.d.ts",
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",
26
22
  "module": "./dist/index.mjs",
27
23
  "types": "./dist/index.d.ts",
28
- "files": [
29
- "dist"
30
- ],
31
24
  "typesVersions": {
32
25
  "*": {
33
26
  "*": [
@@ -36,16 +29,21 @@
36
29
  ]
37
30
  }
38
31
  },
32
+ "files": [
33
+ "dist"
34
+ ],
39
35
  "dependencies": {
40
- "@antfu/eslint-config": "2.18.0",
41
- "@eslint/eslintrc": "^3.0.2",
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.1",
41
+ "eslint-plugin-tailwindcss": "^3.15.2",
45
42
  "local-pkg": "^0.5.0"
46
43
  },
47
- "devDependencies": {
48
- "eslint": "^9.2.0"
44
+ "publishConfig": {
45
+ "access": "public",
46
+ "registry": "https://registry.npmjs.org"
49
47
  },
50
48
  "scripts": {
51
49
  "dev": "unbuild --sourcemap",
package/dist/antfu.cjs DELETED
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- const eslintConfig = require('@antfu/eslint-config');
4
-
5
-
6
-
7
- Object.keys(eslintConfig).forEach(function (k) {
8
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = eslintConfig[k];
9
- });
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';