From 45b5742973224aa5f06f4e7a4d1fc208984e2ccf Mon Sep 17 00:00:00 2001 From: John Cowen Date: Wed, 5 Jan 2022 16:56:26 +0000 Subject: [PATCH] ui: Add selective no-console eslint rule (#11938) --- ui/packages/consul-ui/.dev.eslintrc.js | 8 -------- ui/packages/consul-ui/.eslintrc.js | 1 + ui/packages/consul-ui/app/locations/fsm-with-optional.js | 2 +- .../auth-providers/oauth2-code-with-url-provider.js | 7 +++---- ui/packages/consul-ui/package.json | 1 - 5 files changed, 5 insertions(+), 14 deletions(-) delete mode 100644 ui/packages/consul-ui/.dev.eslintrc.js diff --git a/ui/packages/consul-ui/.dev.eslintrc.js b/ui/packages/consul-ui/.dev.eslintrc.js deleted file mode 100644 index 0cf0f31ed..000000000 --- a/ui/packages/consul-ui/.dev.eslintrc.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - extends: ['./.eslintrc.js'], - rules: { - 'no-console': 'warn', - 'no-unused-vars': ['error', { args: 'none' }], - 'ember/routes-segments-snake-case': 'warn', - }, -}; diff --git a/ui/packages/consul-ui/.eslintrc.js b/ui/packages/consul-ui/.eslintrc.js index 0daee7958..994b78a24 100644 --- a/ui/packages/consul-ui/.eslintrc.js +++ b/ui/packages/consul-ui/.eslintrc.js @@ -14,6 +14,7 @@ module.exports = { browser: true, }, rules: { + 'no-console': ['error', {allow: ['error', 'info']}], 'no-unused-vars': ['error', { args: 'none' }], 'ember/no-new-mixins': ['warn'], 'ember/no-jquery': 'warn', diff --git a/ui/packages/consul-ui/app/locations/fsm-with-optional.js b/ui/packages/consul-ui/app/locations/fsm-with-optional.js index 19ed18da3..1e4feb839 100644 --- a/ui/packages/consul-ui/app/locations/fsm-with-optional.js +++ b/ui/packages/consul-ui/app/locations/fsm-with-optional.js @@ -240,7 +240,7 @@ export default class FSMWithOptionalLocation { */ transitionTo(url) { if (this.router.currentRouteName.startsWith('docs') && url.startsWith('console://')) { - console.log(`location.transitionTo: ${url.substr(10)}`); + console.info(`location.transitionTo: ${url.substr(10)}`); return true; } const previousOptional = Object.entries(this.optionalParams()); diff --git a/ui/packages/consul-ui/app/services/auth-providers/oauth2-code-with-url-provider.js b/ui/packages/consul-ui/app/services/auth-providers/oauth2-code-with-url-provider.js index f7a4cf7ca..69aa83f74 100644 --- a/ui/packages/consul-ui/app/services/auth-providers/oauth2-code-with-url-provider.js +++ b/ui/packages/consul-ui/app/services/auth-providers/oauth2-code-with-url-provider.js @@ -2,7 +2,6 @@ import OAuth2CodeProvider from 'torii/providers/oauth2-code'; import { runInDebug } from '@ember/debug'; export default class OAuth2CodeWithURLProvider extends OAuth2CodeProvider { - name = 'oidc-with-url'; buildUrl() { @@ -23,7 +22,9 @@ export default class OAuth2CodeWithURLProvider extends OAuth2CodeProvider { authorizationCode: decodeURIComponent(authData[responseType]), provider: name, }; - runInDebug(_ => console.log('Retrieved the following creds from the OAuth Provider', creds)) + runInDebug(_ => + console.info('Retrieved the following creds from the OAuth Provider', creds) + ); return creds; }); } @@ -34,6 +35,4 @@ export default class OAuth2CodeWithURLProvider extends OAuth2CodeProvider { return popup.close(); } } - } - diff --git a/ui/packages/consul-ui/package.json b/ui/packages/consul-ui/package.json index 0eb5ff1e8..5c4035202 100644 --- a/ui/packages/consul-ui/package.json +++ b/ui/packages/consul-ui/package.json @@ -16,7 +16,6 @@ "lint": "FORCE_COLOR=1 npm-run-all --aggregate-output --continue-on-error --parallel lint:*", "lint:hbs": "ember-template-lint .", "lint:js": "eslint .", - "_lint:dev:js": "eslint -c .dev.eslintrc.js --fix ./*.js ./.*.js app config lib server tests", "format": "npm-run-all format:*", "format:js": "prettier --write \"{app,config,lib,server,vendor,tests}/**/*.js\" ./*.js ./.*.js", "format:sass": "prettier --write \"app/**/*.scss\"",