@wongxy/eslint-config 0.0.12 → 0.0.14

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 ADDED
@@ -0,0 +1,13 @@
1
+ # eslint-config
2
+
3
+ Personal ESLint configuration, based on `@antfu/eslint-config`
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npm i eslint @wongxy/eslint-config -D
9
+ ```
10
+
11
+ ```bash
12
+ npx wongxy-eslint-config
13
+ ```
package/dist/cli.cjs CHANGED
@@ -46,15 +46,23 @@ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
46
46
  var import_picocolors = __toESM(require("picocolors"), 1);
47
47
 
48
48
  // package.json
49
- var version = "0.0.12";
49
+ var version = "0.0.14";
50
50
  var devDependencies = {
51
- "@types/eslint": "^8.44.7",
51
+ "@antfu/eslint-config": "^2.6.4",
52
+ "@types/eslint": "^8.56.3",
52
53
  "@types/prompts": "^2.4.9",
53
54
  "@types/yargs": "^17.0.32",
54
- bumpp: "9.2.0",
55
- eslint: "8.54.0",
56
- tsup: "8.0.1",
57
- typescript: "5.2.2"
55
+ bumpp: "^9.3.0",
56
+ eslint: "^8.57.0",
57
+ "eslint-plugin-react": "^7.33.2",
58
+ "eslint-plugin-react-hooks": "^4.6.0",
59
+ "eslint-plugin-react-refresh": "^0.4.5",
60
+ "parse-gitignore": "^2.0.0",
61
+ picocolors: "^1.0.0",
62
+ prompts: "^2.4.2",
63
+ tsup: "^8.0.2",
64
+ typescript: "5.2.2",
65
+ yargs: "^17.7.2"
58
66
  };
59
67
 
60
68
  // src/cli/constants.ts
@@ -162,8 +170,55 @@ async function run(options = {}) {
162
170
  eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
163
171
  }
164
172
  }
173
+ const configs = [];
174
+ if (eslintIgnores.length)
175
+ configs.push(` ignores: ${JSON.stringify(eslintIgnores)},`);
176
+ if (!SKIP_PROMPT) {
177
+ let enableReactNativeRulesPrompt = {
178
+ enableReactNativeRules: false
179
+ };
180
+ try {
181
+ enableReactNativeRulesPrompt = await (0, import_prompts.default)({
182
+ initial: false,
183
+ message: "Enable React Native rules?",
184
+ name: "enableReactNativeRules",
185
+ type: "confirm"
186
+ }, {
187
+ onCancel: () => {
188
+ throw new Error(`Cancelled`);
189
+ }
190
+ });
191
+ } catch (cancelled) {
192
+ console.log(cancelled.message);
193
+ return;
194
+ }
195
+ if (enableReactNativeRulesPrompt.enableReactNativeRules)
196
+ configs.push(` reactnative: true,`);
197
+ if (!enableReactNativeRulesPrompt.enableReactNativeRules) {
198
+ let enableReactRulesPrompt = {
199
+ enableReactRules: false
200
+ };
201
+ try {
202
+ enableReactRulesPrompt = await (0, import_prompts.default)({
203
+ initial: false,
204
+ message: "Enable React rules?",
205
+ name: "enableReactRules",
206
+ type: "confirm"
207
+ }, {
208
+ onCancel: () => {
209
+ throw new Error(`Cancelled`);
210
+ }
211
+ });
212
+ } catch (cancelled) {
213
+ console.log(cancelled.message);
214
+ return;
215
+ }
216
+ if (enableReactRulesPrompt.enableReactRules)
217
+ configs.push(` react: true,`);
218
+ }
219
+ }
220
+ const wongxyConfig = configs.join("\n");
165
221
  let eslintConfigContent = "";
166
- const wongxyConfig = `${eslintIgnores.length ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
167
222
  if (pkg.type === "module") {
168
223
  eslintConfigContent = `
169
224
  import wongxy from '@wongxy/eslint-config'
package/dist/cli.js CHANGED
@@ -17,15 +17,23 @@ import parse from "parse-gitignore";
17
17
  import c from "picocolors";
18
18
 
19
19
  // package.json
20
- var version = "0.0.12";
20
+ var version = "0.0.14";
21
21
  var devDependencies = {
22
- "@types/eslint": "^8.44.7",
22
+ "@antfu/eslint-config": "^2.6.4",
23
+ "@types/eslint": "^8.56.3",
23
24
  "@types/prompts": "^2.4.9",
24
25
  "@types/yargs": "^17.0.32",
25
- bumpp: "9.2.0",
26
- eslint: "8.54.0",
27
- tsup: "8.0.1",
28
- typescript: "5.2.2"
26
+ bumpp: "^9.3.0",
27
+ eslint: "^8.57.0",
28
+ "eslint-plugin-react": "^7.33.2",
29
+ "eslint-plugin-react-hooks": "^4.6.0",
30
+ "eslint-plugin-react-refresh": "^0.4.5",
31
+ "parse-gitignore": "^2.0.0",
32
+ picocolors: "^1.0.0",
33
+ prompts: "^2.4.2",
34
+ tsup: "^8.0.2",
35
+ typescript: "5.2.2",
36
+ yargs: "^17.7.2"
29
37
  };
30
38
 
31
39
  // src/cli/constants.ts
@@ -133,8 +141,55 @@ async function run(options = {}) {
133
141
  eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
134
142
  }
135
143
  }
144
+ const configs = [];
145
+ if (eslintIgnores.length)
146
+ configs.push(` ignores: ${JSON.stringify(eslintIgnores)},`);
147
+ if (!SKIP_PROMPT) {
148
+ let enableReactNativeRulesPrompt = {
149
+ enableReactNativeRules: false
150
+ };
151
+ try {
152
+ enableReactNativeRulesPrompt = await prompts({
153
+ initial: false,
154
+ message: "Enable React Native rules?",
155
+ name: "enableReactNativeRules",
156
+ type: "confirm"
157
+ }, {
158
+ onCancel: () => {
159
+ throw new Error(`Cancelled`);
160
+ }
161
+ });
162
+ } catch (cancelled) {
163
+ console.log(cancelled.message);
164
+ return;
165
+ }
166
+ if (enableReactNativeRulesPrompt.enableReactNativeRules)
167
+ configs.push(` reactnative: true,`);
168
+ if (!enableReactNativeRulesPrompt.enableReactNativeRules) {
169
+ let enableReactRulesPrompt = {
170
+ enableReactRules: false
171
+ };
172
+ try {
173
+ enableReactRulesPrompt = await prompts({
174
+ initial: false,
175
+ message: "Enable React rules?",
176
+ name: "enableReactRules",
177
+ type: "confirm"
178
+ }, {
179
+ onCancel: () => {
180
+ throw new Error(`Cancelled`);
181
+ }
182
+ });
183
+ } catch (cancelled) {
184
+ console.log(cancelled.message);
185
+ return;
186
+ }
187
+ if (enableReactRulesPrompt.enableReactRules)
188
+ configs.push(` react: true,`);
189
+ }
190
+ }
191
+ const wongxyConfig = configs.join("\n");
136
192
  let eslintConfigContent = "";
137
- const wongxyConfig = `${eslintIgnores.length ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
138
193
  if (pkg.type === "module") {
139
194
  eslintConfigContent = `
140
195
  import wongxy from '@wongxy/eslint-config'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wongxy/eslint-config",
3
3
  "type": "module",
4
- "version": "0.0.12",
4
+ "version": "0.0.14",
5
5
  "description": "xiyaowong's eslint config",
6
6
  "author": "xiyaowong (https://github.com/xiyaowong)",
7
7
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "peerDependencies": {
25
25
  "eslint-plugin-react": "^7.33.2",
26
26
  "eslint-plugin-react-hooks": "^4.6.0",
27
- "eslint-plugin-react-refresh": "^0.4.4"
27
+ "eslint-plugin-react-refresh": "^0.4.5"
28
28
  },
29
29
  "dependencies": {
30
30
  "@antfu/eslint-config": "latest",
@@ -34,13 +34,21 @@
34
34
  "yargs": "^17.7.2"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/eslint": "^8.44.7",
37
+ "@antfu/eslint-config": "^2.6.4",
38
+ "@types/eslint": "^8.56.3",
38
39
  "@types/prompts": "^2.4.9",
39
40
  "@types/yargs": "^17.0.32",
40
- "bumpp": "9.2.0",
41
- "eslint": "8.54.0",
42
- "tsup": "8.0.1",
43
- "typescript": "5.2.2"
41
+ "bumpp": "^9.3.0",
42
+ "eslint": "^8.57.0",
43
+ "eslint-plugin-react": "^7.33.2",
44
+ "eslint-plugin-react-hooks": "^4.6.0",
45
+ "eslint-plugin-react-refresh": "^0.4.5",
46
+ "parse-gitignore": "^2.0.0",
47
+ "picocolors": "^1.0.0",
48
+ "prompts": "^2.4.2",
49
+ "tsup": "^8.0.2",
50
+ "typescript": "5.2.2",
51
+ "yargs": "^17.7.2"
44
52
  },
45
53
  "scripts": {
46
54
  "build": "tsup --format esm,cjs --clean --dts",