Skip to content

Commit

Permalink
Document using stylelint inside npm-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jeddy3 committed Oct 7, 2022
1 parent 168b71a commit 6a9d611
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
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

0 comments on commit 6a9d611

Please sign in to comment.