@openally/config.stylelint 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -9
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/package.json +20 -4
package/README.md
CHANGED
|
@@ -2,30 +2,59 @@
|
|
|
2
2
|
<h1 align="center">Stylelint Config</h1>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<div align="center">OpenAlly front-end Stylelint configuration</div>
|
|
5
|
+
<div align="center">OpenAlly front-end Stylelint configuration (CSS and Lit.js)</div>
|
|
6
6
|
|
|
7
7
|
## Requirements
|
|
8
|
-
- [Node.js](https://nodejs.org/en/)
|
|
8
|
+
- [Node.js](https://nodejs.org/en/) `^22.22.2`, `^24.15.0` or `>=26.0.0`
|
|
9
|
+
- [Stylelint](https://stylelint.io/) v18 (peer dependency)
|
|
9
10
|
|
|
10
11
|
## Getting Started
|
|
11
12
|
|
|
12
13
|
This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).
|
|
13
14
|
|
|
14
15
|
```bash
|
|
15
|
-
$ npm i -D @openally/config.stylelint
|
|
16
|
+
$ npm i -D stylelint @openally/config.stylelint
|
|
16
17
|
# or
|
|
17
|
-
$ yarn add @openally/config.stylelint -D
|
|
18
|
+
$ yarn add stylelint @openally/config.stylelint -D
|
|
18
19
|
```
|
|
19
20
|
|
|
20
21
|
## Usage
|
|
21
22
|
|
|
22
|
-
Create a
|
|
23
|
+
Create a `stylelint.config.mjs` file in the root of your project and extend the `@openally/config.stylelint` configuration.
|
|
23
24
|
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
```js
|
|
26
|
+
/**
|
|
27
|
+
* @type {import("stylelint").Config}
|
|
28
|
+
*/
|
|
29
|
+
export default {
|
|
30
|
+
extends: ["@openally/config.stylelint"]
|
|
31
|
+
};
|
|
28
32
|
```
|
|
29
33
|
|
|
34
|
+
Then lint both your stylesheets and your Lit components:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
$ npx stylelint "src/**/*.ts" "public/**/*.css" --cache
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## What's included
|
|
41
|
+
|
|
42
|
+
- [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) as the base.
|
|
43
|
+
- The [@stylistic/stylelint-plugin](https://github.com/stylelint-stylistic/stylelint-stylistic) recommended preset for formatting, with these changes:
|
|
44
|
+
- `@stylistic/indentation`: 2 spaces instead of tabs. Lines that continue a multi-line value (`calc()`, gradients, transitions) are not checked, so they can be aligned by hand.
|
|
45
|
+
- `@stylistic/linebreaks`: off. Git normalizes line endings (`.gitattributes`).
|
|
46
|
+
- `@stylistic/declaration-colon-newline-after`: off, so a multi-line value can start on the property line (`max-height: min(`).
|
|
47
|
+
- `@stylistic/value-list-comma-newline-after`: off, so a long list such as `font-family` can wrap with several items per line.
|
|
48
|
+
- `@stylistic/selector-descendant-combinator-no-non-space`: off, because it treats a line break in a long selector as an error and joins the lines when fixing.
|
|
49
|
+
- `no-duplicate-selectors` enabled, `no-descending-specificity` disabled (too noisy with Shadow DOM scoped styles).
|
|
50
|
+
- `**/*.ts` and `**/*.js` files are parsed with [postcss-lit](https://github.com/43081j/postcss-lit), so styles inside `` css`...` `` tagged templates are linted. `no-empty-source` is disabled for these files, since most of them contain no styles.
|
|
51
|
+
- `**/dist/**` and `**/coverage/**` are ignored.
|
|
52
|
+
|
|
53
|
+
> [!NOTE]
|
|
54
|
+
> postcss-lit skips templates it cannot interpret, such as one made only of interpolations (`` css`${a}${b}` ``), and prints a warning. Add a `// postcss-lit-disable-next-line` comment above such a template to silence it.
|
|
55
|
+
|
|
56
|
+
> [!WARNING]
|
|
57
|
+
> With postcss-lit 1.4.1, `stylelint --fix` rewrites every Lit file it reads, even ones with no errors. It can leave a placeholder such as `POSTCSS_LIT_1` in place of an interpolation (when a custom property value holds two or more `${}`), add spaces to the blank line before the closing backtick, or leave a stray `\r` in CRLF files. Run `--fix` on an LF working tree and review the diff before committing.
|
|
58
|
+
|
|
30
59
|
## License
|
|
31
60
|
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
plugins: string[];
|
|
3
|
+
extends: string[];
|
|
4
|
+
rules: {
|
|
5
|
+
"@stylistic/indentation": (number | {
|
|
6
|
+
ignore: string[];
|
|
7
|
+
})[];
|
|
8
|
+
"@stylistic/linebreaks": null;
|
|
9
|
+
"@stylistic/declaration-colon-newline-after": null;
|
|
10
|
+
"@stylistic/value-list-comma-newline-after": null;
|
|
11
|
+
"@stylistic/selector-descendant-combinator-no-non-space": null;
|
|
12
|
+
"no-descending-specificity": null;
|
|
13
|
+
"no-duplicate-selectors": boolean;
|
|
14
|
+
};
|
|
15
|
+
ignoreFiles: string[];
|
|
16
|
+
overrides: {
|
|
17
|
+
files: string[];
|
|
18
|
+
customSyntax: string;
|
|
19
|
+
rules: {
|
|
20
|
+
"no-empty-source": null;
|
|
21
|
+
};
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,wBA6CmB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
plugins: [
|
|
3
|
+
"@stylistic/stylelint-plugin"
|
|
4
|
+
],
|
|
5
|
+
extends: [
|
|
6
|
+
"stylelint-config-standard",
|
|
7
|
+
// See: https://stylelint-stylistic.github.io/user-guide/recommended
|
|
8
|
+
"@stylistic/stylelint-plugin/recommended"
|
|
9
|
+
],
|
|
10
|
+
rules: {
|
|
11
|
+
// The recommended preset indents with tabs
|
|
12
|
+
"@stylistic/indentation": [2, {
|
|
13
|
+
// Multi-line values (calc(), gradients, transitions) are aligned by hand
|
|
14
|
+
ignore: ["value"]
|
|
15
|
+
}],
|
|
16
|
+
// Line endings are normalized by Git (.gitattributes), not by the linter
|
|
17
|
+
"@stylistic/linebreaks": null,
|
|
18
|
+
// Allow multi-line values to start on the declaration line, e.g. `max-height: min(\n ... \n);`
|
|
19
|
+
"@stylistic/declaration-colon-newline-after": null,
|
|
20
|
+
// Allow long value lists (e.g. font-family) to wrap with several items per line
|
|
21
|
+
"@stylistic/value-list-comma-newline-after": null,
|
|
22
|
+
// Treats a line break inside a long compound selector as an invalid combinator and joins the lines on fix
|
|
23
|
+
"@stylistic/selector-descendant-combinator-no-non-space": null,
|
|
24
|
+
// See: https://stylelint.io/user-guide/rules/no-descending-specificity
|
|
25
|
+
"no-descending-specificity": null,
|
|
26
|
+
// See: https://stylelint.io/user-guide/rules/no-duplicate-selectors
|
|
27
|
+
"no-duplicate-selectors": true
|
|
28
|
+
},
|
|
29
|
+
ignoreFiles: [
|
|
30
|
+
"**/dist/**",
|
|
31
|
+
"**/coverage/**"
|
|
32
|
+
],
|
|
33
|
+
overrides: [
|
|
34
|
+
{
|
|
35
|
+
files: [
|
|
36
|
+
"**/*.ts",
|
|
37
|
+
"**/*.js"
|
|
38
|
+
],
|
|
39
|
+
customSyntax: "postcss-lit",
|
|
40
|
+
rules: {
|
|
41
|
+
// See: https://stylelint.io/user-guide/rules/no-empty-source
|
|
42
|
+
"no-empty-source": null
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openally/config.stylelint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "OpenAlly Stylelint configuration for front-end with Lit.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
7
15
|
"scripts": {
|
|
8
16
|
"build": "tsc",
|
|
9
17
|
"prepublishOnly": "npm run build",
|
|
@@ -32,9 +40,17 @@
|
|
|
32
40
|
"author": "GENTILHOMME Thomas <gentilhomme.thomas@gmail.com>",
|
|
33
41
|
"license": "MIT",
|
|
34
42
|
"dependencies": {
|
|
35
|
-
"@stylistic/stylelint-plugin": "
|
|
43
|
+
"@stylistic/stylelint-plugin": "6.0.1",
|
|
36
44
|
"postcss-lit": "1.4.1",
|
|
37
|
-
"stylelint": "
|
|
38
|
-
|
|
45
|
+
"stylelint-config-standard": "41.0.0"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"stylelint": "^18.0.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"stylelint": "18.0.0"
|
|
39
55
|
}
|
|
40
56
|
}
|