Skip to main content
RapidDev - Software Development Agency
replit-tutorial

How to enforce code quality in Replit

You can enforce code quality in Replit by installing linters like ESLint for JavaScript/TypeScript or Pylint for Python directly in the Shell. Configure lint rules in project config files, then run linting commands manually or add them to your .replit run configuration. This catches bugs, enforces style consistency, and prevents common errors before they reach production.

What you'll learn

  • How to install and configure ESLint for JavaScript/TypeScript projects
  • How to install and configure Pylint for Python projects
  • How to run linters from the Shell and interpret their output
  • How to add lint scripts to your project configuration
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner8 min read15 minutesAll Replit plans. Works with JavaScript, TypeScript, and Python projects. Node.js and Python available via default Nix modules.March 2026RapidDev Engineering Team
TL;DR

You can enforce code quality in Replit by installing linters like ESLint for JavaScript/TypeScript or Pylint for Python directly in the Shell. Configure lint rules in project config files, then run linting commands manually or add them to your .replit run configuration. This catches bugs, enforces style consistency, and prevents common errors before they reach production.

Set up linting in Replit to catch bugs before they ship

Linting is the process of automatically scanning your code for errors, style violations, and potential bugs. Replit does not come with linters pre-configured, but you can install and set up ESLint (JavaScript/TypeScript) or Pylint (Python) in minutes using the Shell. Once configured, linting catches common mistakes like unused variables, missing return statements, and inconsistent formatting, saving you from debugging issues that a linter would have flagged instantly.

Prerequisites

  • A Replit account with an existing JavaScript/TypeScript or Python project
  • Basic familiarity with the Replit Shell (left sidebar > Tools > Shell)
  • Understanding of what code errors and warnings look like in your language
  • Node.js (for ESLint) or Python (for Pylint) available in your Repl — both are included by default

Step-by-step guide

1

Install ESLint for JavaScript or TypeScript projects

Open the Shell pane from the Tools dock on the left sidebar. Run the npm command to install ESLint as a development dependency. ESLint is the industry-standard linter for JavaScript and TypeScript, used by the React, Next.js, and Node.js ecosystems. Installing it as a dev dependency keeps it available in the workspace without bloating your production deployment.

typescript
1npm install --save-dev eslint @eslint/js

Expected result: ESLint is installed and appears in your package.json under devDependencies.

2

Create an ESLint configuration file

ESLint needs a configuration file to know which rules to apply. Create an eslint.config.js file in your project root. The flat config format (introduced in ESLint v9) uses a simple JavaScript array of rule objects. Start with the recommended rule set, which catches the most common JavaScript errors like unused variables, unreachable code, and missing semicolons. You can customize rules later as your project's needs evolve.

typescript
1import js from "@eslint/js";
2
3export default [
4 js.configs.recommended,
5 {
6 rules: {
7 "no-unused-vars": "warn",
8 "no-console": "warn",
9 "eqeqeq": "error",
10 "no-var": "error"
11 }
12 }
13];

Expected result: The eslint.config.js file is saved in your project root. ESLint will now use these rules when scanning your code.

3

Run ESLint from the Shell

With ESLint installed and configured, run it against your source files from the Shell. The npx command runs the locally installed version of ESLint. Point it at your source directory or specific files. ESLint reports errors (must fix) and warnings (should fix) with the file name, line number, and a description of the issue. Fix the reported issues in your code, then run ESLint again to verify they are resolved.

typescript
1npx eslint src/
2
3# Or lint a specific file
4npx eslint src/App.jsx
5
6# Auto-fix what ESLint can fix automatically
7npx eslint src/ --fix

Expected result: ESLint outputs a list of errors and warnings with file paths and line numbers. The --fix flag automatically corrects simple issues like spacing and semicolons.

4

Install Pylint for Python projects

For Python projects, Pylint is the most comprehensive linter available. Install it with pip in the Shell. Pylint checks for errors, enforces coding standards (PEP 8), detects code smells, and even rates your code on a scale of 0 to 10. It works out of the box with sensible defaults, but you can customize its behavior with a .pylintrc file or pyproject.toml configuration.

typescript
1pip install pylint
2
3# Run Pylint on a specific file
4pylint main.py
5
6# Run Pylint on all Python files in a directory
7pylint src/

Expected result: Pylint outputs a detailed report with error codes, descriptions, and a final score. Common messages include C0114 (missing docstring), W0611 (unused import), and E1101 (no member).

5

Configure Pylint rules with a config file

Create a .pylintrc file in your project root to customize which rules Pylint enforces. This is useful for silencing rules that do not apply to your project or adjusting severity levels. You can generate a default configuration with pylint --generate-rcfile, then edit it to match your preferences. Common customizations include disabling the missing-docstring warning for small projects and setting the maximum line length.

typescript
1[MAIN]
2max-line-length = 120
3
4[MESSAGES CONTROL]
5disable =
6 C0114, # missing-module-docstring
7 C0115, # missing-class-docstring
8 C0116, # missing-function-docstring
9 R0903 # too-few-public-methods

Expected result: Pylint uses your custom configuration, suppressing disabled rules and applying your preferred settings.

6

Add lint scripts to your project workflow

For JavaScript projects, add a lint script to your package.json so the whole team uses the same command. For Python projects, you can add the lint command to the .replit file's run configuration or create a simple shell script. This standardizes linting across all collaborators and makes it easy to run before committing code or deploying. Consider running linting as the first step before each deployment to catch issues early.

typescript
1// In package.json, add to the "scripts" section:
2{
3 "scripts": {
4 "lint": "eslint src/",
5 "lint:fix": "eslint src/ --fix",
6 "build": "npm run lint && vite build"
7 }
8}

Expected result: Running npm run lint in the Shell executes ESLint. Adding lint to the build script ensures code is checked before every build.

Complete working example

eslint.config.js
1import js from "@eslint/js";
2
3/**
4 * ESLint flat config for a Replit JavaScript/TypeScript project.
5 * Customize rules below to match your team's standards.
6 */
7export default [
8 // Start with ESLint's recommended rules
9 js.configs.recommended,
10
11 // Project-specific overrides
12 {
13 files: ["src/**/*.{js,jsx,ts,tsx}"],
14 rules: {
15 // Errors — must fix before deploying
16 "eqeqeq": "error",
17 "no-var": "error",
18 "prefer-const": "error",
19 "no-undef": "error",
20
21 // Warnings — should fix but won't block builds
22 "no-unused-vars": ["warn", {
23 "argsIgnorePattern": "^_",
24 "varsIgnorePattern": "^_"
25 }],
26 "no-console": "warn",
27 "no-debugger": "warn",
28
29 // Style — keep code consistent
30 "curly": "error",
31 "no-multi-spaces": "error",
32 "semi": ["error", "always"],
33 "quotes": ["error", "double"]
34 }
35 },
36
37 // Ignore build output and dependencies
38 {
39 ignores: ["dist/", "node_modules/", ".replit", "replit.nix"]
40 }
41];

Common mistakes when enforcing code quality in Replit

Why it's a problem: Installing ESLint globally instead of as a project dependency, which breaks when Replit resets the environment

How to avoid: Always use npm install --save-dev eslint to install ESLint as a project dependency. This persists in package.json.

Why it's a problem: Using the deprecated .eslintrc format instead of the new flat config (eslint.config.js) with ESLint v9+

How to avoid: Use the flat config format with eslint.config.js. ESLint v9 and later default to flat config and will show warnings about deprecated formats.

Why it's a problem: Ignoring linter warnings because they are not errors, leading to accumulated code quality issues

How to avoid: Schedule time to address warnings regularly. Consider promoting critical warnings to errors in your config once your team agrees on standards.

Why it's a problem: Not creating a linter config file, causing ESLint to use no rules or Pylint to use overly strict defaults

How to avoid: Always create a configuration file (eslint.config.js or .pylintrc) with your chosen rules. Start from the recommended preset.

Why it's a problem: Running Pylint without installing project dependencies first, causing false E0401 (import-error) reports

How to avoid: Run pip install -r requirements.txt before running Pylint so it can resolve all imports correctly.

Best practices

  • Run the linter before every deployment — add it as part of your build command (npm run lint && npm run build)
  • Start with the recommended rule set and only add custom rules when you encounter specific needs
  • Use the --fix flag to auto-correct simple formatting issues instead of fixing them manually
  • Treat linter errors as blockers and warnings as action items — fix errors immediately, address warnings soon
  • Share your ESLint or Pylint configuration file with collaborators so everyone follows the same standards
  • Ignore generated files and dependencies in your linter config to avoid noise (dist/, node_modules/)
  • For Python projects, combine Pylint with a formatter like Black for automatic code formatting
  • Check linter output after Replit Agent generates code — Agent does not always follow linting rules

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I set up ESLint/Pylint in my Replit project and I'm getting these linting errors: [paste errors]. Explain what each error means and show me how to fix the code to pass all lint checks.

Replit Prompt

Set up code linting for this project. Install ESLint (for JS/TS) or Pylint (for Python), create a configuration file with reasonable defaults, add a lint script, and fix any existing linting errors in the codebase.

Frequently asked questions

Replit provides basic syntax highlighting and error underlining in the editor, but it does not include a full linter like ESLint or Pylint by default. You need to install and configure them manually via the Shell.

No. Linters run only when you execute them (e.g., npm run lint). They do not run continuously in the background unless you specifically configure a file watcher, which is not recommended on Replit due to resource limits.

Yes. Install Prettier with npm install --save-dev prettier, then use eslint-config-prettier to disable ESLint rules that conflict with Prettier's formatting. Run Prettier for formatting and ESLint for logic checks.

Install typescript-eslint alongside ESLint: npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin. Add the TypeScript parser and plugin to your eslint.config.js configuration.

Not always. Replit Agent v4 generates functional code but may not follow your specific lint configuration. Run your linter after Agent makes changes and use the lint output to guide corrections.

Yes. In your package.json, chain the lint command before the build command: "build": "npm run lint && vite build". If linting fails, the build will not proceed.

RapidDev's engineering team can help configure linting, formatting, and code quality pipelines for Replit projects, including custom ESLint rules and CI-style checks that run before each deployment.

Pylint is the most comprehensive but slowest. Flake8 is lighter and faster. Ruff is the newest and fastest (written in Rust) but may need to be installed via pip. For most Replit projects, Pylint provides the best balance of thoroughness and ease of setup.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.