Last active
May 31, 2023 02:47
-
-
Save pastak/77e82d35a7129cc9c0ccb8e1397f9b08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ESLint, Linter } = require('eslint'); | |
const path = require('path'); | |
const eslint = new ESLint(); | |
const fixable = new Map(); | |
new Linter().getRules().forEach((val, key) => { | |
if (val.meta.fixable) { | |
fixable.set(key, true); | |
} | |
}); | |
(async function main() { | |
const results = await eslint.lintFiles(['.']); | |
results.forEach((r) => { | |
const filepath = path.relative(process.cwd(), r.filePath); | |
r.messages.forEach((message) => { | |
console.log( | |
[ | |
filepath, | |
message.line, | |
message.column, | |
message.endLine, | |
message.endColumn, | |
message.ruleId, | |
message.message, | |
fixable.get(message.ruleId) ? 'true' : 'false', | |
].join('\t') | |
); | |
}); | |
}); | |
})().catch((error) => { | |
process.exitCode = 1; | |
console.error(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment