Skip to content

Add ignore js flag to format subcommand#2227

Open
andres-lowrie wants to merge 1 commit into
dataform-co:mainfrom
andres-lowrie:format-ignore-js-2
Open

Add ignore js flag to format subcommand#2227
andres-lowrie wants to merge 1 commit into
dataform-co:mainfrom
andres-lowrie:format-ignore-js-2

Conversation

@andres-lowrie

Copy link
Copy Markdown
Contributor

Updated for latest changes (from #1349)

Allows users to only format .sqlx files in case they use different formatters for js files.

@andres-lowrie
andres-lowrie requested a review from a team as a code owner July 18, 2026 20:39
@andres-lowrie
andres-lowrie requested review from zaptot and removed request for a team July 18, 2026 20:39
@google-cla

google-cla Bot commented Jul 18, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@apilaskowski apilaskowski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets also add missing tests.

  1. dataform format --help includes --ignore-js-files.
  2. running dataform format --ignore-js-files formats .sqlx files without modifying .js files.

Comment thread cli/index.ts
format: `format [${projectDirMustExistOption.name}]`,
description: "Format the dataform project's files.",
positionalOptions: [projectDirMustExistOption],
options: [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add fmtIgnoreJsOptionName to the options list for the format subcommand builder.

Comment thread cli/index.ts
],
processFn: async argv => {
let actions = ["{definitions,includes}/**/*.{js,sqlx}"];
const extensions = argv[fmtIgnoreJsOptionName.name] ? "*.sqlx" : "*.{js,sqlx}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon?

Comment thread cli/index.ts
},
};

const fmtIgnoreJsOptionName: INamedOption<yargs.Options> = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets drop Name suffix for consistency. Options generally have option suffix, while name is generally used for strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants