-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Update: move init command to separate package #58
Conversation
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.
This RFC brings up an interesting point. I know the idea of splitting ESLint into multiple packages has been discussed over the years, and I do think it's worth considering whether or not that's something we would like to do:
In my mind, there are four packages in ESLint core:
- CLI
- Core
- Core rules
eslint-config-eslint
Pros of splitting core up into multiple packages:
- We can version each of these separately, which means that rule breaking changes can be released independently of breaking changes in core, which can be released independently of CLI breaking changes, etc. This could allow us to ease the upgrade path for folks, as well as not having to tie all these disparate responsibilities to each other and to one annual major release.
- Maintaining each individual package could make it easier for contributors to focus on the part of the project they're most excited about contributing to.
Cons:
- Coordinating releases where one package relies on the changes of another would become more burdensome. As an example, adding optional chaining support to core would have to be coordinated with the change to core rules (though this is easily fixed by release core first and then updating the rules and releasing them afterward).
- General maintenance burden could be increased. Monorepos bring there own set of challenges, as do projects split across multiple repos. I think I would advocate against the monorepo approach if we decided to take this on.
I know this isn't exactly what this RFC is about, but I do see this discussion as a prerequisite to implementing an RFC like this because we should decide up front what the responsibilities of each package will be.
Not sure this is related to this RFC but...
While this separation makes sense, I think separating by functionality would be significantly more beneficial. I would separate it into: |
Thank you for your contribution! Actually, that's what I wanted to do (eslint/eslint-cli#4), but I didn't have the energy for it at that time. The Or, the |
@kaicataldo agreed with your comment. true Even a monorepo makes sense for me. The problems come while setting up a monorepo i.e the initial stage. About the release, I think it makes sense to go for a custom script for releasing instead of using monorepo management tool. @ilyavolodin I think it that way, it will increase the number of packages, cause I can think of adding ruleTester, scope manager, config resolver as a separate package as well?
@mysticatea I think |
I like the idea of creating a new |
I'd definitely like to split out
That could install the latest ESLint (if necessary) and then walk people through the regular setup. I'm 👍 to removing from the core, just not in favor of adding to |
I am +1 for both the options (moving to one con of using it in the Else, I think but as the name is concerned, it might be misleading as it can mean, create eslint plugin as well. I am thinking like |
I'm not in favor of adding more into And for a separate utility, I'd prefer new packages we create use the |
Cool, Can you name the package. I think |
I think we can shorten it a big to just |
I also really like this idea. As far as the name goes, based on the npm docs and yarn source code (the naming permutations aren't as well documented), I summarized the options thrown out so far in the table below:
I prefer
|
Thanks @btmills for the details
I will update the RFC soon. |
To me, |
That's a good point @mysticatea. So what if we did use |
I was thinking that What do you think? |
I think you're expanding the scope beyond what After thinking about it some more, I think We already have a Yeoman package for doing things like creating shareable configs. Maybe we could look at updating that in some way, but I wouldn't want to combine it with this RFC. |
👍 for (Off-topic: In my feeling, the most general name |
My concern with |
@btmills I'm not sure I understand what you're saying here. Can you explain some more? |
Sure. In addition to In the table above, I looked at a bunch of different name options and how they'd work with (I initially preferred |
Ah, I see! I actually had not been aware of this change to
Given that, and the helpful explanation from @btmills, I support |
I have updated the change. One question : I dont think we can create a repo in github with name or another option can be to create a repo name Thoughts ? |
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.
I think the high-level direction is solid now, I'd just like to see more details about how you plan on implementing this. (See comments inline.)
you can remove this section. | ||
--> | ||
|
||
Do we want to implement this as monorepo under `eslint` repo or a separate repo `@eslint/create` but github will make it as `eslint-create` or similar ? |
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.
I don't think we want to start going in the monorepo direction for this. We already have trouble dealing with eslint-config-eslint
, so I'd much rather have a separate repo for this.
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.
what should be the name of that ?
we cannot have it as @eslint/create
as it will create name as -eslint-create
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.
I don't think it's a big deal if the repo is called eslint-create
. That's a pretty common convention I've seen in other projects that use namespaced package names!
- `shelljs` | ||
- create `tests/utils` and add the following functions | ||
- [`defineInMemoryFs`](https://github.com/eslint/eslint/blob/6677180495e16a02d150d0552e7e5d5f6b77fcc5/tests/_utils/in-memory-fs.js#L250) | ||
- for `conf/*`, it is not a part of the public API and it cant be accessed from `eslint` module, we need a keep these synced with the main repo (`eslint`). We can choose from the following approach to solve this : |
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.
Can you elaborate on what we need this for? Is the data we need from here something we could calculate on the fly somehow? I don't think the extra calculation cost is too big a deal since this is intended to be run as a one and done script.
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.
I'm also confused by this. I don't think --init
needs anything in conf
directly.
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.
It is using it like here so I think we need to move this to the new repo right ?
May be I am missing something.
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.
Another auto config dependency. I think we should get rid of auto config to simplify things.
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.
Thanks for the additional details. This really helps me understand what you're thinking. I've left a few more questions for you.
- `enquirer` | ||
- `progress` | ||
- `semver` | ||
- `espree` (peer) |
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.
This will be brought in by including eslint
, so we don't need to include it separately.
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.
Yeah I added peer
to indicate the similar.
I will remove it .
- `shelljs` | ||
- create `tests/utils` and add the following functions | ||
- [`defineInMemoryFs`](https://github.com/eslint/eslint/blob/6677180495e16a02d150d0552e7e5d5f6b77fcc5/tests/_utils/in-memory-fs.js#L250) | ||
- for `conf/*`, it is not a part of the public API and it cant be accessed from `eslint` module, we need a keep these synced with the main repo (`eslint`). We can choose from the following approach to solve this : |
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.
I'm also confused by this. I don't think --init
needs anything in conf
directly.
- for `conf/*`, it is not a part of the public API and it cant be accessed from `eslint` module, we need a keep these synced with the main repo (`eslint`). We can choose from the following approach to solve this : | ||
- using the `eslint-github-bot`, whenever there is a PR opened that changes the file for the `conf` directory in `eslint` repo, create an issue in the `@eslint/create` repo to have a look in the PR and if required submit a change in `@eslint/create`. | ||
- OR, while doing the release for both `eslint` and `@eslint/create` repos, the release script can be configured to copy-parse the `conf` folder from `eslint` to `@eslint/create` before the release just like the `website` repo is being updated currently. | ||
- After completion of this repo, whenever someone uses the `--init` flag, an error will be thrown stating the correct step to do the migration i.e using `npx @eslint/create` or `npm @eslint` or `yarn @eslint`. I am not suggesting to use run the `@eslint/create` module whenever `--init` command is being called because this would require to use the `@eslint/create` module as a dependency in `eslint` and in `@eslint/create` we are already being using `eslint` as a dependency, so there would be circular dependencies. |
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.
Why does @eslint/create
need to depend directly on eslint
?
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.
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.
I’d say let’s just get rid of auto config altogether. I don’t think it’s that useful anymore. Plus, we can avoid a direct dependency on ESLint that way.
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.
A tool like eslint-nibble will be a much better experience than autoconfig, so I have no problem with removing it 👍
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.
Sorry but I am not getting what do you mean with auto-config ? is it the whole --init all together? or conf/*
? or something else ?
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.
Cool, Thanks for the details.
make sense to remove autoconfig
But still, we need to use eslint
as (peer)-dependency as mentioned here
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.
Are linter and CLIEngine used outside of auto config?
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.
no I guess, cliEngine is being used in source-code-utils
but I guess if we are removing the autoconfig then we don't need that either.
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.
Okay, sounds like we are on the right track. I'd suggest updating this RFC with the latest agreements. I think we're close!
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.
I had such high hopes for autoconfig, but I agree that it was never terribly useful, partly because it only worked if you were already strictly following a convention. I'm actually surprised it hasn't been removed already. :)
This RFC looks like a great move. I love what y'all are doing and hope everyone is well and having a happy new year!
Yes as it will be a major change for the `eslint` repo itself as it is being remove from the main package/repo, I guess a blog can be a good solution to solve inital queries. | ||
Documentation for `@eslint/create` will be created with proper usage and each prompt's details. In the main documentation, a link to `@eslint/create` will be given [here](https://github.com/eslint/eslint/blob/master/docs/user-guide/command-line-interface.md#--init) and basic usage and the package details will be documented below as a deprecated notice and migration guide. | ||
Also in the cli command options, [here](https://github.com/eslint/eslint/blob/master/docs/user-guide/command-line-interface.md#options), for `--init` we need to change the description for this with deprecated details as the command is still active just that there will be error that will recommend to use `@eslint/create` package instead. | ||
Yes as it will be a major change for the `eslint` repo itself as it is being removed from the main package/repo, I guess a blog can be a good solution to solve initial queries. |
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.
I'm not sure that this is a breaking change. Most people only use the command once, so we're not in danger of breaking anyone's build. I'd say this is a semver-minor change.
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.
Though I have not seen any project where it is being used in the build or in the testing so yea agreed, it is a semver-minor
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.
Provided eslint --init
automatically calls npx @eslint/create
, I agree we can say this is semver-minor. I can imagine a scenario where removing autoconfig in @eslint/create
breaks setup documentation someone might have published, but I don't think that rises to the level of a breaking API change.
Releasing with a proper message which the command is being run from `eslint` with something like - `"this command has been moved from here, use 'npx @eslint/create'"` might be a good way to address backward compatibility. | ||
Otherwise we can keep the feature in the main repo as well for starting few days/weeks with a warning and then removing it completing with an error message. | ||
- Releasing with a proper message which the command is being run from `eslint` with something like - `"this command has been moved from here, use 'npx @eslint/create'"` might be a good way to address backward compatibility. | ||
- Or whenever `--init` command is being used, show a warning and run `npx @eslint/create` using `child_process` of the native node modules. |
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.
I think we can just run npx @eslint/create
directly without a warning message. We'll still get the benefit of not including all of the init functionality in the main package and we'd minimize the chance of problems if someone came across some old documentation. At most we may want to just output a message like "You can also run this command directly using npm init @eslint".
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.
I think we can make use of the output message "You can also run this command directly using npm init @eslint".
?
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.
That works too. We should use whatever we end up documenting in the getting started guide.
Sorry, for the delay. I will try to complete it by this weekend. |
@anikethsaha are you still working on this? |
I didnt get time for this, nor sure about whether I will get in near future. |
Okay, thanks for letting us know. |
I will take over this one. :) |
Thanks @aladdin-add! |
Closing in favor of #79 |
Summary
Move the init command to eslint-cli
Move the whole logic to the
eslint-cli
repo. Use the shippedshared
folder from the main repo to theeslint-cli
repoRelated Issues
N/A