010
LVL 00 — CADET PILOT SESSION 010 DAY 10

ENVIRONMENT POLISH

SYS.SCENARIO
🏢 You sit next to a senior dev and watch him code. His terminal auto-completes everything. His code auto-formats on save. Errors appear before he even runs the program. "How is your setup so fast?" you ask. "Dotfiles, linting, formatting, and aliases," he says. "Let me show you."
CONCEPTS.UNLOCKED
🧹
ESLint
Catches code quality issues before they become bugs — like a spell-checker for code. Unused variables, unreachable code, dangerous patterns — all flagged instantly.
Prettier
Auto-formats code to a consistent style. Tabs vs spaces? Semicolons or not? Prettier decides once, then formats every file identically. No more style debates.
🧹+✨
ESLint vs Prettier
ESLint catches errors. Prettier fixes formatting. They complement each other — run both, never choose one over the other.
Shell Config & Aliases
.bashrc / .zshrc — your terminal's personality file. Aliases turn 15-character commands into 2-character shortcuts. Your terminal, your rules.
🔐
Environment Variables & .env
$PATH, $HOME, $NODE_ENV — system-level config. The .env file stores secrets (API keys, passwords) outside of code. Never committed to Git.
🪝
Git Hooks (Husky)
Scripts that run automatically on Git events. Pre-commit hooks run ESLint + Prettier before every commit — bad code physically can't enter the repo.
HANDS-ON.TASKS
01
Configure ESLint

Examine the existing .eslintrc.json — what rules are enabled?

Run ESLint against a source file and read the output:

npx eslint src/scripts/app.js

Fix 3 ESLint warnings in the codebase. For each fix, understand what the rule catches:

RuleWhat It Catches
no-unused-varsVariables declared but never used (dead code)
eqeqeq== instead of === (type coercion trap)
no-consoleconsole.log left in production code
no-undefUsing a variable that doesn't exist
ESLint catches bugs BEFORE you run the code. It's static analysis — reading your code without executing it. Like a spell-checker that also checks grammar.
02
Configure Prettier

Examine .prettierrc — what's the style? (tabs/spaces, quotes, semicolons)

Format a messy file from the terminal:

npx prettier --write src/scripts/app.js

Enable "Format on Save" in VS Code:

// settings.json { "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode" }

Now every save auto-formats. Write some intentionally messy code, save, watch it snap into place.

03
Set Up Shell Aliases

Edit your shell configuration file:

# macOS (Zsh) code ~/.zshrc # Linux (Bash) code ~/.bashrc

Add these aliases:

# Git shortcuts alias gs="git status" alias gc="git commit -m" alias gp="git push" alias gl="git log --oneline --graph" # Navigation alias ll="ls -la" alias px="cd ~/pixelcraft && npm run dev"

Reload the config:

source ~/.bashrc # or source ~/.zshrc

Test every alias. gs should now do what git status used to take.

04
Understand Environment Variables

Explore the environment variables your system already has:

echo $HOME # Your home directory echo $PATH # Where the system looks for commands echo $USER # Your username

$PATH is critical — it's a colon-separated list of directories the OS searches when you type a command. If a tool "isn't found," it's usually a PATH problem.

05
Create a .env File

Create a .env file for PixelCraft:

API_KEY=sk-test-12345 DB_URL=mongodb://localhost:27017/pixelcraft NODE_ENV=development

Immediately add .env to .gitignore:

echo ".env" >> .gitignore git status # .env must NOT appear as untracked
FileCommitted?Purpose
.env❌ NEVERReal secrets, local only
.env.example✅ YESTemplate showing required vars (no real values)
Committing an API key to a public repo is one of the most common (and expensive) mistakes in software. Companies have lost millions. The .env + .gitignore pattern prevents this.
06
Git Hooks with Husky + lint-staged

The idea: automatically lint and format code before every commit.

Install Husky and lint-staged:

npm install --save-dev husky lint-staged npx husky init

Configure lint-staged in package.json:

"lint-staged": { "*.js": ["eslint --fix", "prettier --write"], "*.css": ["prettier --write"], "*.html": ["prettier --write"] }

Set up the pre-commit hook:

echo "npx lint-staged" > .husky/pre-commit

Now try committing badly formatted code:

# Write intentionally messy code echo "const x=1;var y = 2" > test.js git add test.js git commit -m "Test the hook" # → Hook runs ESLint + Prettier → auto-fixes before commit lands!
With this setup, it's physically impossible to commit unformatted code. The hook catches it every time. This is how professional teams maintain code quality at scale.
CS.DEEP-DIVE

Developer Experience (DX) is a multiplier.

Linting catches bugs before execution (static analysis). Formatting removes style debates. Aliases reduce typing. Auto-complete reduces errors. Each tool saves minutes per day — the compounding effect is massive.

// The automation principle:
// If you do something more than twice, automate it.

Aliases       → automate typing
Format on save → automate style
Git hooks     → automate quality gates
CI/CD         → automate testing & deployment
IaC           → automate infrastructure

// Scripts, hooks, CI/CD pipelines, and
// infrastructure-as-code all follow one principle:
//
// Humans decide the rules.
// Machines enforce them.
"Bulletproof Setup"
[A] Create a fresh project with ESLint, Prettier, Husky, lint-staged, .env, .editorconfig, and .gitignore all configured from scratch.
[B] Write intentionally messy JavaScript. Commit it. Watch the pre-commit hook auto-fix the formatting before the commit lands.
[C] Document your setup in a README: what each config file does, what each tool enforces, and why it matters.
REF.MATERIAL
VIDEO
Traversy Media
Step-by-step setup of ESLint and Prettier working together in VS Code — resolving conflicts between the two tools.
ESLINTPRETTIERSETUP
ARTICLE
ESLint
Official ESLint docs — configuration, rules reference, and extending shared configs. The authoritative source.
ESLINTOFFICIALREFERENCE
ARTICLE
Typicode
Official Husky docs — setup, hooks, lint-staged integration. Quick setup guide for pre-commit and pre-push hooks.
HUSKYGIT HOOKS
VIDEO
ThePrimeagen
Why developers obsess over dotfiles (.zshrc, .gitconfig, aliases). How to version control your entire development environment.
DOTFILESSHELLALIASES
ARTICLE
Prettier
Every Prettier option explained — semi, singleQuote, tabWidth, trailingComma, printWidth. The complete formatting reference.
PRETTIEROPTIONSREFERENCE
// LEAVE EXCITED BECAUSE
Your development environment is professional-grade. Code auto-formats. Errors appear before you run anything. Your terminal has shortcuts for everything. You're working like a 10-year veteran.
🎓 ONBOARDING.COMPLETE

Welcome to active duty, Intern.

// Level 00: Cadet Pilot — STATUS: COMPLETE

✓ Configured machine         Session 01
✓ Terminal mastery           Sessions 02–03
✓ Internet fundamentals      Session 04
✓ Code editor cockpit        Session 05
✓ Git workflow               Sessions 06–08
✓ Task board & process       Session 09
✓ Polished dev environment   Session 10

// You're ready to start closing real tickets.
// Level 01: Wave Defender — begins now. 🔵