-
-
Notifications
You must be signed in to change notification settings - Fork 26
feat: Output defineConfig in file #156
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
Conversation
Co-authored-by: 唯然 <[email protected]>
|
Ping @eslint/eslint-tsc |
aladdin-add
left a comment
There was a problem hiding this 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.
mdjermanovic
left a comment
There was a problem hiding this 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.
lib/config-generator.js
Outdated
| }; | ||
|
|
||
| exportContent += ` {languageOptions: { ${envContent[this.answers.env.join(",")]} }},\n`; | ||
| exportContent += ` { files: ["**/*.js"], languageOptions: { ${envContent[this.answers.env.join(",")]} } },\n`; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
lib/config-generator.js
Outdated
| 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"; |
There was a problem hiding this comment.
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.)
@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. |
mdjermanovic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
|
Oh, I didn't see this comment.
I was referring to #156 (comment) and #156 (comment). I was thinking about removing |
This updates the command to use
defineConfig()in the output file. I also cleaned up some of the spacing and switched toextendswhere appropriate.Updates to ESLint Configuration Generation:
pathandurlto usenode:pathandnode:urlrespectively, and replacedpluginJswithjsfrom@eslint/js. (lib/config-generator.js) [1] [2] [3]defineConfigfromeslint/configinstead of array concatenation. (lib/config-generator.js)Changes in Test Snapshots:
defineConfigfor various ESLint configurations. This includes updates for configurations likeeslint-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.