diff --git a/apps/.eslintrc.js b/apps/.eslintrc.js index 217f23035..671cdfaef 100644 --- a/apps/.eslintrc.js +++ b/apps/.eslintrc.js @@ -1,4 +1,30 @@ const lintExemptions = require("./lint_exemptions.js"); +const fs = require("fs"); +const path = require("path"); + +function findGeneratedJS(root) { + function* listFiles(dir, allow) { + for (const f of fs.readdirSync(dir)) { + const filepath = path.join(dir, f); + const stat = fs.statSync(filepath); + + if (stat.isDirectory()) { + yield* listFiles(filepath, allow); + } else if(allow(filepath)) { + yield filepath; + } + } + } + + return [...listFiles(root, f => f.endsWith(".ts"))] + .map(f => f.replace(/\.ts$/, ".js")) + .map(f => { + if (f.startsWith(root)) { + return f.substring(root.length); + } + return f; + }); +} module.exports = { "env": { @@ -222,4 +248,5 @@ module.exports = { rules: Object.fromEntries(rules.map(rule => [rule, "off"])), })), ], + ignorePatterns: findGeneratedJS("apps/"), }