@wongxy/eslint-config 0.0.13 → 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,7 +46,7 @@ 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.13";
49
+ var version = "0.0.14";
50
50
  var devDependencies = {
51
51
  "@antfu/eslint-config": "^2.6.4",
52
52
  "@types/eslint": "^8.56.3",
@@ -170,8 +170,55 @@ async function run(options = {}) {
170
170
  eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
171
171
  }
172
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");
173
221
  let eslintConfigContent = "";
174
- const wongxyConfig = `${eslintIgnores.length ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
175
222
  if (pkg.type === "module") {
176
223
  eslintConfigContent = `
177
224
  import wongxy from '@wongxy/eslint-config'
package/dist/cli.js CHANGED
@@ -17,7 +17,7 @@ import parse from "parse-gitignore";
17
17
  import c from "picocolors";
18
18
 
19
19
  // package.json
20
- var version = "0.0.13";
20
+ var version = "0.0.14";
21
21
  var devDependencies = {
22
22
  "@antfu/eslint-config": "^2.6.4",
23
23
  "@types/eslint": "^8.56.3",
@@ -141,8 +141,55 @@ async function run(options = {}) {
141
141
  eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
142
142
  }
143
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");
144
192
  let eslintConfigContent = "";
145
- const wongxyConfig = `${eslintIgnores.length ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
146
193
  if (pkg.type === "module") {
147
194
  eslintConfigContent = `
148
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.13",
4
+ "version": "0.0.14",
5
5
  "description": "xiyaowong's eslint config",
6
6
  "author": "xiyaowong (https://github.com/xiyaowong)",
7
7
  "license": "MIT",