Skip to content

Commit

Permalink
Enable prefer-as-const rule
Browse files Browse the repository at this point in the history
  • Loading branch information
dansteren committed Dec 1, 2023
1 parent 7f499e4 commit 7489041
Show file tree
Hide file tree
Showing 24 changed files with 45 additions and 46 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const temporarilyDisabledRules = {
'@typescript-eslint/no-explicit-any': 'off', // 321 problems
'@typescript-eslint/no-unused-vars': 'off', // 33 problems
'@typescript-eslint/no-var-requires': 'off', // 8 problems
'@typescript-eslint/prefer-as-const': 'off', // 45 problems
'no-constant-condition': 'off', // 1 problem
'no-undef': 'off', // 11 problems
'no-var': 'off', // 6 problems
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/constructed/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode';
import { encode } from '../../serde/encode';

export class AzleBlob {
_azleKind: 'AzleBlob' = 'AzleBlob';
static _azleKind: 'AzleBlob' = 'AzleBlob';
_azleKind = 'AzleBlob' as const;
static _azleKind = 'AzleBlob' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/constructed/opt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export class AzleOpt<T> {

innerType: CandidType;

_azleKind: 'AzleOpt' = 'AzleOpt';
static _azleKind: 'AzleOpt' = 'AzleOpt';
_azleKind = 'AzleOpt' as const;
static _azleKind = 'AzleOpt' as const;

toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/constructed/tuple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export class AzleTuple<T extends any[]> {

innerTypes: CandidType[];

_azleKind: 'AzleTuple' = 'AzleTuple';
static _azleKind: 'AzleTuple' = 'AzleTuple';
_azleKind = 'AzleTuple' as const;
static _azleKind = 'AzleTuple' as const;

toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/constructed/vec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export class AzleVec<T> {

innerType: CandidType;

_azleKind: 'AzleVec' = 'AzleVec';
static _azleKind: 'AzleVec' = 'AzleVec';
_azleKind = 'AzleVec' as const;
static _azleKind = 'AzleVec' as const;

toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/bool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode';
import { encode } from '../../serde/encode';

export class AzleBool {
_azleKind: 'AzleBool' = 'AzleBool';
static _azleKind: 'AzleBool' = 'AzleBool';
_azleKind = 'AzleBool' as const;
static _azleKind = 'AzleBool' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/empty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode';
import { encode } from '../../serde/encode';

export class AzleEmpty {
_azleKind: 'AzleEmpty' = 'AzleEmpty';
static _azleKind: 'AzleEmpty' = 'AzleEmpty';
_azleKind = 'AzleEmpty' as const;
static _azleKind = 'AzleEmpty' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/floats/float32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleFloat32 {
_azleKind: 'AzleFloat32' = 'AzleFloat32';
static _azleKind: 'AzleFloat32' = 'AzleFloat32';
_azleKind = 'AzleFloat32' as const;
static _azleKind = 'AzleFloat32' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/floats/float64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleFloat64 {
_azleKind: 'AzleFloat64' = 'AzleFloat64';
static _azleKind: 'AzleFloat64' = 'AzleFloat64';
_azleKind = 'AzleFloat64' as const;
static _azleKind = 'AzleFloat64' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/ints/int.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleInt {
_azleKind: 'AzleInt' = 'AzleInt';
static _azleKind: 'AzleInt' = 'AzleInt';
_azleKind = 'AzleInt' as const;
static _azleKind = 'AzleInt' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/ints/int16.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleInt16 {
_azleKind: 'AzleInt16' = 'AzleInt16';
static _azleKind: 'AzleInt16' = 'AzleInt16';
_azleKind = 'AzleInt16' as const;
static _azleKind = 'AzleInt16' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/ints/int32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleInt32 {
_azleKind: 'AzleInt32' = 'AzleInt32';
static _azleKind: 'AzleInt32' = 'AzleInt32';
_azleKind = 'AzleInt32' as const;
static _azleKind = 'AzleInt32' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/ints/int64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleInt64 {
_azleKind: 'AzleInt64' = 'AzleInt64';
static _azleKind: 'AzleInt64' = 'AzleInt64';
_azleKind = 'AzleInt64' as const;
static _azleKind = 'AzleInt64' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/ints/int8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleInt8 {
_azleKind: 'AzleInt8' = 'AzleInt8';
static _azleKind: 'AzleInt8' = 'AzleInt8';
_azleKind = 'AzleInt8' as const;
static _azleKind = 'AzleInt8' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/nats/nat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleNat {
_azleKind: 'AzleNat' = 'AzleNat';
static _azleKind: 'AzleNat' = 'AzleNat';
_azleKind = 'AzleNat' as const;
static _azleKind = 'AzleNat' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/nats/nat16.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleNat16 {
_azleKind: 'AzleNat16' = 'AzleNat16';
static _azleKind: 'AzleNat16' = 'AzleNat16';
_azleKind = 'AzleNat16' as const;
static _azleKind = 'AzleNat16' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/nats/nat32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleNat32 {
_azleKind: 'AzleNat32' = 'AzleNat32';
static _azleKind: 'AzleNat32' = 'AzleNat32';
_azleKind = 'AzleNat32' as const;
static _azleKind = 'AzleNat32' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/nats/nat64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleNat64 {
_azleKind: 'AzleNat64' = 'AzleNat64';
static _azleKind: 'AzleNat64' = 'AzleNat64';
_azleKind = 'AzleNat64' as const;
static _azleKind = 'AzleNat64' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/nats/nat8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode';
import { encode } from '../../../serde/encode';

export class AzleNat8 {
_azleKind: 'AzleNat8' = 'AzleNat8';
static _azleKind: 'AzleNat8' = 'AzleNat8';
_azleKind = 'AzleNat8' as const;
static _azleKind = 'AzleNat8' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/null.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode';
import { encode } from '../../serde/encode';

export class AzleNull {
_azleKind: 'AzleNull' = 'AzleNull';
static _azleKind: 'AzleNull' = 'AzleNull';
_azleKind = 'AzleNull' as const;
static _azleKind = 'AzleNull' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/reserved.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode';
import { encode } from '../../serde/encode';

export class AzleReserved {
_azleKind: 'AzleReserved' = 'AzleReserved';
static _azleKind: 'AzleReserved' = 'AzleReserved';
_azleKind = 'AzleReserved' as const;
static _azleKind = 'AzleReserved' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode';
import { encode } from '../../serde/encode';

export class AzleText {
_azleKind: 'AzleText' = 'AzleText';
static _azleKind: 'AzleText' = 'AzleText';
_azleKind = 'AzleText' as const;
static _azleKind = 'AzleText' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/types/primitive/void.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode';
import { encode } from '../../serde/encode';

export class AzleVoid {
_azleKind: 'AzleVoid' = 'AzleVoid';
static _azleKind: 'AzleVoid' = 'AzleVoid';
_azleKind = 'AzleVoid' as const;
static _azleKind = 'AzleVoid' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/reference/principal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { encode } from '../../serde/encode';
import { Parent } from '../../to_idl';

export class Principal extends DfinityPrincipal {
static _azleKind: 'Principal' = 'Principal';
static _azleKind = 'Principal' as const;

static toBytes(data: any) {
return encode(this, data);
Expand Down

0 comments on commit 7489041

Please sign in to comment.