@pengzhanbo/eslint-config-react 1.0.0 → 1.2.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/README.md CHANGED
@@ -20,3 +20,13 @@ import eslintConfig from '@pengzhanbo/eslint-config-react'
20
20
 
21
21
  export default eslintConfig()
22
22
  ```
23
+
24
+ ## 相关资源
25
+ - [@pengzhanbo/eslint-config](https://github.com/pengzhanbo/configs/tree/main/packages/eslint-config)
26
+ - [@pengzhanbo/eslint-config-vue](https://github.com/pengzhanbo/configs/tree/main/packages/eslint-config-vue)
27
+ - [@pengzhanbo/eslint-config-react](https://github.com/pengzhanbo/configs/tree/main/packages/eslint-config-react)
28
+ - [@pengzhanbo/eslint-config-svelte](https://github.com/pengzhanbo/configs/tree/main/packages/eslint-config-svelte)
29
+ - [@pengzhanbo/eslint-config-solid](https://github.com/pengzhanbo/configs/tree/main/packages/eslint-config-solid)
30
+ - [@pengzhanbo/eslint-config-astro](https://github.com/pengzhanbo/configs/tree/main/packages/eslint-config-astro)
31
+ - [@pengzhanbo/prettier-config](https://github.com/pengzhanbo/configs/tree/main/packages/prettier-config)
32
+ - [@pengzhanbo/stylelint-config](https://github.com/pengzhanbo/configs/tree/main/packages/stylelint-config)
package/dist/index.cjs CHANGED
@@ -32,13 +32,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
32
32
  var src_exports = {};
33
33
  __export(src_exports, {
34
34
  default: () => src_default,
35
+ next: () => next,
36
+ nextPreset: () => nextPreset,
35
37
  react: () => react,
36
38
  reactPreset: () => reactPreset
37
39
  });
38
40
  module.exports = __toCommonJS(src_exports);
39
41
 
40
42
  // src/factory.ts
41
- var import_eslint_config2 = require("@pengzhanbo/eslint-config");
43
+ var import_eslint_config3 = require("@pengzhanbo/eslint-config");
42
44
 
43
45
  // src/react.ts
44
46
  var import_local_pkg = require("local-pkg");
@@ -71,6 +73,11 @@ async function react(options = {}) {
71
73
  "react": pluginReact,
72
74
  "react-hooks": pluginReactHooks,
73
75
  "react-refresh": pluginReactRefresh
76
+ },
77
+ settings: {
78
+ react: {
79
+ version: "detect"
80
+ }
74
81
  }
75
82
  },
76
83
  {
@@ -126,6 +133,38 @@ async function react(options = {}) {
126
133
  ];
127
134
  }
128
135
 
136
+ // src/next.ts
137
+ var import_eslint_config2 = require("@pengzhanbo/eslint-config");
138
+ var import_local_pkg2 = require("local-pkg");
139
+ async function next(options = {}) {
140
+ if (!(0, import_local_pkg2.isPackageExists)("next"))
141
+ return [];
142
+ const { overrides = {} } = options;
143
+ const nextPlugin = await (0, import_eslint_config2.interopDefault)(import("@next/eslint-plugin-next"));
144
+ return [
145
+ {
146
+ name: "config:next:setup",
147
+ plugins: {
148
+ "@next/next": nextPlugin
149
+ }
150
+ },
151
+ {
152
+ name: "config:next:rules",
153
+ rules: {
154
+ ...nextPlugin.configs.recommended.rules,
155
+ ...nextPlugin.configs["core-web-vitals"].rules,
156
+ "import/no-anonymous-default-export": "warn",
157
+ "react/no-unknown-property": "off",
158
+ "react/react-in-jsx-scope": "off",
159
+ "react/prop-types": "off",
160
+ "react/jsx-no-target-blank": "off",
161
+ "react-refresh/only-export-components": "off",
162
+ ...overrides
163
+ }
164
+ }
165
+ ];
166
+ }
167
+
129
168
  // src/preset.ts
130
169
  var reactPreset = (options) => {
131
170
  return [react({
@@ -133,15 +172,22 @@ var reactPreset = (options) => {
133
172
  typescript: !!options.typescript
134
173
  })];
135
174
  };
175
+ var nextPreset = (options) => {
176
+ return [next({
177
+ overrides: options.overrides.nextjs
178
+ })];
179
+ };
136
180
 
137
181
  // src/factory.ts
138
- var eslintReactConfig = (0, import_eslint_config2.createConfig)(reactPreset);
182
+ var eslintReactConfig = (0, import_eslint_config3.createConfig)([reactPreset, nextPreset]);
139
183
 
140
184
  // src/index.ts
141
185
  __reExport(src_exports, require("@pengzhanbo/eslint-config"), module.exports);
142
186
  var src_default = eslintReactConfig;
143
187
  // Annotate the CommonJS export names for ESM import in node:
144
188
  0 && (module.exports = {
189
+ next,
190
+ nextPreset,
145
191
  react,
146
192
  reactPreset,
147
193
  ...require("@pengzhanbo/eslint-config")
package/dist/index.d.cts CHANGED
@@ -6,6 +6,9 @@ declare const eslintReactConfig: typeof _pengzhanbo_eslint_config.default;
6
6
 
7
7
  declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
8
8
 
9
+ declare function next(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
10
+
9
11
  declare const reactPreset: PresetItem;
12
+ declare const nextPreset: PresetItem;
10
13
 
11
- export { eslintReactConfig as default, react, reactPreset };
14
+ export { eslintReactConfig as default, next, nextPreset, react, reactPreset };
package/dist/index.d.ts CHANGED
@@ -6,6 +6,9 @@ declare const eslintReactConfig: typeof _pengzhanbo_eslint_config.default;
6
6
 
7
7
  declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
8
8
 
9
+ declare function next(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
10
+
9
11
  declare const reactPreset: PresetItem;
12
+ declare const nextPreset: PresetItem;
10
13
 
11
- export { eslintReactConfig as default, react, reactPreset };
14
+ export { eslintReactConfig as default, next, nextPreset, react, reactPreset };
package/dist/index.js CHANGED
@@ -32,6 +32,11 @@ async function react(options = {}) {
32
32
  "react": pluginReact,
33
33
  "react-hooks": pluginReactHooks,
34
34
  "react-refresh": pluginReactRefresh
35
+ },
36
+ settings: {
37
+ react: {
38
+ version: "detect"
39
+ }
35
40
  }
36
41
  },
37
42
  {
@@ -87,6 +92,38 @@ async function react(options = {}) {
87
92
  ];
88
93
  }
89
94
 
95
+ // src/next.ts
96
+ import { interopDefault as interopDefault2 } from "@pengzhanbo/eslint-config";
97
+ import { isPackageExists as isPackageExists2 } from "local-pkg";
98
+ async function next(options = {}) {
99
+ if (!isPackageExists2("next"))
100
+ return [];
101
+ const { overrides = {} } = options;
102
+ const nextPlugin = await interopDefault2(import("@next/eslint-plugin-next"));
103
+ return [
104
+ {
105
+ name: "config:next:setup",
106
+ plugins: {
107
+ "@next/next": nextPlugin
108
+ }
109
+ },
110
+ {
111
+ name: "config:next:rules",
112
+ rules: {
113
+ ...nextPlugin.configs.recommended.rules,
114
+ ...nextPlugin.configs["core-web-vitals"].rules,
115
+ "import/no-anonymous-default-export": "warn",
116
+ "react/no-unknown-property": "off",
117
+ "react/react-in-jsx-scope": "off",
118
+ "react/prop-types": "off",
119
+ "react/jsx-no-target-blank": "off",
120
+ "react-refresh/only-export-components": "off",
121
+ ...overrides
122
+ }
123
+ }
124
+ ];
125
+ }
126
+
90
127
  // src/preset.ts
91
128
  var reactPreset = (options) => {
92
129
  return [react({
@@ -94,15 +131,22 @@ var reactPreset = (options) => {
94
131
  typescript: !!options.typescript
95
132
  })];
96
133
  };
134
+ var nextPreset = (options) => {
135
+ return [next({
136
+ overrides: options.overrides.nextjs
137
+ })];
138
+ };
97
139
 
98
140
  // src/factory.ts
99
- var eslintReactConfig = createConfig(reactPreset);
141
+ var eslintReactConfig = createConfig([reactPreset, nextPreset]);
100
142
 
101
143
  // src/index.ts
102
144
  export * from "@pengzhanbo/eslint-config";
103
145
  var src_default = eslintReactConfig;
104
146
  export {
105
147
  src_default as default,
148
+ next,
149
+ nextPreset,
106
150
  react,
107
151
  reactPreset
108
152
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pengzhanbo/eslint-config-react",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.2.0",
5
5
  "author": "pengzhanbo <q942450674@outlook.com> (https://github/pengzhanbo/)",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/pengzhanbo/configs#readme",
@@ -36,11 +36,12 @@
36
36
  "eslint": ">=8.40.0"
37
37
  },
38
38
  "dependencies": {
39
+ "@next/eslint-plugin-next": "^14.0.3",
39
40
  "eslint-plugin-react": "^7.33.2",
40
41
  "eslint-plugin-react-hooks": "^4.6.0",
41
42
  "eslint-plugin-react-refresh": "^0.4.4",
42
43
  "local-pkg": "^0.5.0",
43
- "@pengzhanbo/eslint-config": "1.0.0"
44
+ "@pengzhanbo/eslint-config": "1.2.0"
44
45
  },
45
46
  "devDependencies": {
46
47
  "eslint": "^8.54.0",