FG
🛠️ Developer Tools

ESLint 2.0.0 Wish List [$10]

Freshabout 21 hours ago
Mar 14, 20260 views
Confidence Score55%
55%

Problem

As we are getting closer and closer to v1.0.0, it's time to start thinking about what a v2.0.0 would look like. Here are the things that have either come up recently or have been on my mind: - Autofix option - This has come up at least three times as a request. Originally I was pretty against it, but I'm starting to warm up to the idea. The idea is optionally fix certain types of issues instead of just reporting them. While this won't be possible for 100% of the rules, even a small percentage could make a big difference. - Autocreate config by looking at code - We need a way to make it easier to get started. Manually configuring over 100 rules is a painful process. It would be nice to be able to give ESLint a file and say "create me a config that matches the styles in this file". What other ideas do you have about big things we could tackle for 2.0.0? <bountysource-plugin> Did you help close this issue? Go claim the $10 bounty on Bountysource. </bountysource-plugin>

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Implement Autofix and Autocreate Config Features for ESLint 2.0.0

Medium Risk

The current version of ESLint lacks features that allow automatic fixing of certain linting issues and the ability to generate configuration files based on existing code styles. This limitation makes it cumbersome for developers to adopt ESLint and maintain consistent coding standards across projects.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Design Autofix Feature

    Identify the rules that can be automatically fixed and design an interface for the autofix feature. This will involve creating a mapping of rules to their corresponding fixable actions.

    javascript
    const fixableRules = { 'no-unused-vars': fixUnusedVars, 'quotes': fixQuotes };
  2. 2

    Implement Autofix Logic

    Develop the logic to apply autofixes to the identified rules. This will require modifying the ESLint engine to include a new command-line option for autofixing.

    bash
    eslint --fix file.js
  3. 3

    Create Autocreate Config Feature

    Develop a feature that analyzes a given JavaScript file and generates an ESLint configuration file based on the coding styles and rules used in that file. This will involve parsing the file and extracting style preferences.

    javascript
    const config = generateConfigFromFile('example.js');
  4. 4

    Integrate Features into ESLint CLI

    Integrate both the autofix and autocreate config features into the ESLint command-line interface, allowing users to easily access these functionalities.

    bash
    eslint --autofix --autocreate-config file.js
  5. 5

    Testing and Validation

    Create a suite of tests to validate the functionality of the new features. Ensure that the autofix feature correctly applies fixes and that the autocreate config feature generates accurate configurations.

    bash
    npm test

Validation

To confirm the fix worked, run ESLint on a sample JavaScript file with known linting issues and check if the autofix option resolves them. Additionally, provide a sample file to the autocreate config feature and verify that the generated config matches the expected coding styles.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

eslintlintingjavascriptbountyarchived-due-to-age