Skip to content

Instantly share code, notes, and snippets.

@nirtamir2
Created September 25, 2021 10:35
Show Gist options
  • Select an option

  • Save nirtamir2/64933d0460df2085b9ac3b89e9ee85f0 to your computer and use it in GitHub Desktop.

Select an option

Save nirtamir2/64933d0460df2085b9ac3b89e9ee85f0 to your computer and use it in GitHub Desktop.

Revisions

  1. nirtamir2 created this gist Sep 25, 2021.
    55 changes: 55 additions & 0 deletions Stylelint.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,55 @@
    # Stylelint

    ```bash
    yarn add -D stylelint stylelint-config-standart stylelint-config-prettier
    ```

    ## Order

    If you want order

    ```bash
    yarn add -D stylelint-order
    ```

    And choose one of the scripts:

    ```bash
    yarn add -D stylelint-config-rational-order
    yarn add -D stylelint-config-idiomatic-order
    yarn add -D stylelint-config-rational-order
    ```

    ## Configuration

    Create `.stylelintrc.json` that includes:

    ```js
    module.exports = {
    extends: [
    "stylelint-config-standard",
    // Order (choose one)
    // "stylelint-config-recess-order",
    // "stylelint-config-idiomatic-order",
    // "stylelint-config-rational-order",
    "stylelint-config-prettier",
    ],
    };
    ```

    ## Scripts

    Edit `package.json`:

    ```json
    {
    "scripts": {
    "lint": "eslint . --ext ts --ext tsx --ext js && stylelint --fix **/*.css"
    },
    "lint-staged": {
    "*.@(ts|tsx|js)": ["yarn lint", "prettier --write"],
    "*..@(json|md)": "prettier --write",
    "*.css": ["stylelint --fix", "prettier --write"]
    }
    }
    ```