Skip to content

Commit

Permalink
Enable prefer-const lint rule (parse-community#3202)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Cinader authored and flovilmart committed Dec 7, 2016
1 parent a6c9881 commit ca286b7
Show file tree
Hide file tree
Showing 106 changed files with 1,183 additions and 1,183 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"no-trailing-spaces": 2,
"eol-last": 2,
"space-in-parens": ["error", "never"],
"no-multiple-empty-lines": 1
"no-multiple-empty-lines": 1,
"prefer-const": "error"
}
}
4 changes: 2 additions & 2 deletions spec/Analytics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('AnalyticsController', () => {
}).then(() => {
expect(analyticsAdapter.trackEvent).toHaveBeenCalled();
var lastCall = analyticsAdapter.trackEvent.calls.first();
let args = lastCall.args;
const args = lastCall.args;
expect(args[0]).toEqual('MyEvent');
expect(args[1]).toEqual({
dimensions: {
Expand Down Expand Up @@ -45,7 +45,7 @@ describe('AnalyticsController', () => {
}).then(() => {
expect(analyticsAdapter.appOpened).toHaveBeenCalled();
var lastCall = analyticsAdapter.appOpened.calls.first();
let args = lastCall.args;
const args = lastCall.args;
expect(args[0]).toEqual({
dimensions: {
key: 'value',
Expand Down
18 changes: 9 additions & 9 deletions spec/AuthenticationAdapters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ describe('AuthenticationProviers', function() {
id: 'hello',
token: 'world'
}
let adapter = {
const adapter = {
validateAppId: function() {
return Promise.resolve();
},
Expand All @@ -220,15 +220,15 @@ describe('AuthenticationProviers', function() {
}
};

let authDataSpy = spyOn(adapter, 'validateAuthData').and.callThrough();
let appIdSpy = spyOn(adapter, 'validateAppId').and.callThrough();
const authDataSpy = spyOn(adapter, 'validateAuthData').and.callThrough();
const appIdSpy = spyOn(adapter, 'validateAppId').and.callThrough();

let authenticationHandler = authenticationLoader({
const authenticationHandler = authenticationLoader({
customAuthentication: adapter
});

validateAuthenticationHandler(authenticationHandler);
let validator = authenticationHandler.getValidatorForProvider('customAuthentication');
const validator = authenticationHandler.getValidatorForProvider('customAuthentication');
validateValidator(validator);

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

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

validateAuthenticationHandler(authenticationHandler);
let validator = authenticationHandler.getValidatorForProvider('customAuthentication');
const validator = authenticationHandler.getValidatorForProvider('customAuthentication');
validateValidator(validator);

validator({
Expand All @@ -262,12 +262,12 @@ describe('AuthenticationProviers', function() {
});

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

validateAuthenticationHandler(authenticationHandler);
let validator = authenticationHandler.getValidatorForProvider('customAuthentication');
const validator = authenticationHandler.getValidatorForProvider('customAuthentication');
validateValidator(validator);

validator({
Expand Down
12 changes: 6 additions & 6 deletions spec/CLI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('commander additions', () => {
'PROGRAM_ARG_0': 'arg0ENVValue',
'PROGRAM_ARG_1': 'arg1ENVValue',
});
let options = commander.getOptions();
const options = commander.getOptions();
expect(options.arg2).toBe(8888);
expect(options.arg3).toBe('hello'); //config value
expect(options.arg4).toBe('/1');
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('commander additions', () => {
it('should load config from apps', (done) => {
commander.loadDefinitions(testDefinitions);
commander.parse(['node', './CLI.spec.js', './spec/configs/CLIConfigApps.json']);
let options = commander.getOptions();
const options = commander.getOptions();
expect(options.arg1).toBe('my_app');
expect(options.arg2).toBe(8888);
expect(options.arg3).toBe('hello'); //config value
Expand All @@ -142,8 +142,8 @@ describe('commander additions', () => {

describe('definitions', () => {
it('should have valid types', () => {
for (let key in definitions) {
let definition = definitions[key];
for (const key in definitions) {
const definition = definitions[key];
expect(typeof definition).toBe('object');
if (typeof definition.env !== 'undefined') {
expect(typeof definition.env).toBe('string');
Expand All @@ -161,8 +161,8 @@ describe('definitions', () => {

describe('LiveQuery definitions', () => {
it('should have valid types', () => {
for (let key in liveQueryDefinitions) {
let definition = liveQueryDefinitions[key];
for (const key in liveQueryDefinitions) {
const definition = liveQueryDefinitions[key];
expect(typeof definition).toBe('object');
if (typeof definition.env !== 'undefined') {
expect(typeof definition.env).toBe('string');
Expand Down
2 changes: 1 addition & 1 deletion spec/ClientSDK.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var ClientSDK = require('../src/ClientSDK');

describe('ClientSDK', () => {
it('should properly parse the SDK versions', () => {
let clientSDKFromVersion = ClientSDK.fromString;
const clientSDKFromVersion = ClientSDK.fromString;
expect(clientSDKFromVersion('i1.1.1')).toEqual({
sdk: 'i',
version: '1.1.1'
Expand Down
Loading

0 comments on commit ca286b7

Please sign in to comment.