Description
What is the problem you're trying to solve?
Currently, when initializing a new stylelint configuration using npm init stylelint
, the process implicitly assumes the use of npm as the package manager. This can be inconvenient for projects that utilize other package managers like pnpm or yarn. For instance, as demonstrated in the provided terminal output, when initializing ESLint with @eslint/config
, the tool explicitly asks "Which package manager do you want to use?".
1. Example eslint init output:
npm init @eslint/config@latest
Need to install the following packages:
@eslint/[email protected]
Ok to proceed? (y) y
> [email protected] npx
> create-config
@eslint/create-config: v1.4.0
√ How would you like to use ESLint? · problems
√ What type of modules does your project use? · esm
√ Which framework does your project use? · none
√ Does your project use TypeScript? · typescript
√ Where does your code run? · browser
The config that you've selected requires the following dependencies:
eslint, globals, @eslint/js, typescript-eslint
√ Would you like to install them now? · No / Yes
√ Which package manager do you want to use? · pnpm
☕️Installing...
When stylelint initializes and installs dependencies, it uses npm. If a project is using pnpm, for example, the developer then needs to manually manage the dependencies. This extra step can be streamlined.
2. Example stylelint init output:
> [email protected] npx
> create-stylelint
✔ Created .stylelintrc.json.
✔ Installed packages.
You can now lint your CSS files using:
npx stylelint "**/*.css"
We recommend customizing Stylelint:
https://stylelint.io/user-guide/customize/
What solution would you like to see?
I propose adding an interactive option during the npm init stylelint process that allows users to select their preferred package manager. This could be implemented as a prompt similar to the one used by @eslint/create-config.
Which package manager do you want to use for installing dependencies?
npm
> pnpm
yarn