Skip to content

Conversation

@nzakas
Copy link
Member

@nzakas nzakas commented Mar 10, 2025

This updates the command to use defineConfig() in the output file. I also cleaned up some of the spacing and switched to extends where appropriate.

Updates to ESLint Configuration Generation:

  • Updated imports from path and url to use node:path and node:url respectively, and replaced pluginJs with js from @eslint/js. (lib/config-generator.js) [1] [2] [3]
  • Changed the export format to use defineConfig from eslint/config instead of array concatenation. (lib/config-generator.js)

Changes in Test Snapshots:

  • Updated snapshot files to reflect the new import paths and the use of defineConfig for various ESLint configurations. This includes updates for configurations like eslint-config-airbnb, eslint-config-standard, eslint-config-xo, and more. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]

These changes ensure that the ESLint configuration generation is up-to-date with the latest standards and improve the maintainability of the codebase.

@nzakas
Copy link
Member Author

nzakas commented Mar 18, 2025

Ping @eslint/eslint-tsc

aladdin-add
aladdin-add previously approved these changes Mar 19, 2025
Copy link
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

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

LGTM. Would like another review before merging.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

Looks good to me, except for added files. I think it would be better to implement that change as part of #151.

};

exportContent += ` {languageOptions: { ${envContent[this.answers.env.join(",")]} }},\n`;
exportContent += ` { files: ["**/*.js"], languageOptions: { ${envContent[this.answers.env.join(",")]} } },\n`;
Copy link
Member

Choose a reason for hiding this comment

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

Restricting globals to .js files might not be desirable, particularly when additional extensions are included in linting based on the answers. For example, browser globals wouldn't be available in .jsx files.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I'll make that update.

importContent += "import pluginJs from \"@eslint/js\";\n";
exportContent += " pluginJs.configs.recommended,\n";
importContent += "import js from \"@eslint/js\";\n";
exportContent += " { files: [\"**/*.js\"], plugins: { js }, extends: [\"js/recommended\"] },\n";
Copy link
Member

Choose a reason for hiding this comment

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

Similar to my previous comment, this should probably apply to more files (.cjs, .mjs, then .jsx if it's included in linting, etc.)

@nzakas
Copy link
Member Author

nzakas commented Mar 20, 2025

Looks good to me, except for added files. I think it would be better to implement that change as part of #151.

@mdjermanovic can you explain what you mean by "added files"? I don't follow.

And #151 hasn't made much progress. I'd rather not hold this PR waiting for that one.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit f607c76 into main Mar 20, 2025
12 checks passed
@mdjermanovic mdjermanovic deleted the define-config branch March 20, 2025 15:33
@github-actions github-actions bot mentioned this pull request Mar 20, 2025
@mdjermanovic
Copy link
Member

Oh, I didn't see this comment.

Looks good to me, except for added files. I think it would be better to implement that change as part of #151.

@mdjermanovic can you explain what you mean by "added files"? I don't follow.

And #151 hasn't made much progress. I'd rather not hold this PR waiting for that one.

I was referring to #156 (comment) and #156 (comment). I was thinking about removing files: ["**/*.js"] that was added in this PR but 4a2a6ce fixed this in a different way that also looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants