Skip to content

Commit

Permalink
ci: Integrate prettier formatting (#376)
Browse files Browse the repository at this point in the history
So far, the code formatting was not checked by the CI. Now it is. To do
so, this commit introduces a new `format-check` npm command. I did not
use the `eslint-prettier` plugin because the guidance on
https://prettier.io/docs/en/integrating-with-linters.html recommends
against doing so.
  • Loading branch information
vogelsgesang authored Apr 10, 2024
1 parent 4f1057d commit 8235b63
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 9 deletions.
6 changes: 1 addition & 5 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ tasks:
- npm ci
- npm run compile
- npm run check-lint
# TODO(allevato): Add a prettier check to verify that *.ts files don't
# differ from their prettier output. We need `prettier-tslint` so that
# prettier will obey our tslint config, but it doesn't support
# Typescript 3 yet.
# (https://github.com/azz/prettier-tslint/issues/18)
- npm run format-check
build_targets:
- "//:dummy_target_for_ci"
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.json
src/protos/protos.js
5 changes: 3 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,6 @@ module.exports = tseslint.config(
rules: {
// Re-enable as soon as we are using ES modules for this config file.
"@typescript-eslint/no-var-requires": "off",
}
});
},
},
);
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@
"scripts": {
"check-lint": "eslint .",
"compile": "./scripts/build.sh",
"format-check": "prettier --check .",
"format-fix": "prettier --write .",
"vscode:prepublish": "./scripts/build.sh",
"watch": "./scripts/build.sh -watch"
},
Expand All @@ -454,6 +456,7 @@
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^48.2.2",
"prettier": "^3.2.5",
"typescript": "^5.4.4",
"typescript-eslint": "^7.5.0"
},
Expand All @@ -465,4 +468,4 @@
"vscode-uri": "^3.0.2",
"which": "^4.0.0"
}
}
}
3 changes: 2 additions & 1 deletion src/completion-provider/bazel_completion_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ function getAbsoluteLabel(
}

export class BazelCompletionItemProvider
implements vscode.CompletionItemProvider {
implements vscode.CompletionItemProvider
{
private targets: string[] = [];

/**
Expand Down

0 comments on commit 8235b63

Please sign in to comment.