Skip to content

Commit

Permalink
prettier trailing comma across orakl (#1734)
Browse files Browse the repository at this point in the history
* prettier trailing comma in core

* prettier trailing comma in vrf

* prettier trailing comma in cli

* prettier trailing comma in util

* prettier trailing comma in l2-api

* prettier trailing comma in fetcher

* prettier trailing comma in contracts v01
  • Loading branch information
Intizar-T authored Jul 5, 2024
1 parent b1a6b61 commit 912bea2
Show file tree
Hide file tree
Showing 220 changed files with 1,988 additions and 2,091 deletions.
14 changes: 3 additions & 11 deletions cli/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": [
"prettier",
"@typescript-eslint",
"import"
],
"plugins": ["prettier", "@typescript-eslint", "import"],
"rules": {
"no-throw-literal": "error",
"prettier/prettier": [
"error"
],
"prettier/prettier": ["error"],
"@typescript-eslint/ban-ts-comment": "off",
"import/extensions": [
"error",
Expand All @@ -35,9 +29,7 @@
}
}
],
"ignorePatterns": [
"src/cli/orakl-cli/dist/**"
],
"ignorePatterns": ["src/cli/orakl-cli/dist/**"],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2022,
Expand Down
2 changes: 1 addition & 1 deletion cli/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"useTabs": false,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"trailingComma": "all",
"printWidth": 100,
"semi": false
}
10 changes: 5 additions & 5 deletions cli/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const jestConfig: JestConfigWithTsJest = {
verbose: true,
preset: 'ts-jest/presets/default-esm',
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
'^.+\\.(t|j)s$': [
'ts-jest',
{
useESM: true
}
]
useESM: true,
},
],
},
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: '.',
Expand All @@ -26,7 +26,7 @@ const jestConfig: JestConfigWithTsJest = {
testEnvironment: 'node',
maxConcurrency: 1,
maxWorkers: 1,
bail: true
bail: true,
}

export default jestConfig
22 changes: 11 additions & 11 deletions cli/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,46 @@ export function adapterSub() {
const list = command({
name: 'list',
args: {},
handler: listHandler(true)
handler: listHandler(true),
})

const insert = command({
name: 'insert',
args: {
data: option({
type: ReadFile,
long: 'source'
})
long: 'source',
}),
},
handler: insertHandler()
handler: insertHandler(),
})

const remove = command({
name: 'remove',
args: {
id: idOption
id: idOption,
},
handler: removeHandler()
handler: removeHandler(),
})

const hash = command({
name: 'hash',
args: {
verify: flag({
type: cmdboolean,
long: 'verify'
long: 'verify',
}),
data: option({
type: ReadFile,
long: 'source'
})
long: 'source',
}),
},
handler: hashHandler()
handler: hashHandler(),
})

return subcommands({
name: 'adapter',
cmds: { list, insert, remove, hash }
cmds: { list, insert, remove, hash },
})
}

Expand Down
72 changes: 36 additions & 36 deletions cli/src/aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
flag,
option,
string as cmdstring,
subcommands
subcommands,
} from 'cmd-ts'
import { IAggregator, ReadFile } from './cli-types.js'
import { ORAKL_NETWORK_API_URL, WORKER_SERVICE_HOST, WORKER_SERVICE_PORT } from './settings.js'
Expand All @@ -15,7 +15,7 @@ import {
fetcherTypeOptionalOption,
idOption,
isOraklNetworkApiHealthy,
isServiceHealthy
isServiceHealthy,
} from './utils.js'

const AGGREGATOR_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'aggregator')
Expand All @@ -33,50 +33,50 @@ export function aggregatorSub() {
name: 'list',
args: {
active: flag({
long: 'active'
long: 'active',
}),
chain: chainOptionalOption
chain: chainOptionalOption,
},
handler: listHandler(true)
handler: listHandler(true),
})

const insert = command({
name: 'insert',
args: {
data: option({
type: ReadFile,
long: 'source'
long: 'source',
}),
chain: option({
type: cmdstring,
long: 'chain'
long: 'chain',
}),
fetcherType: fetcherTypeOptionalOption
fetcherType: fetcherTypeOptionalOption,
},
handler: insertHandler()
handler: insertHandler(),
})

const remove = command({
name: 'remove',
args: {
id: idOption
id: idOption,
},
handler: removeHandler()
handler: removeHandler(),
})

const hash = command({
name: 'hash',
args: {
verify: flag({
type: cmdboolean,
long: 'verify'
long: 'verify',
}),
data: option({
type: ReadFile,
long: 'source'
})
long: 'source',
}),
},
handler: hashHandler()
handler: hashHandler(),
})

const active = command({
Expand All @@ -85,36 +85,36 @@ export function aggregatorSub() {
host: option({
type: cmdstring,
long: 'host',
defaultValue: () => WORKER_SERVICE_HOST
defaultValue: () => WORKER_SERVICE_HOST,
}),
port: option({
type: cmdstring,
long: 'port',
defaultValue: () => String(WORKER_SERVICE_PORT)
})
defaultValue: () => String(WORKER_SERVICE_PORT),
}),
},
handler: activeHandler()
handler: activeHandler(),
})

const activate = command({
name: 'activate',
args: {
aggregatorHash: option({
type: cmdstring,
long: 'aggregatorHash'
long: 'aggregatorHash',
}),
host: option({
type: cmdstring,
long: 'host',
defaultValue: () => WORKER_SERVICE_HOST
defaultValue: () => WORKER_SERVICE_HOST,
}),
port: option({
type: cmdstring,
long: 'port',
defaultValue: () => String(WORKER_SERVICE_PORT)
})
defaultValue: () => String(WORKER_SERVICE_PORT),
}),
},
handler: activateHandler()
handler: activateHandler(),
})

const deactivate = command({
Expand All @@ -123,25 +123,25 @@ export function aggregatorSub() {
args: {
aggregatorHash: option({
type: cmdstring,
long: 'aggregatorHash'
long: 'aggregatorHash',
}),
host: option({
type: cmdstring,
long: 'host',
defaultValue: () => WORKER_SERVICE_HOST
defaultValue: () => WORKER_SERVICE_HOST,
}),
port: option({
type: cmdstring,
long: 'port',
defaultValue: () => String(WORKER_SERVICE_PORT)
})
defaultValue: () => String(WORKER_SERVICE_PORT),
}),
},
handler: deactivateHandler()
handler: deactivateHandler(),
})

return subcommands({
name: 'aggregator',
cmds: { list, insert, remove, hash, active, activate, deactivate }
cmds: { list, insert, remove, hash, active, activate, deactivate },
})
}

Expand Down Expand Up @@ -181,7 +181,7 @@ export function insertHandler() {
async function wrapper({
data,
chain,
fetcherType
fetcherType,
}: {
data
chain: string
Expand Down Expand Up @@ -225,7 +225,7 @@ export function hashHandler() {
const aggregator = data as IAggregator
const aggregatorWithCorrectHash = (
await axios.post(endpoint, aggregator, {
params: { verify }
params: { verify },
})
).data
console.dir(aggregatorWithCorrectHash, { depth: null })
Expand Down Expand Up @@ -262,7 +262,7 @@ export function activateHandler() {
async function wrapper({
host,
port,
aggregatorHash
aggregatorHash,
}: {
host: string
port: string
Expand All @@ -273,7 +273,7 @@ export function activateHandler() {

const activateAggregatorEndpoint = buildUrl(
aggregatorServiceEndpoint,
`activate/${aggregatorHash}`
`activate/${aggregatorHash}`,
)

try {
Expand All @@ -292,7 +292,7 @@ export function deactivateHandler() {
async function wrapper({
host,
port,
aggregatorHash
aggregatorHash,
}: {
host: string
port: string
Expand All @@ -303,7 +303,7 @@ export function deactivateHandler() {

const deactivateAggregatorEndpoint = buildUrl(
aggregatorServiceEndpoint,
`deactivate/${aggregatorHash}`
`deactivate/${aggregatorHash}`,
)

try {
Expand Down
14 changes: 7 additions & 7 deletions cli/src/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ export function chainSub() {
const list = command({
name: 'list',
args: {},
handler: listHandler(true)
handler: listHandler(true),
})

const insert = command({
name: 'insert',
args: {
name: option({
type: cmdstring,
long: 'name'
})
long: 'name',
}),
},
handler: insertHandler()
handler: insertHandler(),
})

const remove = command({
name: 'remove',
args: {
id: idOption
id: idOption,
},
handler: removeHandler()
handler: removeHandler(),
})

return subcommands({
name: 'chain',
cmds: { list, insert, remove }
cmds: { list, insert, remove },
})
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/cli-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function readFileFromSource(source: string) {
export const ReadFile: Type<string, string> = {
async from(source) {
return await readFileFromSource(source)
}
},
}

export interface ITransaction {
Expand Down
Loading

0 comments on commit 912bea2

Please sign in to comment.