@xylabs/ts-scripts-yarn3 5.1.7 → 5.1.8

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.
@@ -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,37 +2037,41 @@ 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
+ return readdirSync(dir, {
2043
+ withFileTypes: true
2044
+ }).flatMap((dirent) => {
2045
+ const res = path7.resolve(dir, dirent.name);
2046
+ const subDirectory = dir.split(currentDirectory)[1];
2047
+ const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name;
2048
+ const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
2049
+ if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
2050
+ return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [
2051
+ res
2052
+ ];
2053
+ });
2054
+ }
2055
+ __name(getFiles, "getFiles");
2039
2056
  var packageLint = /* @__PURE__ */ __name(async (fix2 = false) => {
2040
2057
  const configPath = await getRootESLintConfig();
2041
2058
  const { default: eslintConfig } = await import(configPath.href);
2042
- const ignoreFolders = /* @__PURE__ */ new Set([
2059
+ const ignoreFolders = [
2043
2060
  "node_modules",
2044
2061
  "dist",
2045
- "packages"
2046
- ]);
2047
- function getFiles(dir, ignorePatterns2) {
2048
- return readdirSync(dir, {
2049
- withFileTypes: true
2050
- }).flatMap((dirent) => {
2051
- const res = path7.resolve(dir, dirent.name);
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");
2062
+ "packages",
2063
+ ".git",
2064
+ "build"
2065
+ ];
2059
2066
  const engine = new ESLint3({
2060
2067
  baseConfig: [
2061
2068
  ...eslintConfig
2062
2069
  ],
2063
- fix: fix2
2070
+ fix: fix2,
2071
+ warnIgnored: false
2064
2072
  });
2065
- const ignorePatterns = [
2066
- ...eslintConfig.find((cfg) => cfg.ignores)?.ignores ?? [],
2067
- ...ignoreFolders
2068
- ];
2069
- const lintResults = await engine.lintFiles(getFiles(cwd4(), ignorePatterns));
2073
+ const files = getFiles(cwd4(), ignoreFolders);
2074
+ const lintResults = await engine.lintFiles(files);
2070
2075
  dumpMessages2(lintResults);
2071
2076
  return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
2072
2077
  }, "packageLint");