Prefer const wherever possible

Summary:
Non-final identifiers make code harder to understand.
This is particularly true for JavaScript where even the *type*
can change as a value gets reassigned later.

This enforces to use `const` whereever possible, but doesn't
"outlaw" `let`. Mixed destructuring is also still allowed.

Used `eslint --fix` to change all existing cases.

Reviewed By: jknoxville

Differential Revision: D16131329

fbshipit-source-id: 2eceaca7c603b71b36e005be5d135e1849f2518d
This commit is contained in:
Pascal Hartig
2019-07-09 04:15:32 -07:00
committed by Facebook Github Bot
parent 662db20948
commit c588b650ae
34 changed files with 141 additions and 140 deletions

View File

@@ -129,7 +129,7 @@ test('convertRequestToCurlCommand: malicious POST data', () => {
});
test('convertRequestToCurlCommand: control characters', () => {
let request: Request = {
const request: Request = {
id: 'request id',
timestamp: 1234567890,
method: 'GET',
@@ -138,7 +138,7 @@ test('convertRequestToCurlCommand: control characters', () => {
data: btoa('some=\u0007 \u0009 \u000C \u001B&other=param'),
};
let command = convertRequestToCurlCommand(request);
const command = convertRequestToCurlCommand(request);
expect(command).toEqual(
"curl -v -X GET 'https://fbflipper.com/' -d $'some=\\u07 \\u09 \\u0c \\u1b&other=param'",
);