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

build: reformat docs site code #30418

Merged
merged 1 commit into from
Jan 31, 2025
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
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": [
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this since it's enforced by Prettier now.

"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"],
)
22 changes: 10 additions & 12 deletions material.angular.io/e2e/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@ const path = require('path');
// TODO(bazel): drop non-bazel
const isBazel = !!process.env['TEST_TARGET'];
if (isBazel) {
// Resolve CHROME_BIN and CHROMEDRIVER_BIN from relative paths to absolute paths within the
// runfiles tree so that subprocesses spawned in a different working directory can still find them.
process.env.CHROME_BIN = path.resolve(process.env.CHROME_BIN);
process.env.CHROMEDRIVER_BIN = path.resolve(process.env.CHROMEDRIVER_BIN);
// Resolve CHROME_BIN and CHROMEDRIVER_BIN from relative paths to absolute paths within the
// runfiles tree so that subprocesses spawned in a different working directory can still find them.
process.env.CHROME_BIN = path.resolve(process.env.CHROME_BIN);
process.env.CHROMEDRIVER_BIN = path.resolve(process.env.CHROMEDRIVER_BIN);
}

/**
* @type { import("protractor").Config }
*/
const config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
'browserName': 'chrome',
Expand All @@ -37,24 +35,24 @@ const config = {
'--hide-scrollbars',
'--mute-audio',
],
}
},
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
if (!isBazel) {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
}
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
}
},
};

if (isBazel) {
Expand All @@ -70,7 +68,7 @@ if (process.env['TRAVIS']) {

'tunnel-identifier': process.env['TRAVIS_JOB_NUMBER'],
'build': process.env['TRAVIS_JOB_NUMBER'],
'name': 'Material Docs E2E'
'name': 'Material Docs E2E',
};
}

Expand Down
8 changes: 5 additions & 3 deletions material.angular.io/e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ describe('Material Docs App', () => {
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry),
);
});
});
5 changes: 3 additions & 2 deletions material.angular.io/e2e/src/app.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export class MaterialDocsAppPage {
}

getTitleText() {
return element(by.css('app-homepage header .docs-header-headline .mat-h1'))
.getText() as Promise<string>;
return element(
by.css('app-homepage header .docs-header-headline .mat-h1'),
).getText() as Promise<string>;
}
}
6 changes: 1 addition & 5 deletions material.angular.io/e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
"types": ["jasmine", "jasminewd2", "node"]
}
}
15 changes: 4 additions & 11 deletions material.angular.io/karma-custom-launchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,19 @@ exports.customLaunchers = {
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio'
'--mute-audio',
],
},
ChromeHeadlessLocal: {
base: 'ChromeHeadless',
flags: [
'--window-size=1024,768'
]
flags: ['--window-size=1024,768'],
},
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: [
'--window-size=1024,768',
'--no-sandbox'
]
flags: ['--window-size=1024,768', '--no-sandbox'],
},
FirefoxHeadless: {
base: 'Firefox',
flags: [
'-headless'
]
flags: ['-headless'],
},
};
6 changes: 3 additions & 3 deletions material.angular.io/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ module.exports = function (config) {
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
Expand All @@ -43,6 +43,6 @@ module.exports = function (config) {
});

if (process.env['TRAVIS']) {
config.browsers = [isBazel ? 'ChromeHeadlessNoSandbox' : 'ChromeHeadlessCI', 'FirefoxHeadless']
config.browsers = [isBazel ? 'ChromeHeadlessNoSandbox' : 'ChromeHeadlessCI', 'FirefoxHeadless'];
}
};
6 changes: 3 additions & 3 deletions material.angular.io/scenes/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package(default_visibility = ["//visibility:public"])
ng_app(
name = "scenes",
deps = [
"//:node_modules/@angular/components-examples",
"//:node_modules/@stackblitz/sdk",
"//:node_modules/moment",
"//:node_modules/@angular/components-examples",
"//:node_modules/@stackblitz/sdk",
"//:node_modules/moment",
],
)
Loading
Loading