0.9.0 • Published 24 days ago

@gossi/config-stylelint v0.9.0

Weekly downloads
-
License
-
Repository
github
Last release
24 days ago

@gossi/config-stylelint

Adds stylelint to your packages.

Installation

1) Install these packages:

```bash
pnpm add -D @gossi/config-stylelint stylelint
```

2) Create a .stylelintrc.js file with these contents:

```js
'use strict';

module.exports = require('@gossi/config-stylelint');
```

3) Add scripts to execute linting

```json
{
  "scripts": {
    "lint:css": "stylelint \"path/to/css/**/*.css\" --allow-empty-input --cache",
    "lint:css:fix": "stylelint \"path/to/css/**/*.css\" --allow-empty-input --fix",
  }
}
```

Configuration

@gossi/config-stylelint provides a little configuration option (for target browsers), change your .stylelintrc.js to use this:

'use strict';

const { browsers } = require('path/to/your/browsers/config');
const configure = require('@gossi/config-stylelint/configure');

module.exports = configure({ browsers });

Extension

To extend your configuration with more rules, here is how to do that in your .stylelintrc.js:

'use strict';

const config = require('@gossi/config-stylelint');

module.exports = {
  ...config,
  rules: {
    ...config.rules,
    'function-no-unknown': [
      true,
      {
        ignoreFunctions: ['$']
      }
    ]
  }
};

this also works with configuring @gossi/config-stylelint:

'use strict';

const { browsers } = require('path/to/your/browsers/config');
const configure = require('@gossi/config-stylelint/configure');
const config = configure({ browsers });

module.exports = {
  ...config,
  rules: {
    ...config.rules,
    'function-no-unknown': [
      true,
      {
        ignoreFunctions: ['$']
      }
    ]
  }
};

Usage in vscode

Recommend the official stylelint extension (refer for more options).

If the extension can't find .stylelintrc.js on its own, configure it per repo, create or edit .vscode/settings.json (if this is a monorepo, then in the root is fine enough for all packages):

{
  "stylelint.configFile": "path/to/.stylelintrc.js",
  "stylelint.configBasedir": "path/to/",
  "stylelint.packageManager": "pnpm"
}
0.9.0

24 days ago

0.8.0

27 days ago

0.7.0

3 months ago

0.5.0

9 months ago

0.4.1

10 months ago

0.6.0

9 months ago

0.5.1

9 months ago

0.4.0

11 months ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.0.1

2 years ago