Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document using stylelint inside npm-scripts #6396

Merged
merged 1 commit into from Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/user-guide/get-started.md
Expand Up @@ -27,6 +27,8 @@ npm install --save-dev stylelint stylelint-config-standard
npx stylelint "**/*.css"
```

_You should include quotation marks around file globs._

If you use a pretty printer alongside Stylelint, you should turn off any conflicting rules. For example, you can use [Prettier's shared config](https://www.npmjs.com/package/stylelint-config-prettier) to do that:

```shell
Expand Down Expand Up @@ -67,6 +69,8 @@ npm install --save-dev stylelint stylelint-config-standard-scss
npx stylelint "**/*.scss"
```

_You should include quotation marks around file globs._

This config includes the [postcss-scss syntax](https://www.npmjs.com/package/postcss-scss), configures the [built-in rules](../user-guide/rules.md) for SCSS, and includes the [stylelint-scss plugin](https://www.npmjs.com/package/stylelint-scss) (a collection of rules specific to SCSS).

If you use Prettier alongside Stylelint, you should use their [shared config for SCSS](https://www.npmjs.com/package/stylelint-config-prettier-scss):
Expand Down
14 changes: 13 additions & 1 deletion docs/user-guide/usage/cli.md
Expand Up @@ -6,6 +6,18 @@ You can use Stylelint on the command line. For example:
npx stylelint "**/*.css"
```

_You should include quotation marks around file globs._

If you are using [npm scripts](https://docs.npmjs.com/cli/v8/using-npm/scripts), you'll need to escape the quotes:

```json
{
"scripts": {
"lint": "stylelint \"**/*.css\""
}
}
```

Use `npx stylelint --help` to print the CLI documentation.

## Options
Expand Down Expand Up @@ -112,7 +124,7 @@ Show the currently installed version of Stylelint.

The CLI expects input as either a [file glob](https://github.com/sindresorhus/globby) or `process.stdin`. It outputs formatted results into `process.stdout`.

_Be sure to include quotation marks around file globs._
_You should include quotation marks around file globs._

### Example A - recursive

Expand Down