@icebreakers/eslint-config 0.3.0 → 0.3.2

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,29 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
4
- const eslintrc = require('@eslint/eslintrc');
5
4
  const localPkg = require('local-pkg');
6
- const mdx = require('eslint-plugin-mdx');
5
+ const tailwind = require('eslint-plugin-tailwindcss');
7
6
  const eslintConfig = require('@antfu/eslint-config');
8
7
 
9
8
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
10
9
 
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
-
23
10
  const eslintPluginPrettierRecommended__default = /*#__PURE__*/_interopDefaultCompat(eslintPluginPrettierRecommended);
24
- const mdx__namespace = /*#__PURE__*/_interopNamespaceCompat(mdx);
11
+ const tailwind__default = /*#__PURE__*/_interopDefaultCompat(tailwind);
25
12
 
26
- const compat = new eslintrc.FlatCompat();
27
13
  function icebreaker(options = {}, ...userConfigs) {
28
14
  const {
29
15
  prettier: enablePrettier,
@@ -45,32 +31,26 @@ function icebreaker(options = {}, ...userConfigs) {
45
31
  presets.push(eslintPluginPrettierRecommended__default);
46
32
  }
47
33
  if (enableTailwindcss) {
48
- presets.push(...compat.config({
49
- extends: ["plugin:tailwindcss/recommended"]
50
- }));
34
+ presets.push(...tailwind__default.configs["flat/recommended"]);
51
35
  }
52
36
  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',
37
+ presets.push(eslintConfig.interopDefault(import('eslint-plugin-mdx')).then((mdx) => {
38
+ return [
39
+ {
40
+ ...mdx.flat,
41
+ processor: mdx.createRemarkProcessor({
42
+ lintCodeBlocks: true,
43
+ languageMapper: {}
44
+ })
45
+ },
46
+ {
47
+ ...mdx.flatCodeBlocks,
48
+ rules: {
49
+ ...mdx.flatCodeBlocks.rules
50
+ }
71
51
  }
72
- }
73
- );
52
+ ];
53
+ }));
74
54
  }
75
55
  return eslintConfig.antfu(opts, ...presets, ...userConfigs);
76
56
  }
package/dist/index.mjs CHANGED
@@ -1,10 +1,8 @@
1
1
  import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
2
- import { FlatCompat } from '@eslint/eslintrc';
3
2
  import { isPackageExists } from 'local-pkg';
4
- import * as mdx from 'eslint-plugin-mdx';
5
- import { antfu } from '@antfu/eslint-config';
3
+ import tailwind from 'eslint-plugin-tailwindcss';
4
+ import { interopDefault, antfu } from '@antfu/eslint-config';
6
5
 
7
- const compat = new FlatCompat();
8
6
  function icebreaker(options = {}, ...userConfigs) {
9
7
  const {
10
8
  prettier: enablePrettier,
@@ -26,32 +24,26 @@ function icebreaker(options = {}, ...userConfigs) {
26
24
  presets.push(eslintPluginPrettierRecommended);
27
25
  }
28
26
  if (enableTailwindcss) {
29
- presets.push(...compat.config({
30
- extends: ["plugin:tailwindcss/recommended"]
31
- }));
27
+ presets.push(...tailwind.configs["flat/recommended"]);
32
28
  }
33
29
  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',
30
+ presets.push(interopDefault(import('eslint-plugin-mdx')).then((mdx) => {
31
+ return [
32
+ {
33
+ ...mdx.flat,
34
+ processor: mdx.createRemarkProcessor({
35
+ lintCodeBlocks: true,
36
+ languageMapper: {}
37
+ })
38
+ },
39
+ {
40
+ ...mdx.flatCodeBlocks,
41
+ rules: {
42
+ ...mdx.flatCodeBlocks.rules
43
+ }
52
44
  }
53
- }
54
- );
45
+ ];
46
+ }));
55
47
  }
56
48
  return antfu(opts, ...presets, ...userConfigs);
57
49
  }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@icebreakers/eslint-config",
3
- "version": "0.3.0",
3
+ "type": "module",
4
+ "version": "0.3.2",
4
5
  "description": "icebreakers's eslint config",
6
+ "author": "SonOfMagic <qq1324318532@gmail.com>",
7
+ "license": "MIT",
5
8
  "keywords": [
6
9
  "eslint-config",
7
10
  "prettier",
8
11
  "icebreaker"
9
12
  ],
10
- "author": "",
11
- "license": "MIT",
12
- "type": "module",
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
@@ -21,9 +21,6 @@
21
21
  "main": "./dist/index.cjs",
22
22
  "module": "./dist/index.mjs",
23
23
  "types": "./dist/index.d.ts",
24
- "files": [
25
- "dist"
26
- ],
27
24
  "typesVersions": {
28
25
  "*": {
29
26
  "*": [
@@ -32,15 +29,21 @@
32
29
  ]
33
30
  }
34
31
  },
32
+ "files": [
33
+ "dist"
34
+ ],
35
35
  "dependencies": {
36
36
  "@antfu/eslint-config": "2.18.1",
37
- "@eslint/eslintrc": "^3.1.0",
38
37
  "eslint-config-prettier": "^9.1.0",
39
38
  "eslint-plugin-mdx": "^3.1.5",
40
39
  "eslint-plugin-prettier": "^5.1.3",
41
- "eslint-plugin-tailwindcss": "^3.15.2",
40
+ "eslint-plugin-tailwindcss": "^3.16.0",
42
41
  "local-pkg": "^0.5.0"
43
42
  },
43
+ "publishConfig": {
44
+ "access": "public",
45
+ "registry": "https://registry.npmjs.org"
46
+ },
44
47
  "scripts": {
45
48
  "dev": "unbuild --sourcemap",
46
49
  "build": "unbuild",