2019-08-21 16:01:23 -04:00
|
|
|
# stylelint
|
|
|
|
GitHub Action that runs [stylelint](https://stylelint.io).
|
|
|
|
|
|
|
|
## Usage
|
2019-10-25 13:35:47 -04:00
|
|
|
To use stylelint in your workflow just add this step:
|
2019-08-21 16:01:23 -04:00
|
|
|
|
|
|
|
```yaml
|
2019-10-25 13:35:47 -04:00
|
|
|
- name: stylelint
|
|
|
|
uses: actions-hub/stylelint@master
|
2019-08-21 16:01:23 -04:00
|
|
|
```
|
|
|
|
|
2019-10-25 13:35:47 -04:00
|
|
|
## Configuration
|
2019-11-11 06:59:30 -05:00
|
|
|
Action has 3 parameters which you can set:
|
|
|
|
- PATTERN - Pattern for style files.
|
|
|
|
- CONFIG_PATH - Path to stylelint configuration file
|
|
|
|
- INDENT_SPACE - Space indentation
|
|
|
|
|
2020-11-09 17:28:50 -05:00
|
|
|
This parameters can be set through environment variables:
|
2019-11-11 06:59:30 -05:00
|
|
|
```yaml
|
|
|
|
- uses: actions-hub/stylelint@master
|
|
|
|
env:
|
|
|
|
INDENT_SPACES: 4
|
|
|
|
PATTERN: "*.scss"
|
|
|
|
```
|
|
|
|
|
2019-10-25 13:35:47 -04:00
|
|
|
### .stylelintrc
|
|
|
|
By default, action will try to find an existing configuration file in the project.
|
|
|
|
If the configuration file will not found, it will be created with the next configuration:
|
2019-08-21 16:17:49 -04:00
|
|
|
|
2019-08-21 16:01:23 -04:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"extends": "stylelint-config-standard",
|
|
|
|
"rules": {
|
|
|
|
"indentation": 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-10-25 13:35:47 -04:00
|
|
|
### File pattern
|
|
|
|
If you want to specify which file or types must be validated.
|
2019-11-11 06:59:30 -05:00
|
|
|
You need to pass the pattern as a `PATTERN` variable.
|
2019-10-25 13:35:47 -04:00
|
|
|
By default, it will try to find `*.css`.
|
|
|
|
|
|
|
|
### Indentation
|
|
|
|
Indentation can be set by environment variable `INDENT_SPACES`.
|
2019-11-11 06:59:30 -05:00
|
|
|
By default space, indent is 2.
|
2019-08-21 16:01:23 -04:00
|
|
|
|
|
|
|
```yaml
|
2019-10-25 13:35:47 -04:00
|
|
|
- uses: actions-hub/stylelint@master
|
2019-11-11 07:12:02 -05:00
|
|
|
ENV:
|
|
|
|
INDENT_SPACES: 4
|
2019-08-21 16:01:23 -04:00
|
|
|
```
|
|
|
|
|
2019-10-25 13:35:47 -04:00
|
|
|
## Example
|
|
|
|
### Default values
|
|
|
|
```bash
|
|
|
|
name: Test
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
linters:
|
|
|
|
name: stylelint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- uses: actions-hub/stylelint@master
|
|
|
|
```
|
|
|
|
|
2019-11-11 06:59:30 -05:00
|
|
|
### Custom paramenters
|
2019-10-25 13:35:47 -04:00
|
|
|
```bash
|
|
|
|
name: Test
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
linters:
|
|
|
|
name: stylelint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- uses: actions-hub/stylelint@master
|
2019-11-11 07:12:02 -05:00
|
|
|
env:
|
|
|
|
PATTERN: "*.scss"
|
|
|
|
INDENT_SPACES: 4
|
2019-10-25 13:35:47 -04:00
|
|
|
```
|
|
|
|
|
2019-08-21 16:01:23 -04:00
|
|
|
## License
|
2020-11-09 17:28:50 -05:00
|
|
|
[MIT License](https://github.com/actions-hub/stylelint/blob/master/LICENSE)
|