Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deps: Update dependency stylelint to v16 #175

Merged
merged 8 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"commitlint-cli": "1.1.3",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-node": "^0.3.9",
literat marked this conversation as resolved.
Show resolved Hide resolved
"eslint-plugin-prettier": "5.1.3",
"husky": "8.0.3",
"is-ci": "3.0.1",
Expand Down
108 changes: 12 additions & 96 deletions packages/stylelint-config/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# `@lmc-eu/stylelint-config`
# `@almacareer/stylelint-config`

[![npm version](https://img.shields.io/npm/v/@lmc-eu/stylelint-config?label=npm%20package&logo=npm)](https://www.npmjs.org/package/@lmc-eu/stylelint-config)
[![Node version](https://img.shields.io/node/v/@lmc-eu/stylelint-config.svg?style=flat&logo=nodedotjs)](http://nodejs.org/download/)
[![Stylelint version](https://img.shields.io/npm/dependency-version/@lmc-eu/stylelint-config/peer/stylelint?logo=stylelint)](https://github.com/stylelint/stylelint)
[![npm version](https://img.shields.io/npm/v/@almacareer/stylelint-config?label=npm%20package&logo=npm)](https://www.npmjs.org/package/@almacareer/stylelint-config)
[![Node version](https://img.shields.io/node/v/@almacareer/stylelint-config.svg?style=flat&logo=nodedotjs)](http://nodejs.org/download/)
[![Stylelint version](https://img.shields.io/npm/dependency-version/@almacareer/stylelint-config/peer/stylelint?logo=stylelint)](https://github.com/stylelint/stylelint)

> LMC’s config for Stylelint

## Usage

```bash
# Yarn:
yarn add --dev @lmc-eu/stylelint-config stylelint-config-prettier
yarn add --dev @almacareer/stylelint-config stylelint-config-prettier

# npm:
npm install --save-dev @lmc-eu/stylelint-config stylelint-config-prettier
npm install --save-dev @almacareer/stylelint-config stylelint-config-prettier
```

> We assume you are using Prettier. That’s why we also recommend adding
Expand All @@ -29,19 +29,17 @@ This config:

## Configuration

- **`@lmc-eu/stylelint-config`**
- **`@almacareer/stylelint-config`**

Use this ruleset to configure Stylelint to work with your code.

## Recommended Stylelint Configuration

```js
// .stylelintrc.js
// .stylelintrc.mjs

'use strict';

module.exports = {
extends: ['@lmc-eu/stylelint-config', 'stylelint-config-prettier'],
export default {
extends: ['@almacareer/stylelint-config', 'stylelint-config-prettier'],
};
```

Expand All @@ -50,7 +48,7 @@ module.exports = {

```json
{
"extends": ["@lmc-eu/stylelint-config", "stylelint-config-prettier"]
"extends": ["@almacareer/stylelint-config", "stylelint-config-prettier"]
}
```

Expand All @@ -62,93 +60,11 @@ module.exports = {
```json
{
"stylelint": {
"extends": ["@lmc-eu/stylelint-config", "stylelint-config-prettier"]
"extends": ["@almacareer/stylelint-config", "stylelint-config-prettier"]
}
}
```

</details>

---

## Legacy Configurations

Use this config to keep less strict ruleset that consists from the original one up to version 4.0.1:

`@lmc-eu/stylelint-config/legacy`

or its extended version with rules for properties order (formerly known as `optional` until 4.0.1):

`@lmc-eu/stylelint-config/legacy-with-properties-order`

## Recommended Legacy Stylelint Configuration

```js
// .stylelintrc.js

'use strict';

module.exports = {
extends: ['@lmc-eu/stylelint-config/legacy', 'stylelint-config-prettier'],
};
```

<details>
<summary><i>.stylelintrc</i> or <i>.stylelintrc.json</i></summary>

```json
{
"extends": ["@lmc-eu/stylelint-config/legacy", "stylelint-config-prettier"]
}
```

</details>

<details>
<summary><i>package.json</i></summary>

```json
{
"stylelint": {
"extends": ["@lmc-eu/stylelint-config/legacy", "stylelint-config-prettier"]
}
}
```

</details>

## Extended Legacy Configuration With Properties Order Ruleset

```js
// .stylelintrc.js

'use strict';

module.exports = {
extends: ['@lmc-eu/stylelint-config/legacy-with-properties-order', 'stylelint-config-prettier'],
};
```

<details>
<summary><i>.stylelintrc</i> or <i>.stylelintrc.json</i></summary>

```json
{
"extends": ["@lmc-eu/stylelint-config/legacy-with-properties-order", "stylelint-config-prettier"]
}
```

</details>

<details>
<summary><i>package.json</i></summary>

```json
{
"stylelint": {
"extends": ["@lmc-eu/stylelint-config/legacy-with-properties-order", "stylelint-config-prettier"]
}
}
```

</details>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Based on https://github.com/stylelint/stylelint-config-standard/blob/36.0.0/__tests__/valid.css */

@custom-media --FOO;

:root {
--FOO: 1px;
}

@keyframes FOO {
/* ... */
}

.FOO {
/* ... */
}

#FOO {
/* ... */
}
56 changes: 56 additions & 0 deletions packages/stylelint-config/__tests__/__fixtures__/css-valid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
Based on https://github.com/stylelint/stylelint-config-standard/blob/36.0.0/__tests__/valid.css
with modifications:

- order properties according to `order.js`,
- flag ID selectors.
*/

@import 'foo.css';
@import 'bar.css';

@custom-media --foo (min-width: 30em);

/**
* Multi-line comment
*/

:root {
--brand-red: hsl(5deg 10% 40%);
}

/* Single-line comment */

.class-foo:not(a, div) {
top: calc(100% - 2rem);
margin: 0;
}

/* Flush single line comment */
@media (width >= 60em) {
.class-foo {
/* Flush to parent comment */
--offset: 0px;

left: calc(var(--offset) + 50%);
font-family: Helvetica, 'Arial Black', sans-serif;
color: #fff;
}

/* Flush nested single line comment */
a::after {
content: '→';
display: block;
background-image: url('x.svg');
}
}

@keyframes fade-in {
from {
opacity: 0;
}

to {
opacity: 1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Based on https://github.com/stylelint-scss/stylelint-config-standard-scss/blob/v13.1.0/__tests__/invalid.scss

$FOO: 1;
Loading