Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up js lint errors #17426

Merged
merged 2 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
browser: true,
},
rules: {
'no-console': 'warn',
'no-console': 'error',
'ember/no-mixins': 'warn',
'ember/no-new-mixins': 'off', // should be warn but then every line of the mixin is green
// need to be fully glimmerized before these rules can be turned on
Expand Down
2 changes: 1 addition & 1 deletion ui/.template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ try {
prettier: false,
};
} catch (error) {
console.log(error);
console.log(error); // eslint-disable-line
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/calendar-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class CalendarWidget extends Component {
const year = this.args.endTimeDisplay.split(' ')[1];
setYear = parseInt(year);
} catch (e) {
console.debug('Error resetting display year', e);
console.debug('Error resetting display year', e); // eslint-disable-line
}
}
this.displayYear = setYear;
Expand Down
3 changes: 2 additions & 1 deletion ui/app/components/clients/line-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ export default class LineChart extends Component {
const upgradeData = this.args.upgradeData;
if (!upgradeData) return null;
if (!Array.isArray(upgradeData)) {
console.debug('upgradeData must be an array of objects containing upgrade history');
console.debug('upgradeData must be an array of objects containing upgrade history'); // eslint-disable-line
return null;
} else if (!Object.keys(upgradeData[0]).includes('timestampInstalled')) {
// eslint-disable-next-line
console.debug(
`upgrade must be an object with the following key names: ['id', 'previousVersion', 'timestampInstalled']`
);
Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/database-role-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class DatabaseRoleEdit extends Component {
try {
this.router.transitionTo(LIST_ROOT_ROUTE, backend, { queryParams: { tab: 'role' } });
} catch (e) {
console.debug(e);
console.debug(e); // eslint-disable-line
}
})
.catch((e) => {
Expand All @@ -97,7 +97,7 @@ export default class DatabaseRoleEdit extends Component {
try {
this.router.transitionTo(SHOW_ROUTE, `role/${secretId}`);
} catch (e) {
console.debug(e);
console.debug(e); // eslint-disable-line
}
})
.catch((e) => {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/oidc-consent-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class OidcConsentBlockComponent extends Component {
});
return url;
} catch (e) {
console.debug('DEBUG: parsing url failed for', urlString);
console.debug('DEBUG: parsing url failed for', urlString); // eslint-disable-line
throw new Error('Invalid URL');
}
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/helpers/parse-pki-cert.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function parsePkiCert([model]) {
let cert_asn1 = asn1js.fromBER(stringToArrayBuffer(cert_der));
cert = new Certificate({ schema: cert_asn1.result });
} catch (error) {
console.debug('DEBUG: Parsing Certificate', error);
console.debug('DEBUG: Parsing Certificate', error); // eslint-disable-line
return {
can_parse: false,
};
Expand Down
4 changes: 2 additions & 2 deletions ui/app/routes/vault/cluster/clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export default class ClientsRoute extends Route {
});
return arrayOfModels;
} catch (e) {
console.debug(e);
console.debug(e); // eslint-disable-line
return [];
}
}

async model() {
let config = await this.store.queryRecord('clients/config', {}).catch((e) => {
console.debug(e);
console.debug(e); // eslint-disable-line
// swallowing error so activity can show if no config permissions
return {};
});
Expand Down
2 changes: 1 addition & 1 deletion ui/app/routes/vault/cluster/oidc-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class VaultClusterOidcProviderRoute extends Route {
});
return url;
} catch (e) {
console.debug('DEBUG: parsing url failed for', urlString);
console.debug('DEBUG: parsing url failed for', urlString); // eslint-disable-line
throw new Error('Invalid URL');
}
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/services/path-help.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default Service.extend({
})
.catch((err) => {
// TODO: we should handle the error better here
console.error(err);
console.error(err); // eslint-disable-line
});
},

Expand Down
2 changes: 1 addition & 1 deletion ui/lib/core/addon/components/replication-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default Component.extend({
// when DR and Performance is enabled on the same cluster,
// the states should always be the same
// we are leaving this console log statement to be sure
console.log('DR State: ', drState, 'Performance State: ', performanceState);
console.log('DR State: ', drState, 'Performance State: ', performanceState); // eslint-disable-line
}

return drState;
Expand Down
4 changes: 2 additions & 2 deletions ui/lib/core/addon/helpers/changelog-url-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function changelogUrlFor([version]) {
return url.concat(versionNumber);
}
} catch (e) {
console.log(e);
console.log('Cannot generate URL for version: ', version);
console.log(e); // eslint-disable-line
console.log('Cannot generate URL for version: ', version); // eslint-disable-line
}
return url;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ addSuccessHandler(function (registration) {
if (action === 'getToken') {
let token = getToken();
if (!token) {
console.error('Unable to retrieve Vault tokent');
console.error('Unable to retrieve Vault tokent'); // eslint-disable-line
}
port.postMessage({ token: token });
} else {
console.error('Unknown event', event);
console.error('Unknown event', event); // eslint-disable-line
port.postMessage({
error: 'Unknown request',
});
Expand Down
4 changes: 2 additions & 2 deletions ui/mirage/handlers/mfa-login.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const validationHandler = (schema, req) => {
limit:
'maximum TOTP validation attempts 4 exceeded the allowed attempts 3. Please try again in 15 seconds',
}[passcode] || 'failed to validate';
console.log(error);
console.log(error); // eslint-disable-line
return new Response(403, {}, { errors: [error] });
}
} else if (passcode) {
Expand All @@ -48,7 +48,7 @@ export const validationHandler = (schema, req) => {
}
return authResponses[mfa_request_id];
} catch (error) {
console.log(error);
console.log(error); // eslint-disable-line
return new Response(500, {}, { errors: ['Mirage Handler Error: /sys/mfa/validate'] });
}
};
Expand Down
2 changes: 1 addition & 1 deletion ui/testem.enos.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';

const vault_addr = process.env.VAULT_ADDR;
console.log('VAULT_ADDR=' + vault_addr);
console.log('VAULT_ADDR=' + vault_addr); // eslint-disable-line

module.exports = {
test_page: 'tests/index.html?hidepassed',
Expand Down
16 changes: 10 additions & 6 deletions ui/tests/acceptance/access/identity/_shared-alias-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const testAliasCRUD = async function (name, itemType, assert) {

idRow = aliasShowPage.rows.filterBy('hasLabel').filterBy('rowLabel', 'ID')[0];
aliasID = idRow.rowValue;
assert.equal(
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.aliases.show',
'navigates to the correct route'
Expand All @@ -38,7 +38,7 @@ export const testAliasCRUD = async function (name, itemType, assert) {

await aliasIndexPage.visit({ item_type: itemType });
await settled();
assert.equal(
assert.strictEqual(
aliasIndexPage.items.filterBy('name', name).length,
1,
`${itemType}: lists the entity in the entity list`
Expand All @@ -56,7 +56,11 @@ export const testAliasCRUD = async function (name, itemType, assert) {
`${itemType}: shows flash message`
);

assert.equal(aliasIndexPage.items.filterBy('id', aliasID).length, 0, `${itemType}: the row is deleted`);
assert.strictEqual(
aliasIndexPage.items.filterBy('id', aliasID).length,
0,
`${itemType}: the row is deleted`
);
};

export const testAliasDeleteFromForm = async function (name, itemType, assert) {
Expand All @@ -80,7 +84,7 @@ export const testAliasDeleteFromForm = async function (name, itemType, assert) {
aliasID = idRow.rowValue;
await aliasShowPage.edit();
await settled();
assert.equal(
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.aliases.edit',
`${itemType}: navigates to edit on create`
Expand All @@ -93,12 +97,12 @@ export const testAliasDeleteFromForm = async function (name, itemType, assert) {
aliasIndexPage.flashMessage.latestMessage.startsWith('Successfully deleted'),
`${itemType}: shows flash message`
);
assert.equal(
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.aliases.index',
`${itemType}: navigates to list page on delete`
);
assert.equal(
assert.strictEqual(
aliasIndexPage.items.filterBy('id', aliasID).length,
0,
`${itemType}: the row does not show in the list`
Expand Down
12 changes: 6 additions & 6 deletions ui/tests/acceptance/access/identity/_shared-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const testCRUD = async (name, itemType, assert) => {
showPage.flashMessage.latestMessage.startsWith('Successfully saved'),
`${itemType}: shows a flash message`
);
assert.equal(
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.show',
`${itemType}: navigates to show on create`
Expand All @@ -22,7 +22,7 @@ export const testCRUD = async (name, itemType, assert) => {

await indexPage.visit({ item_type: itemType });
await settled();
assert.equal(
assert.strictEqual(
indexPage.items.filterBy('name', name).length,
1,
`${itemType}: lists the entity in the entity list`
Expand All @@ -37,7 +37,7 @@ export const testCRUD = async (name, itemType, assert) => {
indexPage.flashMessage.latestMessage.startsWith('Successfully deleted'),
`${itemType}: shows flash message`
);
assert.equal(indexPage.items.filterBy('name', name).length, 0, `${itemType}: the row is deleted`);
assert.strictEqual(indexPage.items.filterBy('name', name).length, 0, `${itemType}: the row is deleted`);
};

export const testDeleteFromForm = async (name, itemType, assert) => {
Expand All @@ -55,7 +55,7 @@ export const testDeleteFromForm = async (name, itemType, assert) => {
await click('[data-test-tab-subnav="metadata"]');
assert.dom('.info-table-row').hasText('hello goodbye', 'Metadata shows on tab');
await showPage.edit();
assert.equal(
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.edit',
`${itemType}: navigates to edit on create`
Expand All @@ -69,12 +69,12 @@ export const testDeleteFromForm = async (name, itemType, assert) => {
indexPage.flashMessage.latestMessage.startsWith('Successfully deleted'),
`${itemType}: shows flash message`
);
assert.equal(
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.index',
`${itemType}: navigates to list page on delete`
);
assert.equal(
assert.strictEqual(
indexPage.items.filterBy('name', name).length,
0,
`${itemType}: the row does not show in the list`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module('Acceptance | /access/identity/entities/create', function (hooks) {

test('it visits the correct page', async function (assert) {
await page.visit({ item_type: 'entities' });
assert.equal(
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.create',
'navigates to the correct route'
Expand Down
12 changes: 10 additions & 2 deletions ui/tests/acceptance/access/identity/entities/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ module('Acceptance | /access/identity/entities', function (hooks) {

test('it renders the entities page', async function (assert) {
await page.visit({ item_type: 'entities' });
assert.equal(currentRouteName(), 'vault.cluster.access.identity.index', 'navigates to the correct route');
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.index',
'navigates to the correct route'
);
});

test('it renders the groups page', async function (assert) {
await page.visit({ item_type: 'groups' });
assert.equal(currentRouteName(), 'vault.cluster.access.identity.index', 'navigates to the correct route');
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.index',
'navigates to the correct route'
);
});
});
2 changes: 1 addition & 1 deletion ui/tests/acceptance/access/identity/groups/create-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module('Acceptance | /access/identity/groups/create', function (hooks) {

test('it visits the correct page', async function (assert) {
await page.visit({ item_type: 'groups' });
assert.equal(
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.identity.create',
'navigates to the correct route'
Expand Down
4 changes: 2 additions & 2 deletions ui/tests/acceptance/access/methods-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ module('Acceptance | /access/', function (hooks) {

test('it navigates', async function (assert) {
await page.visit();
assert.equal(currentRouteName(), 'vault.cluster.access.methods', 'navigates to the correct route');
assert.strictEqual(currentRouteName(), 'vault.cluster.access.methods', 'navigates to the correct route');
assert.ok(page.navLinks.objectAt(0).isActive, 'the first link is active');
assert.equal(page.navLinks.objectAt(0).text, 'Auth Methods');
assert.strictEqual(page.navLinks.objectAt(0).text, 'Auth Methods');
});
});
4 changes: 2 additions & 2 deletions ui/tests/acceptance/access/namespaces/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module('Acceptance | Enterprise | /access/namespaces', function (hooks) {
test('it navigates to namespaces page', async function (assert) {
assert.expect(1);
await page.visit();
assert.equal(
assert.strictEqual(
currentRouteName(),
'vault.cluster.access.namespaces.index',
'navigates to the correct route'
Expand All @@ -33,7 +33,7 @@ module('Acceptance | Enterprise | /access/namespaces', function (hooks) {
await page.visit();
const store = this.owner.lookup('service:store');
// Default page size is 15
assert.equal(store.peekAll('namespace').length, 15, 'Store has 15 namespaces records');
assert.strictEqual(store.peekAll('namespace').length, 15, 'Store has 15 namespaces records');
assert.dom('.list-item-row').exists({ count: 15 });
assert.dom('[data-test-list-view-pagination]').exists();
});
Expand Down
8 changes: 4 additions & 4 deletions ui/tests/acceptance/auth-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ module('Acceptance | auth', function (hooks) {
let backends = supportedAuthBackends();
assert.expect(backends.length + 1);
await visit('/vault/auth');
assert.equal(currentURL(), '/vault/auth?with=token');
assert.strictEqual(currentURL(), '/vault/auth?with=token');
for (let backend of backends.reverse()) {
await component.selectMethod(backend.type);
assert.equal(
assert.strictEqual(
currentURL(),
`/vault/auth?with=${backend.type}`,
`has the correct URL for ${backend.type}`
Expand All @@ -51,10 +51,10 @@ module('Acceptance | auth', function (hooks) {

test('it clears token when changing selected auth method', async function (assert) {
await visit('/vault/auth');
assert.equal(currentURL(), '/vault/auth?with=token');
assert.strictEqual(currentURL(), '/vault/auth?with=token');
await component.token('token').selectMethod('github');
await component.selectMethod('token');
assert.equal(component.tokenValue, '', 'it clears the token value when toggling methods');
assert.strictEqual(component.tokenValue, '', 'it clears the token value when toggling methods');
});

test('it sends the right attributes when authenticating', async function (assert) {
Expand Down
Loading