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

[#1183] Bring back the prettier config #1184

Merged
merged 1 commit into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
docs/docs/cli/reference.md
**/*/cli/reference.md
build/
bazel-*
26 changes: 26 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"bracketSpacing": false,
"singleQuote": true,
"jsxBracketSameLine": true,
"semi": true,
"trailingComma": "es5",
"printWidth": 120,
"arrowParens": "avoid",
"endOfLine": "auto",
"overrides": [
{
"files": "*.{ts,tsx}",
"options": {
"parser": "typescript"
}
},
{
"files": "*.md",
"options": {
"singleQuote": false,
"quoteProps": "preserve",
"trailingComma": "none"
}
}
]
}
2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ alias(

fix_prettier(
name = "fix_prettier",
config = "//:.prettierrc.json",
ignore = "//:.prettierignore",
)

Expand Down Expand Up @@ -174,6 +175,7 @@ java_library(
exports_files(
[
"package.json",
".eslintrc",
".prettierrc.json",
".prettierignore",
"yarn.lock",
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# Airy Bazel tools
git_repository(
name = "com_github_airyhq_bazel_tools",
commit = "9cf55cc0a42d68f0198883b04493ce7c7b3113ed",
commit = "18642f4f2483933d738138cb4a850d83c62f438d",
remote = "https://github.com/airyhq/bazel-tools.git",
shallow_since = "1614958086 +0100",
shallow_since = "1615304389 +0100",
)

load("@com_github_airyhq_bazel_tools//:repositories.bzl", "airy_bazel_tools_dependencies", "airy_jvm_deps")
Expand Down
1 change: 1 addition & 0 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@com_github_airyhq_bazel_tools//lint:prettier.bzl", "prettier")

prettier(
name = "prettier",
config = "//:.prettierrc.json",
ignore = "//:.prettierignore",
)

Expand Down
3 changes: 3 additions & 0 deletions frontend/assets/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//tools/lint:web.bzl", "web_lint")
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")
load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library")

Expand All @@ -8,3 +9,5 @@ ts_web_library(
)

check_pkg(name = "buildifier")

web_lint()
3 changes: 3 additions & 0 deletions frontend/chat-plugin/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//tools/lint:web.bzl", "web_lint")
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library")
Expand Down Expand Up @@ -101,3 +102,5 @@ container_release(
)

check_pkg(name = "buildifier")

web_lint()
5 changes: 3 additions & 2 deletions frontend/ui/BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
load("//tools/lint:web.bzl", "web_lint")
load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library")
load("@com_github_airyhq_bazel_tools//web:web_app.bzl", "web_app")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//tools/build:container_release.bzl", "container_release")
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")

check_pkg()

check_pkg(name = "buildifier")

module_deps = [
Expand Down Expand Up @@ -76,3 +75,5 @@ container_release(
registry = "ghcr.io/airyhq/frontend",
repository = "ui",
)

web_lint()
3 changes: 3 additions & 0 deletions frontend/ui/public/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//tools/lint:web.bzl", "web_lint")
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")

package(default_visibility = ["//visibility:public"])
Expand All @@ -10,3 +11,5 @@ filegroup(
)

check_pkg(name = "buildifier")

web_lint()
3 changes: 3 additions & 0 deletions lib/typescript/dates/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//tools/lint:web.bzl", "web_lint")
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")
load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library")

Expand All @@ -11,3 +12,5 @@ ts_web_library(
)

check_pkg(name = "buildifier")

web_lint()
3 changes: 3 additions & 0 deletions lib/typescript/httpclient/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//tools/lint:web.bzl", "web_lint")
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")
load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library")

Expand All @@ -13,3 +14,5 @@ ts_web_library(
)

check_pkg(name = "buildifier")

web_lint()
3 changes: 3 additions & 0 deletions lib/typescript/render/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//tools/lint:web.bzl", "web_lint")
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")
load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library")

Expand All @@ -20,3 +21,5 @@ ts_web_library(
)

check_pkg(name = "buildifier")

web_lint()
3 changes: 3 additions & 0 deletions lib/typescript/types/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//tools/lint:web.bzl", "web_lint")
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")
load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library")

Expand All @@ -15,3 +16,5 @@ ts_web_library(
)

check_pkg(name = "buildifier")

web_lint()
3 changes: 3 additions & 0 deletions lib/typescript/websocketclient/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//tools/lint:web.bzl", "web_lint")
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")
load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library")

Expand All @@ -15,3 +16,5 @@ ts_web_library(
)

check_pkg(name = "buildifier")

web_lint()
1 change: 1 addition & 0 deletions tools/lint/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exports_files(["prettier.bzl"])
8 changes: 8 additions & 0 deletions tools/lint/web.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@com_github_airyhq_bazel_tools//lint:prettier.bzl", "prettier")
load("@com_github_airyhq_bazel_tools//lint:eslint.bzl", "eslint")

def web_lint():
if "prettier" not in native.existing_rules().keys():
prettier(name = "prettier", config = "//:.prettierrc.json", ignore = "//:.prettierignore")
if "eslint" not in native.existing_rules().keys():
eslint(name = "eslint", config = "//:.eslintrc", ignore = "//:.prettierignore")