Skip to content

Commit

Permalink
code suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Mar 6, 2023
1 parent 5461898 commit 73040f2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
12 changes: 1 addition & 11 deletions packages/astro/src/cli/check/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,13 @@ export class AstroChecker {

/**
* Check all `.astro` files once and then finishes the operation.
* @returns {Promise<CheckResult>}
*/
public async check(): Promise<CheckResult> {
return await this.#checkAllFiles(true);
}

/**
* Check all `.astro` files and then start watching for changes.
* @returns {Promise<CheckResult>}
*/
public async watch(): Promise<CheckResult> {
await this.#checkAllFiles(true);
Expand All @@ -184,7 +182,6 @@ export class AstroChecker {

/**
* Whether the checker should run in watch mode
* @returns {boolean}
*/
public get isWatchMode(): boolean {
return this.#shouldWatch;
Expand All @@ -205,7 +202,6 @@ export class AstroChecker {
* 3. Get diagnostics for said files and print the result in console.
*
* @param openDocuments Whether the operation should open all `.astro` files
* @private
*/
async #checkAllFiles(openDocuments: boolean): Promise<CheckResult> {
const processExit = await this.#syncCli(this.#settings, {
Expand Down Expand Up @@ -285,7 +281,7 @@ export class AstroChecker {
/**
* Logs the result of the various diagnostics
*
* @param {Readonly<DiagnosticResult>} result Result emitted by AstroChecker.#breakDownDiagnostics
* @param result Result emitted by AstroChecker.#breakDownDiagnostics
*/
#logDiagnosticsSeverity(result: Readonly<DiagnosticResult>) {
info(
Expand All @@ -302,7 +298,6 @@ export class AstroChecker {

/**
* It loops through all diagnostics and break down diagnostics that are errors, warnings or hints.
* @param {Readonly<GetDiagnosticsResult[]>} diagnostics
*/
#breakDownDiagnostics(diagnostics: Readonly<GetDiagnosticsResult[]>): DiagnosticResult {
let result: DiagnosticResult = {
Expand Down Expand Up @@ -338,9 +333,6 @@ export class AstroChecker {

/**
* Open all Astro files in the given directory and return the number of files found.
* @param {URL} workspaceUri
* @param {string[]} filePathsToIgnore
* @param {AstroCheck} checker
*/
async function openAllDocuments(
workspaceUri: URL,
Expand All @@ -367,8 +359,6 @@ async function openAllDocuments(

/**
* Parse flags and sets defaults
*
* @param flags {Flags}
*/
function parseFlags(flags: Flags): CheckFlags {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('astro cli', () => {
expect(proc.exitCode).to.equal(0);
});

// Flaky test, in CI it exceeds the timeout
// Flaky test, in CI it exceeds the timeout most of the times
it.skip('astro check --watch reports errors on modified files', async () => {
let messageResolve;
const messagePromise = new Promise((resolve) => {
Expand Down
1 change: 0 additions & 1 deletion packages/astro/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ export async function loadFixture(inlineConfig) {

let fixtureId = new Date().valueOf();
let devServer;
let checkServer;

return {
build: (opts = {}) => {
Expand Down

0 comments on commit 73040f2

Please sign in to comment.