Skip to content

Commit 3f75020

Browse files
[UI] fix linter warnings (#23101)
* all tests fixed * code cleanup * fix minor issue * adds changelog * remove redundant fn usage * fixes assert equal issues * ppnpm lock update * avoid crashing on error * fixes lint issue * revert * test change * fix torii provider baseUrl assertion without changing SSO flow * linting fix * turn on linting rule classic-decorator-no-clasic-methods * turn on linting rule classic-decorator-hooks * turn on linting rule no-empty-glimmer-component-classes * turn on linting rule no-legacy-test-waiters * turn on linting rule ember/no-test-import-export * fix some instances of no-get * fixes for lint rule no-computed-properties-in-native-classes * fix lint rule require-computed-property-dependencies * turn on lint rule require-super-in-lifecycle-hooks * turn on lint rule require-computed-macros * fix deprecation implicit-injections * remove deprecated package usage @ember/error deprecate-ember-error
1 parent c61877a commit 3f75020

File tree

84 files changed

+420
-269
lines changed

Some content is hidden

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

84 files changed

+420
-269
lines changed

ui/packages/consul-ui/.eslintrc.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,25 @@ module.exports = {
3131
'ember/no-new-mixins': ['warn'],
3232

3333
// for 3.24 update
34-
'ember/classic-decorator-no-classic-methods': ['warn'],
35-
'ember/classic-decorator-hooks': ['warn'],
34+
'ember/classic-decorator-no-classic-methods': ['error'],
35+
'ember/classic-decorator-hooks': ['error'],
3636
'ember/no-classic-classes': ['warn'],
3737
'ember/no-mixins': ['warn'],
3838
'ember/no-computed-properties-in-native-classes': ['warn'],
3939
'ember/no-private-routing-service': ['warn'],
40-
'ember/no-test-import-export': ['warn'],
40+
'ember/no-test-import-export': ['error'],
4141
'ember/no-actions-hash': ['warn'],
4242
'ember/no-classic-components': ['warn'],
4343
'ember/no-component-lifecycle-hooks': ['warn'],
4444
'ember/require-tagless-components': ['warn'],
45-
'ember/no-legacy-test-waiters': ['warn'],
46-
'ember/no-empty-glimmer-component-classes': ['warn'],
45+
'ember/no-legacy-test-waiters': ['error'],
46+
'ember/no-empty-glimmer-component-classes': ['error'],
4747
'ember/no-get': ['off'], // be careful with autofix, might change behavior
48-
'ember/require-computed-property-dependencies': ['off'], // be careful with autofix
49-
'ember/use-ember-data-rfc-395-imports': ['off'], // be carful with autofix
50-
'ember/require-super-in-lifecycle-hooks': ['off'], // be careful with autofix
51-
'ember/require-computed-macros': ['off'], // be careful with autofix
48+
'ember/require-computed-property-dependencies': ['error'], // be careful with autofix
49+
'ember/use-ember-data-rfc-395-imports': ['error'], // be carful with autofix
50+
'ember/require-super-in-lifecycle-hooks': ['error'], // be careful with autofix
51+
'ember/require-computed-macros': ['error'], // be careful with autofix
52+
'ember/use-brace-expansion': 'off',
5253
},
5354
overrides: [
5455
// node files

ui/packages/consul-ui/app/abilities/base.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*/
55

66
import { inject as service } from '@ember/service';
7-
import { get } from '@ember/object';
87
import Ability from 'ember-can/ability';
8+
import classic from 'ember-classic-decorator';
99

1010
export const ACCESS_READ = 'read';
1111
export const ACCESS_WRITE = 'write';
@@ -18,6 +18,7 @@ export const ACCESS_LIST = 'list';
1818
// permissions list. This is also fine for permission inspection for single
1919
// items/models as we only request the permissions for the namespace you are
2020
// in, we don't need to recheck that namespace here
21+
@classic
2122
export default class BaseAbility extends Ability {
2223
@service('repository/permission') permissions;
2324

@@ -59,7 +60,7 @@ export default class BaseAbility extends Ability {
5960

6061
get canRead() {
6162
if (typeof this.item !== 'undefined') {
62-
const perm = (get(this, 'item.Resources') || []).find((item) => item.Access === ACCESS_READ);
63+
const perm = (this.item?.Resources || []).find((item) => item.Access === ACCESS_READ);
6364
if (perm) {
6465
return perm.Allow;
6566
}
@@ -69,7 +70,7 @@ export default class BaseAbility extends Ability {
6970

7071
get canList() {
7172
if (typeof this.item !== 'undefined') {
72-
const perm = (get(this, 'item.Resources') || []).find((item) => item.Access === ACCESS_LIST);
73+
const perm = (this.item?.Resources || []).find((item) => item.Access === ACCESS_LIST);
7374
if (perm) {
7475
return perm.Allow;
7576
}
@@ -79,7 +80,7 @@ export default class BaseAbility extends Ability {
7980

8081
get canWrite() {
8182
if (typeof this.item !== 'undefined') {
82-
const perm = (get(this, 'item.Resources') || []).find((item) => item.Access === ACCESS_WRITE);
83+
const perm = (this.item?.Resources || []).find((item) => item.Access === ACCESS_WRITE);
8384
if (perm) {
8485
return perm.Allow;
8586
}

ui/packages/consul-ui/app/abilities/intention.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55

66
import BaseAbility from './base';
7+
import classic from 'ember-classic-decorator';
78

9+
@classic
810
export default class IntentionAbility extends BaseAbility {
911
resource = 'intention';
1012

ui/packages/consul-ui/app/abilities/kv.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55

66
import BaseAbility, { ACCESS_LIST } from './base';
7+
import classic from 'ember-classic-decorator';
78

9+
@classic
810
export default class KVAbility extends BaseAbility {
911
resource = 'key';
1012

ui/packages/consul-ui/app/abilities/node.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
* SPDX-License-Identifier: BUSL-1.1
44
*/
55

6+
import classic from 'ember-classic-decorator';
67
import BaseAbility from './base';
78

9+
@classic
810
export default class NodeAbility extends BaseAbility {
911
resource = 'node';
1012
}

ui/packages/consul-ui/app/abilities/permission.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55

66
import BaseAbility from './base';
7+
import classic from 'ember-classic-decorator';
78

9+
@classic
810
export default class PermissionAbility extends BaseAbility {
911
get canRead() {
1012
return this.permissions.permissions.length > 0;

ui/packages/consul-ui/app/abilities/server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55

66
import BaseAbility from './base';
7+
import classic from 'ember-classic-decorator';
78

9+
@classic
810
export default class ServerAbility extends BaseAbility {
911
resource = 'operator';
1012
segmented = false;

ui/packages/consul-ui/app/abilities/service-instance.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55

66
import BaseAbility, { ACCESS_READ, ACCESS_WRITE } from './base';
7+
import classic from 'ember-classic-decorator';
78

9+
@classic
810
export default class ServiceInstanceAbility extends BaseAbility {
911
resource = 'service';
1012
generateForSegment(segment) {

ui/packages/consul-ui/app/abilities/session.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55

66
import BaseAbility from './base';
7+
import classic from 'ember-classic-decorator';
78

9+
@classic
810
export default class SessionAbility extends BaseAbility {
911
resource = 'session';
1012
}

ui/packages/consul-ui/app/abilities/upstream.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55

66
import BaseAbility from './base';
7+
import classic from 'ember-classic-decorator';
78

9+
@classic
810
export default class UpstreamAbility extends BaseAbility {
911
resource = 'upstream';
1012

0 commit comments

Comments
 (0)