-
Notifications
You must be signed in to change notification settings - Fork 4
Code Linting
Code linting automatically checks your code for style issues, bugs, and formatting problems before itβs merged.
In our practicum repos, linting is handled by ESLint and Prettier, both locally (in your editor) and in CI (GitHub Actions).
Linting exists to catch mistakes early and keep the codebase consistent, no matter who is writing the code.
View Repo Linting Overview
Most practicum JavaScript/TypeScript projects share the same basic setup:
In package.json youβll usually see:
{
"devDependencies": {
"eslint": "...",
"@typescript-eslint/eslint-plugin": "...",
"@typescript-eslint/parser": "...",
"eslint-config-prettier": "...",
"eslint-plugin-react": "...",
"prettier": "..."
}
}These packages provide:
- ESLint β finds code issues & style violations
- Prettier β formats code (spacing, quotes, semicolons, etc.)
- eslint-config-prettier β prevents conflicts between ESLint & Prettier
In the root of the repo youβll typically find:
-
.eslintrc.*β ESLint rules & environment -
.prettierrcorprettier.config.*β Prettier rules
Example ESLint config (simplified):
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"rules": {
"no-unused-vars": "warn",
"no-console": "off",
"@typescript-eslint/no-explicit-any": "warn"
}
}{
"scripts": {
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --fix"
}
}Youβll run these locally with:
npm run lint
npm run lint:fixView Local Linting Behavior
Once ESLint and Prettier are configured:
- Your editor shows red/yellow squiggles under problematic code
- The Problems panel lists errors and warnings
- Quick-fix actions can often auto-correct issues
- With βformat on save,β Prettier cleans up formatting every time you save
In VS Code this is powered by the ESLint extension, which integrates ESLint results directly into the editor.
- You write or edit code
- ESLint analyzes the file and flags issues in real time
- Prettier formats your code on save
- You fix any remaining ESLint warnings/errors
- You commit only after the file is clean
This local feedback loop prevents a lot of noisy CI failures later.
View CI Linting Workflow
When you open a Pull Request:
- GitHub Actions runs a lint workflow (usually
npm run lint) - If ESLint finds errors, the workflow fails
- GitHub marks the PR with a β check and may block merging until fixed
- Once you push a fix and the workflow passes, checks turn β
A typical CI job might look like this:
name: Lint
on:
pull_request:
branches: [ main, develop ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run lintIn the PR view, youβll see these checks listed under βChecksβ or near the merge button β similar to other GitHub workflow status checks.
Lint failures are fast feedback: they tell you something is off before a reviewer even starts reading your code.
Home β’ New Student Onboarding β’ Guides β’ Projects β’ Code of Conduct β’ FAQ
Last updated: 12/7/2025