Challenge - 5 Problems
Deno Formatter Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediateWhat does the command
deno fmt do?Choose the best description of what
deno fmt accomplishes when run in a Deno project directory.Attempts:
2 left
💡 Hint
Think about what 'fmt' usually stands for in programming tools.
✗ Incorrect
The deno fmt command formats source code files to follow consistent style rules automatically. It does not compile, test, or install dependencies.
❓ component_behavior
intermediateWhat happens if you run
deno fmt on a file with incorrect indentation?Given a TypeScript file with inconsistent indentation, what will
deno fmt do when executed on that file?Attempts:
2 left
💡 Hint
Consider the purpose of a formatter tool.
✗ Incorrect
deno fmt automatically corrects formatting issues like indentation and saves the file with the fixed style.
📝 Syntax
advancedWhich command formats only specific files using
deno fmt?You want to format only
app.ts and utils.ts files in your project. Which command will do this correctly?Attempts:
2 left
💡 Hint
Check the official syntax for specifying files with deno fmt.
✗ Incorrect
The deno fmt command accepts file paths directly as arguments to format only those files.
🔧 Debug
advancedWhy does
deno fmt not format a file?You run
deno fmt myfile.ts but the file remains unchanged even though it has formatting issues. What is the most likely reason?Attempts:
2 left
💡 Hint
Think about what happens if a formatter sees a file already correct.
✗ Incorrect
If the file matches Deno's formatting rules, deno fmt will not change it.
❓ state_output
expertWhat is the output of running
deno fmt --check on a badly formatted file?You run
deno fmt --check bad.ts where bad.ts has inconsistent spacing and indentation. What will be the output?Attempts:
2 left
💡 Hint
The
--check flag is for verifying formatting without changing files.✗ Incorrect
The --check option reports files that are not formatted correctly and exits with an error code, without changing files.
