# @blueprint-modernized/stylelint-plugin

> Stylelint rules for use with @blueprint-modernized packages

Latest version **2.0.4** (published 2022-04-10) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @blueprint-modernized/stylelint-plugin
pnpm add @blueprint-modernized/stylelint-plugin
yarn add @blueprint-modernized/stylelint-plugin
bun add @blueprint-modernized/stylelint-plugin
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score; popular repo.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2022-04-10 |
| First published | 2022-04-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 83.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22184 |
| Author | Palantir Technologies |
| Maintainers | michael_nocode |

## Links

- npm: https://www.npmjs.com/package/@blueprint-modernized/stylelint-plugin
- Repository: https://github.com/palantir/blueprint
- Homepage: https://github.com/palantir/blueprint#readme
- Issues: https://github.com/palantir/blueprint/issues
- npm.io page: https://npm.io/package/@blueprint-modernized/stylelint-plugin

## Dependencies (4)

- [postcss](https://npm.io/package/postcss.md) ^8.4.12
- [postcss-value-parser](https://npm.io/package/postcss-value-parser.md) ^4.2.0
- [postcss-selector-parser](https://npm.io/package/postcss-selector-parser.md) ^6.0.10
- [@blueprint-modernized/colors](https://npm.io/package/@blueprint-modernized/colors.md) ^4.0.6

## Recent versions

- 2.0.4 (latest) — 2022-04-10

## README

<img height="204" src="https://cloud.githubusercontent.com/assets/464822/20228152/d3f36dc2-a804-11e6-80ff-51ada2d13ea7.png">

# [Blueprint](http://blueprintjs.com/) [stylelint](https://stylelint.io/) plugin

Blueprint is a React UI toolkit for the web.

This package contains the [stylelint](https://stylelint.io/) plugin for Blueprint. It provides custom rules which are useful when developing against Blueprint libraries.

**Key features:**

-   [Blueprint-specific rules](#Rules) for use with `@blueprint-modernized` components.

## Installation

```
yarn add --dev @blueprint-modernized/stylelint-plugin
```

## Usage

Simply add this plugin in your `.stylelintrc` file and then pick the rules that you need. The plugin includes Blueprint-specific rules which enforce semantics particular to usage with `@blueprint-modernized` packages, but does not turn them on by default.

`.stylelintrc`

```json
{
    "plugins": [
        "@blueprint-modernized/stylelint-plugin"
    ],
    "rules": {
        "@blueprint-modernized/no-color-literal": true,
        "@blueprint-modernized/no-prefix-literal": true
    }
}
```

## Rules

### `@blueprint-modernized/no-color-literal` (autofixable)

Enforce usage of the color variables instead of color literals.

```json
{
    "rules": {
        "@blueprint-modernized/no-color-literal": true
    }
}
```

```diff
-.my-class {
-    border: 1px solid #137CBD;
-}
+ @import "~@blueprint-modernized/core/lib/scss/variables";
+
+.my-class {
+    border: 1px solid $blue3;
+}
```

Optional secondary options:

- `disableFix: boolean` - if true, autofix will be disabled
- `variablesImportPath: { less?: string, sass?: string }` - can be used to configure a custom path for importing Blueprint variables when autofixing.


### `@blueprint-modernized/no-prefix-literal` (autofixable)

Enforce usage of the `bp-ns` constant over namespaced string literals.

The `@blueprint-modernized` package exports a `bp-ns` CSS variable which contains the prefix for the current version of Blueprint (`bp3` for Blueprint 3, `bp4` for Blueprint 4, and etc). Using the variable instead of hardcoding the prefix means that your code will still work when new major version of Blueprint is released.

```json
{
    "rules": {
        "@blueprint-modernized/no-prefix-literal": true
    }
}
```

```diff
-.bp3-button > div {
-    border: 1px solid black;
-}
+ @import "~@blueprint-modernized/core/lib/scss/variables";
+
+.#{$bp-ns}-button > div {
+    border: 1px solid black;
+}
```

Optional secondary options:

- `disableFix: boolean` - if true, autofix will be disabled
- `variablesImportPath: { less?: string, sass?: string }` - can be used to configure a custom path for importing Blueprint variables when autofixing.


### [Full Documentation](http://blueprintjs.com/docs) | [Source Code](https://github.com/palantir/blueprint)

---
_Source: https://npm.io/package/@blueprint-modernized/stylelint-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
