Skip to content

Commit ca286b7

Browse files
Arthur Cinaderflovilmart
authored andcommitted
Enable prefer-const lint rule (#3202)
1 parent a6c9881 commit ca286b7

File tree

106 files changed

+1183
-1183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1183
-1183
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"no-trailing-spaces": 2,
2020
"eol-last": 2,
2121
"space-in-parens": ["error", "never"],
22-
"no-multiple-empty-lines": 1
22+
"no-multiple-empty-lines": 1,
23+
"prefer-const": "error"
2324
}
2425
}

spec/Analytics.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('AnalyticsController', () => {
1717
}).then(() => {
1818
expect(analyticsAdapter.trackEvent).toHaveBeenCalled();
1919
var lastCall = analyticsAdapter.trackEvent.calls.first();
20-
let args = lastCall.args;
20+
const args = lastCall.args;
2121
expect(args[0]).toEqual('MyEvent');
2222
expect(args[1]).toEqual({
2323
dimensions: {
@@ -45,7 +45,7 @@ describe('AnalyticsController', () => {
4545
}).then(() => {
4646
expect(analyticsAdapter.appOpened).toHaveBeenCalled();
4747
var lastCall = analyticsAdapter.appOpened.calls.first();
48-
let args = lastCall.args;
48+
const args = lastCall.args;
4949
expect(args[0]).toEqual({
5050
dimensions: {
5151
key: 'value',

spec/AuthenticationAdapters.spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ describe('AuthenticationProviers', function() {
208208
id: 'hello',
209209
token: 'world'
210210
}
211-
let adapter = {
211+
const adapter = {
212212
validateAppId: function() {
213213
return Promise.resolve();
214214
},
@@ -220,15 +220,15 @@ describe('AuthenticationProviers', function() {
220220
}
221221
};
222222

223-
let authDataSpy = spyOn(adapter, 'validateAuthData').and.callThrough();
224-
let appIdSpy = spyOn(adapter, 'validateAppId').and.callThrough();
223+
const authDataSpy = spyOn(adapter, 'validateAuthData').and.callThrough();
224+
const appIdSpy = spyOn(adapter, 'validateAppId').and.callThrough();
225225

226-
let authenticationHandler = authenticationLoader({
226+
const authenticationHandler = authenticationLoader({
227227
customAuthentication: adapter
228228
});
229229

230230
validateAuthenticationHandler(authenticationHandler);
231-
let validator = authenticationHandler.getValidatorForProvider('customAuthentication');
231+
const validator = authenticationHandler.getValidatorForProvider('customAuthentication');
232232
validateValidator(validator);
233233

234234
validator(validAuthData).then(() => {
@@ -243,12 +243,12 @@ describe('AuthenticationProviers', function() {
243243
});
244244

245245
it('properly loads custom adapter module object', (done) => {
246-
let authenticationHandler = authenticationLoader({
246+
const authenticationHandler = authenticationLoader({
247247
customAuthentication: path.resolve('./spec/support/CustomAuth.js')
248248
});
249249

250250
validateAuthenticationHandler(authenticationHandler);
251-
let validator = authenticationHandler.getValidatorForProvider('customAuthentication');
251+
const validator = authenticationHandler.getValidatorForProvider('customAuthentication');
252252
validateValidator(validator);
253253

254254
validator({
@@ -262,12 +262,12 @@ describe('AuthenticationProviers', function() {
262262
});
263263

264264
it('properly loads custom adapter module object', (done) => {
265-
let authenticationHandler = authenticationLoader({
265+
const authenticationHandler = authenticationLoader({
266266
customAuthentication: { module: path.resolve('./spec/support/CustomAuthFunction.js'), options: { token: 'valid-token' }}
267267
});
268268

269269
validateAuthenticationHandler(authenticationHandler);
270-
let validator = authenticationHandler.getValidatorForProvider('customAuthentication');
270+
const validator = authenticationHandler.getValidatorForProvider('customAuthentication');
271271
validateValidator(validator);
272272

273273
validator({

spec/CLI.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe('commander additions', () => {
9494
'PROGRAM_ARG_0': 'arg0ENVValue',
9595
'PROGRAM_ARG_1': 'arg1ENVValue',
9696
});
97-
let options = commander.getOptions();
97+
const options = commander.getOptions();
9898
expect(options.arg2).toBe(8888);
9999
expect(options.arg3).toBe('hello'); //config value
100100
expect(options.arg4).toBe('/1');
@@ -123,7 +123,7 @@ describe('commander additions', () => {
123123
it('should load config from apps', (done) => {
124124
commander.loadDefinitions(testDefinitions);
125125
commander.parse(['node', './CLI.spec.js', './spec/configs/CLIConfigApps.json']);
126-
let options = commander.getOptions();
126+
const options = commander.getOptions();
127127
expect(options.arg1).toBe('my_app');
128128
expect(options.arg2).toBe(8888);
129129
expect(options.arg3).toBe('hello'); //config value
@@ -142,8 +142,8 @@ describe('commander additions', () => {
142142

143143
describe('definitions', () => {
144144
it('should have valid types', () => {
145-
for (let key in definitions) {
146-
let definition = definitions[key];
145+
for (const key in definitions) {
146+
const definition = definitions[key];
147147
expect(typeof definition).toBe('object');
148148
if (typeof definition.env !== 'undefined') {
149149
expect(typeof definition.env).toBe('string');
@@ -161,8 +161,8 @@ describe('definitions', () => {
161161

162162
describe('LiveQuery definitions', () => {
163163
it('should have valid types', () => {
164-
for (let key in liveQueryDefinitions) {
165-
let definition = liveQueryDefinitions[key];
164+
for (const key in liveQueryDefinitions) {
165+
const definition = liveQueryDefinitions[key];
166166
expect(typeof definition).toBe('object');
167167
if (typeof definition.env !== 'undefined') {
168168
expect(typeof definition.env).toBe('string');

spec/ClientSDK.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var ClientSDK = require('../src/ClientSDK');
22

33
describe('ClientSDK', () => {
44
it('should properly parse the SDK versions', () => {
5-
let clientSDKFromVersion = ClientSDK.fromString;
5+
const clientSDKFromVersion = ClientSDK.fromString;
66
expect(clientSDKFromVersion('i1.1.1')).toEqual({
77
sdk: 'i',
88
version: '1.1.1'

0 commit comments

Comments
 (0)