Skip to content

Commit ec6d02f

Browse files
authored
Merge pull request #160 from hyperweb-io/lint-fix
Make "yarn lint" and "yarn format" work in this codebase
2 parents 30f606f + 6d78aaa commit ec6d02f

File tree

99 files changed

+2177
-2046
lines changed

Some content is hidden

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

99 files changed

+2177
-2046
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
dist/

.eslintrc.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
"unused-imports"
2323
],
2424
"rules": {
25-
"indent": [
26-
"error",
27-
2
28-
],
25+
"indent": "off", // prettier takes care of this (yarn format)
2926
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
3027
"quote-props": ["error", "as-needed"],
3128
"semi": ["error", "always"],

.prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"trailingComma": "es5",
33
"tabWidth": 2,
44
"semi": true,
5-
"singleQuote": false
5+
"singleQuote": true
66
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"build": "lerna run build --stream",
1111
"test": "lerna run test --stream",
1212
"lint": "lerna run lint --parallel",
13+
"format": "lerna run format --parallel",
1314
"symlink": "symlink-workspace --logLevel error",
1415
"postinstall": "yarn symlink"
1516
},
@@ -22,15 +23,15 @@
2223
"@typescript-eslint/parser": "^7.10.0",
2324
"copyfiles": "^2.4.1",
2425
"eslint": "^8.56.0",
25-
"eslint-config-prettier": "^9.1.0",
26+
"eslint-config-prettier": "^10.1.5",
2627
"eslint-plugin-simple-import-sort": "^12.1.0",
2728
"eslint-plugin-unused-imports": "^4.0.0",
2829
"glob": "8.0.3",
2930
"jest": "^29.6.2",
3031
"jest-in-case": "^1.0.2",
3132
"lerna": "^6",
3233
"mkdirp": "1.0.2",
33-
"prettier": "^3.0.2",
34+
"prettier": "^3.6.0",
3435
"rimraf": "4.4.1",
3536
"strip-ansi": "^6",
3637
"symlink-workspace": "^1.9.0",

packages/ast/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.eslintignore

packages/ast/__tests__/babel/babel.test.ts

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
classDeclaration,
88
classProperty,
99
promiseTypeAnnotation,
10-
typedIdentifier
10+
typedIdentifier,
1111
} from '../../src/utils/babel';
1212
import { expectCode } from '../../test-utils';
1313

@@ -54,12 +54,12 @@ it('interfaces', async () => {
5454
'limit',
5555
t.tsTypeAnnotation(t.tsStringKeyword()),
5656
true
57-
)
57+
),
5858
],
5959
promiseTypeAnnotation('TokensResponse')
6060
)
6161
)
62-
)
62+
),
6363
])
6464
)
6565
),
@@ -73,7 +73,7 @@ it('interfaces', async () => {
7373
[
7474
t.tSExpressionWithTypeArguments(
7575
t.identifier('SG721ReadOnlyInstance')
76-
)
76+
),
7777
],
7878
t.tSInterfaceBody([
7979
// contract address
@@ -101,15 +101,15 @@ it('interfaces', async () => {
101101
typedIdentifier(
102102
'prop3',
103103
t.tsTypeAnnotation(t.tsStringKeyword())
104-
)
104+
),
105105
],
106106
promiseTypeAnnotation('ExecuteResult')
107107
)
108108
)
109-
)
109+
),
110110
])
111111
)
112-
)
112+
),
113113
])
114114
);
115115
});
@@ -149,7 +149,7 @@ it('readonly classes', async () => {
149149
typedIdentifier(
150150
'contractAddress',
151151
t.tsTypeAnnotation(t.tsStringKeyword())
152-
)
152+
),
153153
],
154154
t.blockStatement([
155155
// client/contract set
@@ -178,7 +178,7 @@ it('readonly classes', async () => {
178178
bindMethod('approval'),
179179
bindMethod('otherProp'),
180180
bindMethod('hello'),
181-
bindMethod('mintme')
181+
bindMethod('mintme'),
182182
])
183183
),
184184

@@ -196,7 +196,7 @@ it('readonly classes', async () => {
196196
typedIdentifier(
197197
'spender',
198198
t.tsTypeAnnotation(t.tsStringKeyword())
199-
)
199+
),
200200
],
201201
t.blockStatement([
202202
t.returnStatement(
@@ -227,31 +227,31 @@ it('readonly classes', async () => {
227227
t.identifier('spender'),
228228
false,
229229
true
230-
)
231-
])
230+
),
231+
]),
232232
]
233233
)
234-
)
234+
),
235235
]),
236236
t.tsTypeAnnotation(
237237
t.tsTypeReference(
238238
t.identifier('Promise'),
239239
t.tsTypeParameterInstantiation([
240-
t.tSTypeReference(t.identifier('ApprovalResponse'))
240+
t.tSTypeReference(t.identifier('ApprovalResponse')),
241241
])
242242
)
243243
),
244244
true
245245
)
246-
)
246+
),
247247
],
248248
[
249249
t.tSExpressionWithTypeArguments(
250250
t.identifier('SG721ReadOnlyInstance')
251-
)
251+
),
252252
]
253253
)
254-
)
254+
),
255255
])
256256
);
257257
});
@@ -291,14 +291,14 @@ it('mutation classes', async () => {
291291
typedIdentifier(
292292
'contractAddress',
293293
t.tsTypeAnnotation(t.tsStringKeyword())
294-
)
294+
),
295295
],
296296
t.blockStatement([
297297
// super()
298298
t.expressionStatement(
299299
t.callExpression(t.super(), [
300300
t.identifier('client'),
301-
t.identifier('contractAddress')
301+
t.identifier('contractAddress'),
302302
])
303303
),
304304

@@ -328,7 +328,7 @@ it('mutation classes', async () => {
328328
bindMethod('approval'),
329329
bindMethod('otherProp'),
330330
bindMethod('hello'),
331-
bindMethod('mintme')
331+
bindMethod('mintme'),
332332
])
333333
),
334334

@@ -353,7 +353,7 @@ it('mutation classes', async () => {
353353
typedIdentifier(
354354
'token_uri',
355355
t.tsTypeAnnotation(t.tsStringKeyword())
356-
)
356+
),
357357
],
358358
t.blockStatement([
359359
t.returnStatement(
@@ -391,37 +391,37 @@ it('mutation classes', async () => {
391391
t.objectProperty(
392392
t.identifier('expression'),
393393
t.objectExpression([])
394-
)
394+
),
395395
])
396-
)
396+
),
397397
]),
398-
t.stringLiteral('auto')
398+
t.stringLiteral('auto'),
399399
]
400400
)
401401
)
402-
)
402+
),
403403
]),
404404
// return type
405405
t.tsTypeAnnotation(
406406
t.tsTypeReference(
407407
t.identifier('Promise'),
408408
t.tsTypeParameterInstantiation([
409-
t.tSTypeReference(t.identifier('ExecuteResult'))
409+
t.tSTypeReference(t.identifier('ExecuteResult')),
410410
])
411411
)
412412
),
413413
true
414414
)
415-
)
415+
),
416416
],
417417
[
418418
t.tSExpressionWithTypeArguments(
419419
t.identifier('SG721ReadOnlyInstance')
420-
)
420+
),
421421
],
422422
t.identifier('SG721QueryClient')
423423
)
424-
)
424+
),
425425
])
426426
);
427427
});
@@ -439,7 +439,7 @@ it('object parms', () => {
439439
t.identifier('tokenId'),
440440
false,
441441
true
442-
)
442+
),
443443
]);
444444
obj.typeAnnotation = t.tsTypeAnnotation(
445445
t.tsTypeLiteral([
@@ -450,7 +450,7 @@ it('object parms', () => {
450450
t.tsPropertySignature(
451451
t.identifier('tokenId'),
452452
t.tsTypeAnnotation(t.tsStringKeyword())
453-
)
453+
),
454454
])
455455
);
456456
expectCode(
@@ -471,13 +471,13 @@ it('object parms', () => {
471471
t.tsTypeReference(
472472
t.identifier('Promise'),
473473
t.tsTypeParameterInstantiation([
474-
t.tsTypeReference(t.identifier('OwnerOfResponse'))
474+
t.tsTypeReference(t.identifier('OwnerOfResponse')),
475475
])
476476
)
477477
)
478478
)
479479
)
480-
)
480+
),
481481
])
482482
);
483483
});

packages/ast/__tests__/client/ts-client.account-nfts.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
createExecuteClass,
66
createExecuteInterface,
77
createQueryClass,
8-
createTypeInterface
8+
createTypeInterface,
99
} from '../../src';
1010
import { expectCode, makeContext } from '../../test-utils';
1111

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,34 @@
11
import {
22
createExecuteClass,
33
createExecuteInterface,
4-
createQueryClass} from '../../src';
5-
import { expectCode, getMsgExecuteLegacyFixture, getMsgQueryLegacyFixture, makeContext } from '../../test-utils';
4+
createQueryClass,
5+
} from '../../src';
6+
import {
7+
expectCode,
8+
getMsgExecuteLegacyFixture,
9+
getMsgQueryLegacyFixture,
10+
makeContext,
11+
} from '../../test-utils';
612
const queryMsg = getMsgQueryLegacyFixture('misc/schema', '/arrays.json');
713
const execMsg = getMsgExecuteLegacyFixture('misc/schema', '/arrays.json');
814
const ctx = makeContext(queryMsg, {
915
types: {
10-
itemsUseTuples: true
11-
}
16+
itemsUseTuples: true,
17+
},
1218
});
1319

1420
it('query classes', () => {
15-
expectCode(createQueryClass(
16-
ctx,
17-
'SG721QueryClient',
18-
'SG721ReadOnlyInstance',
19-
queryMsg
20-
));
21+
expectCode(
22+
createQueryClass(ctx, 'SG721QueryClient', 'SG721ReadOnlyInstance', queryMsg)
23+
);
2124
});
2225

2326
it('execute classes array types', () => {
24-
expectCode(createExecuteClass(
25-
ctx,
26-
'SG721Client',
27-
'SG721Instance',
28-
null,
29-
execMsg
30-
));
27+
expectCode(
28+
createExecuteClass(ctx, 'SG721Client', 'SG721Instance', null, execMsg)
29+
);
3130
});
3231

3332
it('execute interfaces no extends', () => {
34-
expectCode(createExecuteInterface(
35-
ctx,
36-
'SG721Instance',
37-
null,
38-
execMsg
39-
));
33+
expectCode(createExecuteInterface(ctx, 'SG721Instance', null, execMsg));
4034
});

0 commit comments

Comments
 (0)