@xylabs/ts-scripts-yarn3 5.1.7 → 5.1.9
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/actions/index.mjs +34 -21
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/index.mjs +34 -21
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +34 -21
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +34 -21
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +34 -21
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/index.mjs +34 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
- package/src/actions/package/lint.ts +32 -20
package/dist/actions/index.mjs
CHANGED
|
@@ -2007,6 +2007,7 @@ import { pathToFileURL } from "node:url";
|
|
|
2007
2007
|
import chalk27 from "chalk";
|
|
2008
2008
|
import { ESLint as ESLint3 } from "eslint";
|
|
2009
2009
|
import { findUp } from "find-up";
|
|
2010
|
+
import picomatch from "picomatch";
|
|
2010
2011
|
var dumpMessages2 = /* @__PURE__ */ __name((lintResults) => {
|
|
2011
2012
|
const colors = [
|
|
2012
2013
|
"white",
|
|
@@ -2036,38 +2037,50 @@ async function getRootESLintConfig() {
|
|
|
2036
2037
|
return pathToFileURL(configPath);
|
|
2037
2038
|
}
|
|
2038
2039
|
__name(getRootESLintConfig, "getRootESLintConfig");
|
|
2040
|
+
function getFiles(dir, ignoreFolders) {
|
|
2041
|
+
const currentDirectory = cwd4();
|
|
2042
|
+
const subDirectory = dir.split(currentDirectory)[1];
|
|
2043
|
+
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2044
|
+
console.log("subDirectory:", subDirectory);
|
|
2045
|
+
return readdirSync(dir, {
|
|
2046
|
+
withFileTypes: true
|
|
2047
|
+
}).flatMap((dirent) => {
|
|
2048
|
+
const res = path7.resolve(dir, dirent.name);
|
|
2049
|
+
const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name;
|
|
2050
|
+
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
2051
|
+
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
2052
|
+
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [
|
|
2053
|
+
res
|
|
2054
|
+
];
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2057
|
+
__name(getFiles, "getFiles");
|
|
2039
2058
|
var packageLint = /* @__PURE__ */ __name(async (fix2 = false) => {
|
|
2040
2059
|
const configPath = await getRootESLintConfig();
|
|
2041
2060
|
const { default: eslintConfig } = await import(configPath.href);
|
|
2042
|
-
const ignoreFolders =
|
|
2061
|
+
const ignoreFolders = [
|
|
2043
2062
|
"node_modules",
|
|
2044
2063
|
"dist",
|
|
2045
|
-
"packages"
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
if (ignorePatterns2.some((pattern) => dir.includes(pattern))) return [];
|
|
2053
|
-
return dirent.isDirectory() ? getFiles(res, ignorePatterns2) : res.endsWith(".ts") || res.endsWith(".tsx") || res.endsWith(".js") || res.endsWith(".jsx") ? [
|
|
2054
|
-
res
|
|
2055
|
-
] : [];
|
|
2056
|
-
});
|
|
2057
|
-
}
|
|
2058
|
-
__name(getFiles, "getFiles");
|
|
2064
|
+
"packages",
|
|
2065
|
+
".git",
|
|
2066
|
+
"build",
|
|
2067
|
+
".yarn",
|
|
2068
|
+
".vscode",
|
|
2069
|
+
".github"
|
|
2070
|
+
];
|
|
2059
2071
|
const engine = new ESLint3({
|
|
2060
2072
|
baseConfig: [
|
|
2061
2073
|
...eslintConfig
|
|
2062
2074
|
],
|
|
2063
|
-
fix: fix2
|
|
2075
|
+
fix: fix2,
|
|
2076
|
+
warnIgnored: false
|
|
2064
2077
|
});
|
|
2065
|
-
const
|
|
2066
|
-
|
|
2067
|
-
...ignoreFolders
|
|
2068
|
-
];
|
|
2069
|
-
const lintResults = await engine.lintFiles(getFiles(cwd4(), ignorePatterns));
|
|
2078
|
+
const files = getFiles(cwd4(), ignoreFolders);
|
|
2079
|
+
const lintResults = await engine.lintFiles(files);
|
|
2070
2080
|
dumpMessages2(lintResults);
|
|
2081
|
+
if (fix2) {
|
|
2082
|
+
await ESLint3.outputFixes(lintResults);
|
|
2083
|
+
}
|
|
2071
2084
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2072
2085
|
}, "packageLint");
|
|
2073
2086
|
|