Skip to content

Commit

Permalink
build: reformat docs site code
Browse files Browse the repository at this point in the history
Currently Prettier will complain for any docs site file we change since it was never reformatted. These changes update the formatting.
  • Loading branch information
crisbeto committed Jan 30, 2025
1 parent 73022d8 commit 369957c
Show file tree
Hide file tree
Showing 127 changed files with 679 additions and 874 deletions.
58 changes: 11 additions & 47 deletions material.angular.io/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
{
"root": true,
"ignorePatterns": [
"*.d.ts",
"src/assets/stack-blitz/**/*.ts"
],
"ignorePatterns": ["*.d.ts", "src/assets/stack-blitz/**/*.ts"],
"overrides": [
{
"files": [
"*.ts"
],
"plugins": [
"@stylistic",
"@typescript-eslint",
"ban"
],
"files": ["*.ts"],
"plugins": ["@stylistic", "@typescript-eslint", "ban"],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"project": ["tsconfig.json", "e2e/tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
Expand Down Expand Up @@ -53,28 +41,11 @@
"allowTemplateLiterals": true
}
],
"@stylistic/semi": [
"error"
],
"arrow-parens": [
"off",
"always"
],
"brace-style": [
"error",
"1tbs"
],
"@stylistic/semi": ["error"],
"arrow-parens": ["off", "always"],
"brace-style": ["error", "1tbs"],
"import/order": "off",
"linebreak-style": [
"error",
"unix"
],
"max-len": [
"error",
{
"code": 100
}
],
"linebreak-style": ["error", "unix"],
"ban/ban": [
"error",
{
Expand All @@ -90,10 +61,7 @@
"name": "xdescribe"
},
{
"name": [
"Object",
"assign"
],
"name": ["Object", "assign"],
"message": "Use the spread operator instead."
}
],
Expand All @@ -107,12 +75,8 @@
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {
"@angular-eslint/template/accessibility-alt-text": "error",
"@angular-eslint/template/accessibility-elements-content": "error",
Expand Down
62 changes: 30 additions & 32 deletions material.angular.io/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,54 @@ npm_link_all_packages(name = "node_modules")
copy_to_bin(
name = "ng-base-config",
srcs = [
"angular.json",
"tsconfig.json",
"package.json",
"angular.json",
"package.json",
"tsconfig.json",
],
)

# Test config files
copy_to_bin(
name = "ng-base-test-config",
srcs = [
"karma-custom-launchers.js",
],
name = "ng-base-test-config",
srcs = [
"karma-custom-launchers.js",
],
)

# Lint config files
copy_to_bin(
name = "ng-base-lint-config",
srcs = [
".eslintrc.json",
],
name = "ng-base-lint-config",
srcs = [
".eslintrc.json",
],
)


# The main application
ng_app(
name = "app",
project_name = "material-angular-io",
deps = [
"//:node_modules/@angular/components-examples",
"//:node_modules/@stackblitz/sdk",
"//:node_modules/path-normalize",
"//:node_modules/moment",
"//:node_modules/@angular/components-examples",
"//:node_modules/@stackblitz/sdk",
"//:node_modules/moment",
"//:node_modules/path-normalize",
],
)


js_test(
name = "audit",
entry_point = "tools/audit-docs.js",
args = [
"$(location //:build.production)",
],
data = [
"tools/lighthouse-audit.mjs",
"//:build.production",
"//:node_modules/lighthouse",
"//:node_modules/lighthouse-logger",
"//:node_modules/puppeteer",
"//:node_modules/shelljs",
"//:node_modules/light-server",
],
tags = ["audit"],
name = "audit",
args = [
"$(location //:build.production)",
],
data = [
"tools/lighthouse-audit.mjs",
"//:build.production",
"//:node_modules/light-server",
"//:node_modules/lighthouse",
"//:node_modules/lighthouse-logger",
"//:node_modules/puppeteer",
"//:node_modules/shelljs",
],
entry_point = "tools/audit-docs.js",
tags = ["audit"],
)
85 changes: 41 additions & 44 deletions material.angular.io/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ APPLICATION_CONFIG = COMMON_CONFIG + [
TEST_CONFIG = COMMON_CONFIG + [
"@dev-infra//bazel/browsers/chromium",
"@dev-infra//bazel/browsers/firefox",

"//:ng-base-test-config",
":ng-test-config",
"//:node_modules/karma",
Expand All @@ -76,7 +75,6 @@ TEST_DEPS = [
E2E_CONFIG = COMMON_CONFIG + [
"@dev-infra//bazel/browsers/chromium",
"@dev-infra//bazel/browsers/firefox",

"//:ng-base-test-config",
":ng-e2e-config",
"//:node_modules/jasmine-spec-reporter",
Expand All @@ -89,28 +87,27 @@ E2E_DEPS = [
]

LINT_CONFIG = COMMON_CONFIG + [
# Lint uses the e2e config
"//:ng-base-test-config",
":ng-e2e-config",
"//:ng-base-lint-config",
"//:node_modules/@angular-eslint/builder",
"//:node_modules/@angular-eslint/eslint-plugin",
"//:node_modules/@angular-eslint/eslint-plugin-template",
"//:node_modules/@angular-eslint/template-parser",
"//:node_modules/eslint-plugin-ban",
"//:node_modules/eslint-plugin-import",
"//:node_modules/eslint-plugin-jsdoc",
"//:node_modules/eslint-plugin-prefer-arrow",
"//:node_modules/@typescript-eslint/eslint-plugin",
"//:node_modules/@typescript-eslint/parser",
"//:node_modules/@stylistic/eslint-plugin",
# Lint uses the e2e config
"//:ng-base-test-config",
":ng-e2e-config",
"//:ng-base-lint-config",
"//:node_modules/@angular-eslint/builder",
"//:node_modules/@angular-eslint/eslint-plugin",
"//:node_modules/@angular-eslint/eslint-plugin-template",
"//:node_modules/@angular-eslint/template-parser",
"//:node_modules/eslint-plugin-ban",
"//:node_modules/eslint-plugin-import",
"//:node_modules/eslint-plugin-jsdoc",
"//:node_modules/eslint-plugin-prefer-arrow",
"//:node_modules/@typescript-eslint/eslint-plugin",
"//:node_modules/@typescript-eslint/parser",
"//:node_modules/@stylistic/eslint-plugin",
]
LINT_DEPS = [
# TODO(bazel): this should be included as a transitive of @angular-devkit/architect-cli!?
"//:node_modules/@angular-devkit/architect",
# TODO(bazel): this should be included as a transitive of @angular-devkit/architect-cli!?
"//:node_modules/@angular-devkit/architect",
]


def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [], **kwargs):
"""
Macro for Angular applications, creating various targets aligning with the Angular CLI.
Expand All @@ -137,44 +134,44 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [],

test_srcs = native.glob(["src/test.ts", "src/**/*.spec.ts"])

e2e_srcs = native.glob(["e2e/src/**/*.ts"])
e2e_srcs = native.glob(["e2e/src/**/*.ts"])

tags = kwargs.pop("tags", [])

# config files
copy_to_bin(
name = "ng-app-config",
srcs = [
"tsconfig.app.json",
"tsconfig.app.json",
],
visibility = ["//visibility:private"],
)
copy_to_bin(
name = "ng-test-config",
srcs = [
"karma.conf.js",
"tsconfig.spec.json",
"karma.conf.js",
"tsconfig.spec.json",
],
visibility = ["//visibility:private"],
)
copy_to_bin(
name = "ng-e2e-config",
srcs = [
"e2e/tsconfig.json",
"e2e/protractor.conf.js",
"e2e/tsconfig.json",
"e2e/protractor.conf.js",
],
visibility = ["//visibility:private"],
)

# Lint config files in addition to the root
if native.package_name() != '':
copy_to_bin(
name = "lint-config",
srcs = [
".eslintrc.json",
],
visibility = ["//visibility:private"],
)
if native.package_name() != "":
copy_to_bin(
name = "lint-config",
srcs = [
".eslintrc.json",
],
visibility = ["//visibility:private"],
)

project_name = project_name if project_name else name

Expand Down Expand Up @@ -239,7 +236,7 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [],
_architect_test(
project_name,
"lint",
srcs = srcs + test_srcs + e2e_srcs + deps + test_deps + NG_COMMON_DEPS + LINT_DEPS + LINT_CONFIG + ([":lint-config"] if native.package_name() != '' else []),
srcs = srcs + test_srcs + e2e_srcs + deps + test_deps + NG_COMMON_DEPS + LINT_DEPS + LINT_CONFIG + ([":lint-config"] if native.package_name() != "" else []),
tags = tags + ["lint"],
**kwargs
)
Expand All @@ -248,8 +245,9 @@ def _architect_build(project_name, configuration = None, args = [], srcs = [], *
output_dir = "%s%s" % (project_name, ".%s" % configuration if configuration else "")

args = [
"%s:build%s" % (project_name, ":%s" % configuration if configuration else ""),
"--output-path", output_dir
"%s:build%s" % (project_name, ":%s" % configuration if configuration else ""),
"--output-path",
output_dir,
] + args

architect_cli.architect(
Expand All @@ -258,13 +256,13 @@ def _architect_build(project_name, configuration = None, args = [], srcs = [], *
args = args,
out_dirs = [output_dir],
srcs = srcs,
**kwargs,
**kwargs
)

def _architect_test(project_name, command, configuration = None, args = [], srcs = [], **kwargs):
to_root = ""
if native.package_name() != "":
to_root = "".join(["../" for _ in native.package_name().split("/")])
to_root = "".join(["../" for _ in native.package_name().split("/")])

env = {
"CHROME_BIN": to_root + "$(CHROMIUM)",
Expand All @@ -275,25 +273,24 @@ def _architect_test(project_name, command, configuration = None, args = [], srcs
name = "%s%s" % (command, ".%s" % configuration if configuration else ""),
chdir = native.package_name(),
args = [
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else "")
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else ""),
] + args,
data = srcs,
env = env,
toolchains = [
"@dev-infra//bazel/browsers/chromium:toolchain_alias",
"@dev-infra//bazel/browsers/firefox:toolchain_alias",
],
**kwargs,
**kwargs
)

def _architect_binary(project_name, command, configuration = None, args = [], srcs = [], **kwargs):
architect_cli.architect_binary(
name = "%s%s" % (command, ".%s" % configuration if configuration else ""),
chdir = native.package_name(),
args = [
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else "")
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else ""),
] + args,
data = srcs,
**kwargs,
**kwargs
)

Loading

0 comments on commit 369957c

Please sign in to comment.