@isentinel/eslint-config 5.1.2 → 5.1.3
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/dist/index.mjs +29 -3
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1578,7 +1578,11 @@ async function jsx() {
|
|
|
1578
1578
|
//#region src/configs/package-json.ts
|
|
1579
1579
|
async function packageJson(options = {}) {
|
|
1580
1580
|
const { roblox = true, stylistic = true, type = "game" } = options;
|
|
1581
|
-
const [jsoncEslintParser, pluginPackageJson] = await Promise.all([
|
|
1581
|
+
const [jsoncEslintParser, pluginPackageJson, atRoot] = await Promise.all([
|
|
1582
|
+
interopDefault(import("jsonc-eslint-parser")),
|
|
1583
|
+
interopDefault(import("eslint-plugin-package-json")),
|
|
1584
|
+
isWorkspaceRootCwd()
|
|
1585
|
+
]);
|
|
1582
1586
|
return [
|
|
1583
1587
|
{
|
|
1584
1588
|
name: "isentinel/package-json/setup",
|
|
@@ -1717,14 +1721,36 @@ async function packageJson(options = {}) {
|
|
|
1717
1721
|
} : {}
|
|
1718
1722
|
}
|
|
1719
1723
|
},
|
|
1720
|
-
{
|
|
1724
|
+
...atRoot ? [{
|
|
1721
1725
|
name: "isentinel/package-json/root",
|
|
1722
1726
|
files: ["package.json"],
|
|
1723
1727
|
languageOptions: { parser: jsoncEslintParser },
|
|
1724
1728
|
rules: { "package-json/require-packageManager": ["error", { ignorePrivate: false }] }
|
|
1725
|
-
}
|
|
1729
|
+
}] : []
|
|
1726
1730
|
];
|
|
1727
1731
|
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Determines whether the current working directory is the root of the project.
|
|
1734
|
+
*
|
|
1735
|
+
* ESLint `files` globs are resolved relative to the cwd, so `["package.json"]`
|
|
1736
|
+
* matches the cwd's own `package.json` regardless of where it sits in a
|
|
1737
|
+
* monorepo. When packages are linted in parallel (each with its own cwd),
|
|
1738
|
+
* every package would otherwise look like the root. Detect the real root via
|
|
1739
|
+
* `pnpm-workspace.yaml`:
|
|
1740
|
+
*
|
|
1741
|
+
* - Found in the cwd: this is the workspace root.
|
|
1742
|
+
* - Found in an ancestor: this is a sub-package, not the root.
|
|
1743
|
+
* - Not found anywhere: a standalone project, so the cwd is its root.
|
|
1744
|
+
*
|
|
1745
|
+
* @param cwd - The directory to resolve from, defaulting to the current
|
|
1746
|
+
* working directory.
|
|
1747
|
+
* @returns Whether the cwd is the project root.
|
|
1748
|
+
*/
|
|
1749
|
+
async function isWorkspaceRootCwd(cwd = process.cwd()) {
|
|
1750
|
+
const workspaceFile = await findUp("pnpm-workspace.yaml", { cwd });
|
|
1751
|
+
if (workspaceFile === void 0) return true;
|
|
1752
|
+
return path.relative(path.dirname(workspaceFile), cwd) === "";
|
|
1753
|
+
}
|
|
1728
1754
|
|
|
1729
1755
|
//#endregion
|
|
1730
1756
|
//#region src/configs/spelling.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isentinel/eslint-config",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.3",
|
|
4
4
|
"description": "iSentinel's ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"type-fest": "5.4.4",
|
|
123
123
|
"typescript": "5.9.3",
|
|
124
124
|
"unplugin-unused": "0.5.7",
|
|
125
|
-
"@isentinel/eslint-config": "5.1.
|
|
125
|
+
"@isentinel/eslint-config": "5.1.3"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
128
|
"@vitest/eslint-plugin": "^1.6.4",
|