Skip to content

Instantly share code, notes, and snippets.

@jaredly
Created November 28, 2023 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredly/f34d07f349ef31893caa883053ed547f to your computer and use it in GitHub Desktop.
Save jaredly/f34d07f349ef31893caa883053ed547f to your computer and use it in GitHub Desktop.
ignore eslint errors
const fs = require('fs');
const log = fs.readFileSync('./log.txt', 'utf-8').split('\n');
const ok = {};
let name;
log.forEach((line) => {
if (!line.trim()) {
return;
}
if (line.startsWith('/')) {
name = line;
ok[name] = [];
return;
}
const [pos] = line.trim().split(' ');
const [lno, _] = pos.split(':');
const l = +lno;
if (!ok[name].includes(l)) {
ok[name].push(l);
}
});
Object.entries(ok).forEach(([name, lines]) => {
const src = fs.readFileSync(name, 'utf-8').split('\n');
lines.reverse().forEach((lno) => {
src.splice(
lno - 1,
0,
`// eslint-disable-next-line no-restricted-syntax -- TODO(MOB-5313): Migrate to useTheme()`,
);
});
fs.writeFileSync(name, src.join('\n'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment