mirror of
https://github.com/facebook/react-native.git
synced 2024-11-22 06:29:46 +00:00
Suggest running yarn lint --fix (#23413)
Summary: This PR expands the code analysis script to allow for customizing the GitHub Review left by analysis-bot whenever it finds code-level issues. Some, but not all, `eslint` errors are fixable by running `yarn lint --fix`. When the `eslint` converter finds warnings or errors, the bot will suggest running the command as part of the review. The script could be adjusted to only suggest this when `eslint` returns a non-zero `fixableErrorCount` or `fixableWarningCount`, but I think this is a good first step to get people to unblock themselves when they see this type of review from the bot. I've also excluded `bots/` and `scripts/` from eslint as these have several `eslint` errors that need to be addressed. These directories do not contain core RN code, so they can be excluded for now. [GENERAL] [Changed] - analysis-bot will suggest fixing eslint warnings on code reviews Pull Request resolved: https://github.com/facebook/react-native/pull/23413 Differential Revision: D14065757 Pulled By: cpojer fbshipit-source-id: cc588643f7ddb3c4631d89c26b799f7a7244e616
This commit is contained in:
parent
00392ac46b
commit
937c79e2f2
@ -7,4 +7,4 @@ Libraries/Renderer/*
|
||||
pr-inactivity-bookmarklet.js
|
||||
question-bookmarklet.js
|
||||
flow/
|
||||
danger/
|
||||
bots/node_modules
|
@ -30,6 +30,13 @@ function push(arr, key, value) {
|
||||
arr[key].push(value);
|
||||
}
|
||||
|
||||
const converterSummary = {
|
||||
eslint:
|
||||
'`eslint` found some issues. Run `yarn lint --fix` to automatically fix problems.',
|
||||
flow: '`flow` found some issues.',
|
||||
shellcheck: '`shellcheck` found some issues.',
|
||||
};
|
||||
|
||||
/**
|
||||
* There is unfortunately no standard format to report an error, so we have
|
||||
* to write a specific converter for each tool we want to support.
|
||||
@ -250,7 +257,7 @@ function main(messages, owner, repo, number) {
|
||||
let body = '**Code analysis results:**\n\n';
|
||||
const uniqueconvertersUsed = [...new Set(convertersUsed)];
|
||||
uniqueconvertersUsed.forEach(converter => {
|
||||
body += '* `' + converter + '` found some issues.\n';
|
||||
body += '* ' + converterSummary[converter] + '\n';
|
||||
});
|
||||
|
||||
sendReview(owner, repo, number, sha, body, comments);
|
||||
|
Loading…
Reference in New Issue
Block a user