@tofrankie/eslint 0.0.20 → 0.0.21
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/CHANGELOG.md +4 -0
- package/dist/index.cjs +10 -1
- package/dist/index.mjs +10 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ let _antfu_eslint_config = require("@antfu/eslint-config");
|
|
|
25
25
|
_antfu_eslint_config = __toESM(_antfu_eslint_config);
|
|
26
26
|
let eslint_plugin_jsdoc = require("eslint-plugin-jsdoc");
|
|
27
27
|
let defu = require("defu");
|
|
28
|
+
let find_up_simple = require("find-up-simple");
|
|
28
29
|
let local_pkg = require("local-pkg");
|
|
29
30
|
//#region src/presets/e18e.ts
|
|
30
31
|
const e18eRules = {
|
|
@@ -461,6 +462,9 @@ function resolveFormattersOption(value) {
|
|
|
461
462
|
function detectPackage(name) {
|
|
462
463
|
return (0, local_pkg.isPackageExists)(name);
|
|
463
464
|
}
|
|
465
|
+
function detectPnpmWorkspaceYaml(cwd) {
|
|
466
|
+
return (0, find_up_simple.findUpSync)("pnpm-workspace.yaml", cwd === void 0 ? void 0 : { cwd }) !== void 0;
|
|
467
|
+
}
|
|
464
468
|
//#endregion
|
|
465
469
|
//#region src/core/jsdoc-mode.ts
|
|
466
470
|
const INTERNAL_JSDOC_MODE = "antfu";
|
|
@@ -475,7 +479,7 @@ function resolveConfigOptions(options) {
|
|
|
475
479
|
jsdocMode: INTERNAL_JSDOC_MODE,
|
|
476
480
|
lessOpinionated: options.lessOpinionated === true,
|
|
477
481
|
node: isEnabledByDefault(options.node),
|
|
478
|
-
pnpm:
|
|
482
|
+
pnpm: isPnpmEnabled(options.pnpm),
|
|
479
483
|
react: isExplicitlyEnabled(options.react),
|
|
480
484
|
stylistic: isEnabledByDefault(options.stylistic),
|
|
481
485
|
test: isEnabledByDefault(options.test),
|
|
@@ -491,6 +495,11 @@ function isEnabledByDefault(value) {
|
|
|
491
495
|
function isExplicitlyEnabled(value) {
|
|
492
496
|
return value === true || isOptionObject(value);
|
|
493
497
|
}
|
|
498
|
+
function isPnpmEnabled(pnpmOption) {
|
|
499
|
+
if (pnpmOption === false) return false;
|
|
500
|
+
if (isExplicitlyEnabled(pnpmOption)) return true;
|
|
501
|
+
return detectPnpmWorkspaceYaml();
|
|
502
|
+
}
|
|
494
503
|
function isAutoDetectedEnabled(value, packageName) {
|
|
495
504
|
if (value === false) return false;
|
|
496
505
|
return isExplicitlyEnabled(value) || detectPackage(packageName);
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import antfu from "@antfu/eslint-config";
|
|
2
2
|
import { jsdoc } from "eslint-plugin-jsdoc";
|
|
3
3
|
import { createDefu } from "defu";
|
|
4
|
+
import { findUpSync } from "find-up-simple";
|
|
4
5
|
import { isPackageExists } from "local-pkg";
|
|
5
6
|
export * from "@antfu/eslint-config";
|
|
6
7
|
//#region src/presets/e18e.ts
|
|
@@ -438,6 +439,9 @@ function resolveFormattersOption(value) {
|
|
|
438
439
|
function detectPackage(name) {
|
|
439
440
|
return isPackageExists(name);
|
|
440
441
|
}
|
|
442
|
+
function detectPnpmWorkspaceYaml(cwd) {
|
|
443
|
+
return findUpSync("pnpm-workspace.yaml", cwd === void 0 ? void 0 : { cwd }) !== void 0;
|
|
444
|
+
}
|
|
441
445
|
//#endregion
|
|
442
446
|
//#region src/core/jsdoc-mode.ts
|
|
443
447
|
const INTERNAL_JSDOC_MODE = "antfu";
|
|
@@ -452,7 +456,7 @@ function resolveConfigOptions(options) {
|
|
|
452
456
|
jsdocMode: INTERNAL_JSDOC_MODE,
|
|
453
457
|
lessOpinionated: options.lessOpinionated === true,
|
|
454
458
|
node: isEnabledByDefault(options.node),
|
|
455
|
-
pnpm:
|
|
459
|
+
pnpm: isPnpmEnabled(options.pnpm),
|
|
456
460
|
react: isExplicitlyEnabled(options.react),
|
|
457
461
|
stylistic: isEnabledByDefault(options.stylistic),
|
|
458
462
|
test: isEnabledByDefault(options.test),
|
|
@@ -468,6 +472,11 @@ function isEnabledByDefault(value) {
|
|
|
468
472
|
function isExplicitlyEnabled(value) {
|
|
469
473
|
return value === true || isOptionObject(value);
|
|
470
474
|
}
|
|
475
|
+
function isPnpmEnabled(pnpmOption) {
|
|
476
|
+
if (pnpmOption === false) return false;
|
|
477
|
+
if (isExplicitlyEnabled(pnpmOption)) return true;
|
|
478
|
+
return detectPnpmWorkspaceYaml();
|
|
479
|
+
}
|
|
471
480
|
function isAutoDetectedEnabled(value, packageName) {
|
|
472
481
|
if (value === false) return false;
|
|
473
482
|
return isExplicitlyEnabled(value) || detectPackage(packageName);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tofrankie/eslint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.21",
|
|
5
5
|
"description": "Shared ESLint configuration",
|
|
6
6
|
"author": "Frankie <1426203851@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"eslint-plugin-react-refresh": "^0.5.2",
|
|
69
69
|
"eslint-plugin-solid": "^0.14.5",
|
|
70
70
|
"eslint-plugin-svelte": "^3.17.0",
|
|
71
|
+
"find-up-simple": "^1.0.1",
|
|
71
72
|
"local-pkg": "^1.1.2",
|
|
72
73
|
"prettier-plugin-astro": "^0.14.1"
|
|
73
74
|
},
|