Choosing Between WebStorm Auto‑Fix on Save and CI‑Based ESLint Enforcement
Decide whether to rely on WebStorm’s auto‑fix on save, a pre‑commit hook, or a CI lint step. Compare trade‑offs, see a concrete setup, and validate performance and consistency across editors.
15 Jun 2026, 03:53 UTC

Decision Context
When a team adopts ESLint, two common enforcement patterns surface:
- Editor‑level auto‑fix on file save – WebStorm runs
eslint --fixeach time you hitCtrl+S. - Centralized linting – ESLint runs in a pre‑commit hook or a continuous‑integration (CI) pipeline, independent of the editor.
Both methods aim to keep code quality high, but they differ in latency, consistency, and safety. This guide helps you decide which approach, or combination, fits your workflow.
Decision Matrix
| Option | When to Use | Pros | Cons | Typical Command |
|---|---|---|---|---|
| WebStorm Auto‑Fix on Save | Small to medium projects, developers who prefer instant feedback, teams with a single editor. | Immediate corrections, less friction during coding, no external tooling required. | Runs eslint --fix automatically; no manual command. | |
| Pre‑Commit Hook (e.g., Husky) | Projects that need a safety net against accidental commits, teams using multiple editors. | Enforces rules before code enters VCS, catches errors the editor missed. | npx eslint --ext .js,.ts src/ | |
| CI Lint Step | Large codebases, strict compliance, continuous delivery pipelines. | Guarantees consistency across all contributors, fails builds on violations. | npm run lint or eslint --ext .js,.ts src/ in CI config. | |
| Hybrid (auto‑fix + CI) | Teams that want developer ergonomics without sacrificing gatekeeping. | Fast feedback + strict enforcement. | Auto‑fix via IDE; CI runs full lint. |
Trade‑Offs Explained
Latency vs. Developer Experience
Auto‑fix triggers on every save. For files under ~10 KB, the delay is negligible. Larger TypeScript modules (50 KB+) can add 200–500 ms, measurable by your editor’s status bar. In contrast, pre‑commit or CI runs are batch operations, usually performed once per commit or build, so latency per file is irrelevant.
Consistency Across Toolchains
Editor‑only linting ties quality to a single IDE. If a teammate uses VS Code or a command‑line editor, they may bypass the auto‑fix. A CI step guarantees that every push undergoes the same lint rules, regardless of local tooling.
Risk of Stale Git Index
When WebStorm applies --fix, it rewrites the file in the working tree. If the IDE does not refresh the file after the fix, the git index may still hold the pre‑fix version. A subsequent commit could silently record the un‑fixed code, leading to merge conflicts or unnoticed violations.
Security of Pre‑Commit Hooks
Hooks can be disabled with git config core.hooksPath or by force‑pushing. A CI lint step is the only reliable gate that cannot be bypassed by a developer.
Concrete Implementation
1. Enable Auto‑Fix on Save in WebStorm
- Open
Preferences / Settings. - Navigate to
Languages & Frameworks > JavaScript > Code Quality Tools > ESLint. - Select
Automatic ESLint configurationor point to.eslintrc.js. - Check
Run eslint --fix on save. - Apply and close.
After editing a file that violates quotes or no-console, hit Ctrl+S and observe the changes applied instantly. Verify that the file’s timestamp updates and that git status shows a modified file.
2. Add a Husky Pre‑Commit Hook
First, install Husky:
npm install --save-dev husky
npx husky install
Then add a lint script to package.json:
"scripts": {
"lint": "eslint --ext .js,.ts src/"
}
Create the hook:
npx husky add .husky/pre-commit "npm run lint"
Now, attempting to commit a file with a lint error will abort the commit, displaying the offending rule.
3. Configure a CI Lint Step (GitHub Actions Example)
In .github/workflows/lint.yml:
name: Lint
on:
pull_request:
push:
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 lint
env:
CI: true
Any lint error will cause the job to fail, preventing the merge or deployment.
Validation Workflow
- Measure Editor Latency
- Open a 50 KB TypeScript file.
- Enable auto‑fix, then disable it.
- Use
timeor WebStorm’sRunlog to record save duration. - Compare the two values to quantify performance impact.
- Test Pre‑Commit Hook
- Make a change that violates
no-unused-vars. - Run
git commit -m "test". - Confirm the hook blocks the commit.
- Make a change that violates
- Run CI Manually
- Push a branch with a lint error.
- Observe the GitHub Actions job failure.
- Cross‑Editor Consistency
- Open the same project in VS Code.
- Verify that the CI step still catches errors even if VS Code has no auto‑fix.
Practical Recommendations
- For teams using a single IDE and working on small to medium files, enable auto‑fix to reduce friction.
- Always keep a pre‑commit hook; it catches errors that the editor may skip (e.g., rules disabled for auto‑fix).
- Add a CI lint step as the final gate—this ensures that all contributors, regardless of local setup, meet the same standards.
- Consider a file‑size threshold: in WebStorm, use
Settings > Editor > General > Save Actions > Exclude files larger than. - Periodically run
npx eslint --print-config .eslintrc.jsand compare the output across environments to confirm consistency.
Limitations
- Auto‑fix may introduce formatting changes that conflict with version‑control history, especially in merge scenarios.
- Pre‑commit hooks can be bypassed with
git commit --no-verifyor force pushes; CI is the only non‑bypassable gate. - Performance benchmarks vary by machine; use your own hardware for accurate measurement.
- ESLint configuration changes may not immediately reflect in the IDE; clear the WebStorm cache or re‑import the project after major config updates.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.