20 of the best prompts for identifying linting rule violations, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
20 of the best prompts for identifying linting rule violations, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
Published July 2, 2026
Getting Identifying Linting Rule Violations right takes more than a single prompt. This 4-stage guide covers Diagnose the Wall, Isolate and Fix, Verify the Resolution, and more, breaking the whole process into focused steps where each prompt builds on the last. When Replit generates code that violates ESLint or Prettier rules, it can lead to build failures and hinder development. If these violations are not addressed, they may cause further complications during deployment and maintenance. By following this guide, developers can ensure their code adheres to the established linting rules, improving code quality and reducing errors. Every prompt is optimized and runs in ChatGPT, Claude, and Gemini.
Before attempting any fixes, check the output for specific linting errors in your code. Look for messages indicating which rules were violated and in which files.
Quote the Linting Violation
Quote the exact error message generated for the function in 'src/app.js' that relates to the 'no-unused-vars' linting rule. Include details about the specific variable that is considered unused, and provide any additional context that might help in understanding why this violation occurred. This will aid in diagnosing the issue and determining the necessary adjustments to comply with the linting requirements.
Paste the ESLint Output
Paste the output from the ESLint run that details the specific violations encountered. Analyze the errors and warnings reported in this output to identify the areas where the generated code does not comply with the established linting rules. Summarize the key issues, including the types of errors, their locations in the code, and any patterns that emerge from the violations. Finally, provide specific suggestions for adjustments or solutions to align the code with the linting standards.
State Your Interpretation of Instructions
Provide your interpretation of the original instruction regarding the function implementation. Clearly outline what you believe the requirements and expectations are, and identify any specific points that may need clarification or that you find ambiguous. After detailing your interpretation, proceed to fix the code while ensuring that the implementation aligns with the intended functionality.
Expected vs. Actual Behavior Table
Create a detailed table comparing the expected behavior and actual output of the 'calculateTotal' function. The table should include the following columns: 'Input', 'Expected Output', 'Actual Output', and 'Notes on Input Validation'. For each input scenario, describe how the function validates inputs based on the linting rules, specify the expected output, and document the actual output. Additionally, identify any discrepancies between the expected and actual behavior, and provide potential reasons for these differences.
Identify the Violated Linting Rule
Identify the specific ESLint rule that was violated in the last generated code. Provide the exact clause from your configuration that was not adhered to, explain why this rule is important for maintaining code quality, and suggest a brief solution or adjustment that could be made to the code to comply with this rule. Format your response clearly, outlining the rule, the clause, and the suggested fix in a structured manner.
Target the specific areas of code that are causing linting violations. Focus on the lines indicated by the linting errors.
Inline Fix for Unused Variables
Remove the unused variable declaration 'tempValue' in the file 'SRC/UTILS.JS'. After removing it, ensure that the code remains functional and check for any other potential unused variables in the same file. Additionally, provide a brief explanation of the changes made and discuss any impact on the overall code quality.
Rewrite Function with Linting Constraints
Rewrite the 'fetchData' function located in 'SRC/API.JS' to ensure compliance with the 'CONSISTENT-RETURN' linting rule. Structure the function so that every possible code path returns a value, whether it is a successful data fetch or an error handling scenario. Provide the complete function code, highlight any changes made to meet this requirement, and include comments explaining the logic behind your modifications for clarity.
Scoped Change for Formatting
Adjust the JSX formatting in the file 'src/components/Button.js' to ensure compliance with Prettier rules. Focus on correcting issues with indentation, spacing, and overall structure to enhance readability. After making the adjustments, provide a detailed summary of the changes made, highlighting specific areas where formatting was improved or corrected. Ensure that the final output is clean and adheres to best practices for JSX formatting.
Enforce Import Order
Rearrange the import statements in the file 'SRC/INDEX.JS' to comply with ESLint rules regarding import order. Organize the imports by listing external libraries first, followed by local imports, ensuring each import is clearly separated for readability. After making these changes, provide a brief summary of the modifications you implemented.
Correct Dependency Import
Add the following import statement to the top of the 'src/services/apiService.js' file: 'import axios from 'axios';'. Ensure that this import is placed before any other code in the file to resolve the dependency issue related to the missing 'axios' import. After making this change, run the file to verify that it functions correctly and does not produce any errors related to the 'axios' dependency.
Confirm that the linting violations have been resolved by checking the output of ESLint after the fixes.
Run ESLint to Confirm Fixes
Run ESLint on the entire project and provide a detailed output of the results. Include a summary of any remaining linting violations, specifying the files and lines where these violations occur. Confirm that all previously identified issues have been resolved and provide recommendations for maintaining code quality moving forward. Ensure the output is formatted clearly for easy review.
Show Diff of Changes Made
Provide a detailed diff of the changes made to the file 'src/app.js' after addressing the linting issues. Include line numbers for each modification and clearly indicate which lines were added, removed, or altered. Additionally, summarize the nature of the changes and explain how they improve code quality or adhere to the linting standards. Format the output in a clear and readable manner.
Replay the Original Linting Scenario
Re-run the scenario that previously caused linting errors in the file 'SRC/UTILS.JS'. Ensure that the code executes without producing any linting violations this time. Provide a summary of the changes made to resolve the issues, and confirm whether the original errors have been eliminated. If there are still issues, detail what they are and suggest possible solutions.
Check Edge Case for Linting
Verify the edge case in the file 'SRC/COMPONENTS/FORM.JS' where form submission may trigger linting errors. Analyze the code to identify any potential issues that could arise during submission, ensuring adherence to all relevant linting rules. Provide a detailed report outlining any errors found, suggested fixes, and explain how these changes will improve code quality and maintainability. Additionally, include examples of how the code should look after the corrections are made, highlighting the specific changes implemented.
Confirm File State After Fixes
Check the state of the file 'SRC/API.JS' after implementing the necessary fixes. Verify that the file complies with all relevant linting rules and does not display any errors. Provide a detailed report of any remaining issues, including the specific linting rules that are not met, and suggest possible solutions for each issue identified. Additionally, include a summary of the changes made to the file to achieve compliance.
Create artefacts that help prevent future linting violations in Replit.
Linting Rule Enforcement Prompt
Create a system prompt that automatically enforces specific ESLint rules before generating any code. Ensure compliance with the following ESLint rules: [LIST OF SPECIFIC RULES]. If any rule is violated, notify the user with details about which rules were not followed and explain the importance of compliance. Additionally, provide suggestions for corrections or improvements to align the code with the linting standards. This enforcement should happen seamlessly before any code generation occurs.
Pre-Deployment Lint Check Message
Create a project convention message that emphasizes the importance of code quality before deployment. The message should include the statement: 'Before deployment, ensure all code passes ESLint checks. If any violations exist, do not proceed with deployment until they are resolved.' Additionally, provide a brief explanation of why adhering to linting rules is crucial for maintaining code quality and preventing potential issues in production. Ensure the tone is clear and professional, making it easily understandable for all team members.
Code Comment Guard for Linting
Add a code comment guard at the top of the file 'src/index.js'. The comment should state: '// Linting rules must be followed. Any violations will result in a build failure. Please adhere to the following rules: [LIST OF RULES].' Ensure that the list of rules is comprehensive, covering all necessary linting guidelines relevant to this project, and format the comment clearly for easy readability and visibility by all developers working on this codebase.
Self-Check Request for Linting
Create a self-check request for an agent to ensure code quality in the current project. Before generating any code, verify adherence to the following linting rules: [LIST OF RULES]. If any rules are violated, provide a clear alert to the user detailing which specific rules are not being followed and suggest corrective actions for each violation. Additionally, include a summary explaining the importance of adhering to these linting standards for maintaining overall code quality and consistency in the project.
Conversation-Starter for Linting Issues
Create a conversation-starter template for discussing linting issues in a team setting. Begin with an introduction that acknowledges recent code generation and emphasizes the importance of maintaining code quality. Next, outline specific linting violations that have been identified, and suggest a collaborative approach for the team to review these issues together. Finally, provide actionable steps for how the team can address these violations and prevent them from recurring in future code generations. Ensure the message is clear, professional, and encourages open dialogue among team members.
If Replit is ignoring your ESLint configuration, check if the configuration file is correctly named and located in the root of your project. Replit requires the '.eslintrc' file to be in the project root to apply the rules.
To ensure your code follows Prettier formatting in Replit, make sure the '.prettierrc' file is present in your project root. Replit uses this file to format your code automatically when you save.
This discrepancy may occur if your local environment has different ESLint or Prettier versions compared to Replit. Ensure that both environments use the same versions to avoid inconsistencies.
Ignoring linting errors in Replit can lead to runtime errors and bugs that are difficult to trace. The AI may generate code that does not adhere to best practices, resulting in a lower quality codebase.
To troubleshoot linting issues in Replit, start by reviewing the ESLint output for specific error messages. This output will guide you to the exact lines of code that need attention.
AI Prompts for Aligning Code with Linting Rules
Cursor generates code that violates existing ESLint or Prettier rules, causing integration issues and potential bugs.
See promptsAI Prompts for Ensuring Code Follows Linting Rules
Windsurf may generate code that violates existing ESLint, Prettier, or other linting rules, causing integration issues.
See promptsAI Prompts for Ensuring Code Adheres to Linting
Claude Code generates code that violates existing ESLint or Prettier rules, causing integration issues and potential bugs.
See prompts