@coderwyd/eslint-config 2.1.3 → 2.1.4

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
@@ -234,7 +234,7 @@ interface OptionsConfig {
234
234
  * {
235
235
  * "arrowParens": "avoid",
236
236
  * "htmlWhitespaceSensitivity": "ignore"
237
- * "printWidth": 120,
237
+ * "printWidth": 80,
238
238
  * "semi": false,
239
239
  * "singleQuote": true,
240
240
  * }
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 = "2.1.3";
49
+ var version = "2.1.4";
50
50
  var devDependencies = {
51
51
  "@antfu/ni": "^0.21.12",
52
52
  "@types/eslint": "^8.56.2",
@@ -117,7 +117,7 @@ function isGitClean() {
117
117
  try {
118
118
  (0, import_node_child_process.execSync)("git diff-index --quiet HEAD --");
119
119
  return true;
120
- } catch (error) {
120
+ } catch {
121
121
  return false;
122
122
  }
123
123
  }
@@ -167,7 +167,7 @@ async function run(options = {}) {
167
167
  }
168
168
  }
169
169
  let eslintConfigContent = "";
170
- const coderwydConfig = `${eslintIgnores.length ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
170
+ const coderwydConfig = `${eslintIgnores.length > 0 ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
171
171
  if (pkg.type === "module") {
172
172
  eslintConfigContent = `
173
173
  import { defineConfig } from '@coderwyd/eslint-config'
@@ -193,7 +193,7 @@ ${coderwydConfig}
193
193
  if (file.includes("eslint") || file.includes("prettier"))
194
194
  legacyConfig.push(file);
195
195
  });
196
- if (legacyConfig.length) {
196
+ if (legacyConfig.length > 0) {
197
197
  console.log(`${WARN} you can now remove those files manually:`);
198
198
  console.log(` ${import_picocolors2.default.dim(legacyConfig.join(", "))}`);
199
199
  }
@@ -215,8 +215,8 @@ ${coderwydConfig}
215
215
  }
216
216
  }
217
217
  );
218
- } catch (cancelled) {
219
- console.log(cancelled.message);
218
+ } catch (error) {
219
+ console.log(error.message);
220
220
  return;
221
221
  }
222
222
  }
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 = "2.1.3";
20
+ var version = "2.1.4";
21
21
  var devDependencies = {
22
22
  "@antfu/ni": "^0.21.12",
23
23
  "@types/eslint": "^8.56.2",
@@ -88,7 +88,7 @@ function isGitClean() {
88
88
  try {
89
89
  execSync("git diff-index --quiet HEAD --");
90
90
  return true;
91
- } catch (error) {
91
+ } catch {
92
92
  return false;
93
93
  }
94
94
  }
@@ -138,7 +138,7 @@ async function run(options = {}) {
138
138
  }
139
139
  }
140
140
  let eslintConfigContent = "";
141
- const coderwydConfig = `${eslintIgnores.length ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
141
+ const coderwydConfig = `${eslintIgnores.length > 0 ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
142
142
  if (pkg.type === "module") {
143
143
  eslintConfigContent = `
144
144
  import { defineConfig } from '@coderwyd/eslint-config'
@@ -164,7 +164,7 @@ ${coderwydConfig}
164
164
  if (file.includes("eslint") || file.includes("prettier"))
165
165
  legacyConfig.push(file);
166
166
  });
167
- if (legacyConfig.length) {
167
+ if (legacyConfig.length > 0) {
168
168
  console.log(`${WARN} you can now remove those files manually:`);
169
169
  console.log(` ${c2.dim(legacyConfig.join(", "))}`);
170
170
  }
@@ -186,8 +186,8 @@ ${coderwydConfig}
186
186
  }
187
187
  }
188
188
  );
189
- } catch (cancelled) {
190
- console.log(cancelled.message);
189
+ } catch (error) {
190
+ console.log(error.message);
191
191
  return;
192
192
  }
193
193
  }
package/dist/index.cjs CHANGED
@@ -41,7 +41,7 @@ var import_local_pkg3 = require("local-pkg");
41
41
  var DEFAULT_PRETTIER_RULES = {
42
42
  arrowParens: "avoid",
43
43
  htmlWhitespaceSensitivity: "ignore",
44
- printWidth: 120,
44
+ printWidth: 80,
45
45
  semi: false,
46
46
  singleQuote: true
47
47
  };
@@ -1324,6 +1324,11 @@ async function formatter(options = {}, prettierRules2 = {}) {
1324
1324
  ...prettierRules2,
1325
1325
  parser
1326
1326
  };
1327
+ const markdownRules = {
1328
+ printWidth: 120,
1329
+ ...rules,
1330
+ embeddedLanguageFormatting: "off"
1331
+ };
1327
1332
  if (plugins?.length) {
1328
1333
  rules.plugins = [...rules.plugins || [], ...plugins];
1329
1334
  }
@@ -1337,7 +1342,7 @@ async function formatter(options = {}, prettierRules2 = {}) {
1337
1342
  prettier: pluginPrettier
1338
1343
  },
1339
1344
  rules: {
1340
- "prettier/prettier": ["warn", rules]
1345
+ "prettier/prettier": ["warn", parser === "markdown" ? markdownRules : rules]
1341
1346
  }
1342
1347
  };
1343
1348
  return config;
@@ -1580,7 +1585,7 @@ async function defineConfig(options = {}, ...userConfigs) {
1580
1585
  acc[key] = options[key];
1581
1586
  return acc;
1582
1587
  }, {});
1583
- if (Object.keys(fusedConfig).length)
1588
+ if (Object.keys(fusedConfig).length > 0)
1584
1589
  configs.push([fusedConfig]);
1585
1590
  const merged = combine(...configs, ...userConfigs);
1586
1591
  return merged;
package/dist/index.d.cts CHANGED
@@ -219,7 +219,7 @@ interface OptionsConfig extends OptionsComponentExts {
219
219
  * {
220
220
  * "arrowParens": "avoid",
221
221
  * "htmlWhitespaceSensitivity": "ignore"
222
- * "printWidth": 120,
222
+ * "printWidth": 80,
223
223
  * "semi": false,
224
224
  * "singleQuote": true,
225
225
  * }
package/dist/index.d.ts CHANGED
@@ -219,7 +219,7 @@ interface OptionsConfig extends OptionsComponentExts {
219
219
  * {
220
220
  * "arrowParens": "avoid",
221
221
  * "htmlWhitespaceSensitivity": "ignore"
222
- * "printWidth": 120,
222
+ * "printWidth": 80,
223
223
  * "semi": false,
224
224
  * "singleQuote": true,
225
225
  * }
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { isPackageExists as isPackageExists3 } from "local-pkg";
7
7
  var DEFAULT_PRETTIER_RULES = {
8
8
  arrowParens: "avoid",
9
9
  htmlWhitespaceSensitivity: "ignore",
10
- printWidth: 120,
10
+ printWidth: 80,
11
11
  semi: false,
12
12
  singleQuote: true
13
13
  };
@@ -1290,6 +1290,11 @@ async function formatter(options = {}, prettierRules2 = {}) {
1290
1290
  ...prettierRules2,
1291
1291
  parser
1292
1292
  };
1293
+ const markdownRules = {
1294
+ printWidth: 120,
1295
+ ...rules,
1296
+ embeddedLanguageFormatting: "off"
1297
+ };
1293
1298
  if (plugins?.length) {
1294
1299
  rules.plugins = [...rules.plugins || [], ...plugins];
1295
1300
  }
@@ -1303,7 +1308,7 @@ async function formatter(options = {}, prettierRules2 = {}) {
1303
1308
  prettier: pluginPrettier
1304
1309
  },
1305
1310
  rules: {
1306
- "prettier/prettier": ["warn", rules]
1311
+ "prettier/prettier": ["warn", parser === "markdown" ? markdownRules : rules]
1307
1312
  }
1308
1313
  };
1309
1314
  return config;
@@ -1546,7 +1551,7 @@ async function defineConfig(options = {}, ...userConfigs) {
1546
1551
  acc[key] = options[key];
1547
1552
  return acc;
1548
1553
  }, {});
1549
- if (Object.keys(fusedConfig).length)
1554
+ if (Object.keys(fusedConfig).length > 0)
1550
1555
  configs.push([fusedConfig]);
1551
1556
  const merged = combine(...configs, ...userConfigs);
1552
1557
  return merged;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coderwyd/eslint-config",
3
3
  "type": "module",
4
- "version": "2.1.3",
4
+ "version": "2.1.4",
5
5
  "packageManager": "pnpm@8.15.1",
6
6
  "description": "Donny's ESLint config",
7
7
  "author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",