Skip to content

feat: update UI, fix generator, add dependencies, and change utilities #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

hyperz111
Copy link

@hyperz111 hyperz111 commented Jun 29, 2025

Update UI, Fix Generator, Add Dependencies, and Change Utilities

In this PR, i do:

  • Update the UI
  • Fix generator
  • Add dependencies
  • Change utilities

What's changes?

  1. Now if you close the prompt by pressing ctrl+c/cmd+c, this is not give this message.

    ✖ What do you want to lint? · No items were selected
    
    node:internal/modules/run_main:122
        triggerUncaughtException(
        ^
    
    (Use `node --trace-uncaught ...` to show where the exception was thrown)
    
    Node.js v22.15.1
    

    But give this message.

    ✖ What do you want to lint? · No items were selected
    ✖ Operation cancelled.
    
  2. Now logging utilities is have success() function. And some change for some function.

    // warn()
    warn('Warning') // => ⚠ Warning
    
    // error()
    error('Error') // => ✖ Error
    
    // success()
    success('Success') // => ✔ Success
  3. Now when you create config using flat style. This is NOT have 2 lines between import and export contents.

    Before:

    // import content...
    import { defineConfig } from "eslint/config";
    // line 1
    // line 2
    export default defineConfig([
      // export config...
    ]);

    After:

    // import content...
    import { defineConfig } from "eslint/config";
    // line 1
    export default defineConfig([
      // export config...
    ]);
  4. Edit plural for dependencies message.

    Before:

    ✔ What do you want to lint? · No items were selected
    ✔ How would you like to use ESLint? · problems
    The config that you've selected requires the following dependencies:
    
    eslint
    ? Would you like to install them now? › No / Yes
    

    After:

    ✔ What do you want to lint? · No items were selected
    ✔ How would you like to use ESLint? · problems
    The config that you've selected requires the following dependency:
    
    eslint
    ? Would you like to install them now? › No / Yes
    
  5. Show warning if your Node.js version is NOT compatible.

    @eslint/create-config: v1.9.0
    
    ⚠ Need Node.js version ^18.18.0, or ^20.9.0, or >=21.1.0. But your 
    Node.js version is 11.0.4. Please upgrade your Node.js first.
    
  6. Import package.json instead read package.json (./bin/create-config.js).

  7. Now questions prompt UI is updated. See UI Updates

  8. Add ansi-colors package, enquirer (Used UI Prompt Library) dependency.

UI Updates

  1. Error messages color now red.
  2. Multiselect indicator now radio.
  3. Add colors in intro.
  4. Messages style now NOT bold.

Copy link

linux-foundation-easycla bot commented Jun 29, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@eslint-github-bot
Copy link

Hi @hyperz111!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@hyperz111 hyperz111 changed the title Update UI, Fix Generator, Add Dependencies, and Change Utilities feat: update UI, fix generator, add dependencies, and change utilities Jun 29, 2025
import fs from "node:fs/promises";
import semverSatisfies from "semver/functions/satisfies.js";
import colors from "ansi-colors";
import pkg from "../package.json" with {type:"json"};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supported in node.js v18?

Copy link
Author

@hyperz111 hyperz111 Jun 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot_2025_0629_231801.png

Stable for v18.20.0 and up

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the officially supported version is ^18.18.0 || ^20.9.0 || >=21.1.0. but I feel it's fine - as it is only executed once during configuration generation and does not appear in the generated files. thoughts? @eslint/eslint-team

if (!semverSatisfies(myNodeVersion, compatibleVersionRange)) {
warn(`Need Node.js version ${compatibleVersionRangeText}. But your Node.js version is ${myNodeVersion}. Please upgrade your Node.js first.`);
// eslint-disable-next-line n/no-process-exit -- Exit gracefully
process.exit(0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
process.exit(0);
process.exit(1);

@hyperz111
Copy link
Author

Hello, can i use @clack/prompts instead enquirer?

Note

@clack/prompts it's in ALPHA phase

@aladdin-add
Copy link
Member

Hello, can i use @clack/prompts instead enquirer?

Note

@clack/prompts it's in ALPHA phase

I'm open to it. can you explain what's the benefits? (and maybe better open a new issue - let's try not to do too many things in one pr).

@@ -3,6 +3,7 @@

import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "eslint/config";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defineConfig has been imported in line 1.

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Jul 4, 2025
@aladdin-add aladdin-add moved this from Needs Triage to Implementing in Triage Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Implementing
Development

Successfully merging this pull request may close these issues.

2 participants