8000 feat: add strict option to CLI by achingbrain · Pull Request #119 · ipfs/protons · GitHub
[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add strict option to CLI #119

Merged
merged 5 commits into from
Oct 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: pass flags
  • Loadi 8000 ng branch information
achingbrain committed Oct 20, 2023
commit e19332aa145039a3c8a187bc379b03f3eeecf19d
8 changes: 4 additions & 4 deletions packages/protons/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ interface ModuleDef {
globals: Record<string, ClassDef>
}

function defineModule (def: ClassDef): ModuleDef {
function defineModule (def: ClassDef, flags: Flags): ModuleDef {
const moduleDef: ModuleDef = {
imports: new Set(),
importedTypes: new Set(),
Expand All @@ -619,7 +619,7 @@ function defineModule (def: ClassDef): ModuleDef {
throw new CodeError('No top-level messages found in protobuf', 'ERR_NO_MESSAGES_FOUND')
}

function defineMessage (defs: Record<string, ClassDef>, parent?: ClassDef): void {
function defineMessage (defs: Record<string, ClassDef>, parent?: ClassDef, flags?: Flags): void {
for (const className of Object.keys(defs)) {
const classDef = defs[className]

Expand Down Expand Up @@ -685,7 +685,7 @@ function defineModule (def: ClassDef): ModuleDef {
}
}

defineMessage(defs)
defineMessage(defs, undefined, flags)

// set enum/message fields now all messages have been defined
updateTypes(defs)
Expand Down Expand Up @@ -750,7 +750,7 @@ export async function generate (source: string, flags: Flags): Promise<void> {
}
}

const moduleDef = defineModule(def)
const moduleDef = defineModule(def, flags)

const ignores = [
'/* eslint-disable import/export */',
Expand Down
0