@haltcase/style 6.2.0-canary.1 → 6.2.0-canary.2
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/package.json +3 -1
- package/readme.md +16 -0
- package/stylelint/_base.js +47 -0
- package/stylelint/index.js +11 -33
- package/stylelint/modules.js +25 -0
- package/stylelint/standard.js +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haltcase/style",
|
|
3
|
-
"version": "6.2.0-canary.
|
|
3
|
+
"version": "6.2.0-canary.2",
|
|
4
4
|
"description": "haltcase's web ecosystem style guide & configurations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
"./eslint/typescript": "./eslint/typescript.js",
|
|
32
32
|
"./prettier": "./prettier/index.js",
|
|
33
33
|
"./stylelint": "./stylelint/index.js",
|
|
34
|
+
"./stylelint/modules": "./stylelint/modules.js",
|
|
35
|
+
"./stylelint/standard": "./stylelint/standard.js",
|
|
34
36
|
"./typescript/base": "./typescript/tsconfig.base.json",
|
|
35
37
|
"./typescript/bundler": "./typescript/tsconfig.bundler.json",
|
|
36
38
|
"./typescript/next": "./typescript/tsconfig.next.json",
|
package/readme.md
CHANGED
|
@@ -250,6 +250,22 @@ Add the following in `package.json`:
|
|
|
250
250
|
> See the [Stylelint documentation](https://stylelint.io/user-guide/configure)
|
|
251
251
|
> for other configuration options.
|
|
252
252
|
|
|
253
|
+
#### Stylelint configs
|
|
254
|
+
|
|
255
|
+
There are several configs you can extend from. The default config does not
|
|
256
|
+
enforce a specific naming convention for classes, IDs, etc. This is intended
|
|
257
|
+
to allow flexibility between conventional CSS, where `kebab-case` is standard,
|
|
258
|
+
and CSS Modules or CSS-in-JS, where `camelCase` is more common.
|
|
259
|
+
|
|
260
|
+
There are alternate entry points if you would like to enforce a specific naming
|
|
261
|
+
convention: `standard` for kebab case and `modules` for camel case.
|
|
262
|
+
|
|
263
|
+
| Name | Description |
|
|
264
|
+
| ------------------------------------ | --------------------------------------------------- |
|
|
265
|
+
| `@haltcase/style/stylelint` | Do not enforce a naming convention for identifiers. |
|
|
266
|
+
| `@haltcase/style/stylelint/modules` | Enforce `camelCase` identifiers. |
|
|
267
|
+
| `@haltcase/style/stylelint/standard` | Enforce conventional `kebab-case` identifiers. |
|
|
268
|
+
|
|
253
269
|
## contributing
|
|
254
270
|
|
|
255
271
|
Please read our [contributing](https://github.com/haltcase/style/blob/main/CONTRIBUTING.md)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const defineConfig = require("stylelint-define-config").defineConfig;
|
|
6
|
+
|
|
7
|
+
module.exports = defineConfig({
|
|
8
|
+
extends: [
|
|
9
|
+
"stylelint-config-standard",
|
|
10
|
+
"stylelint-config-html",
|
|
11
|
+
"stylelint-config-clean-order"
|
|
12
|
+
],
|
|
13
|
+
rules: {
|
|
14
|
+
"at-rule-empty-line-before": [
|
|
15
|
+
"always",
|
|
16
|
+
{
|
|
17
|
+
except: ["blockless-after-same-name-blockless", "first-nested"],
|
|
18
|
+
ignore: ["after-comment"]
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"custom-property-empty-line-before": [
|
|
22
|
+
"always",
|
|
23
|
+
{
|
|
24
|
+
except: ["after-custom-property"],
|
|
25
|
+
ignore: ["after-comment", "first-nested", "inside-single-line-block"]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"declaration-empty-line-before": [
|
|
29
|
+
"always",
|
|
30
|
+
{
|
|
31
|
+
except: ["first-nested"],
|
|
32
|
+
ignore: [
|
|
33
|
+
"after-comment",
|
|
34
|
+
"after-declaration",
|
|
35
|
+
"inside-single-line-block"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"rule-empty-line-before": [
|
|
40
|
+
"always-multi-line",
|
|
41
|
+
{
|
|
42
|
+
except: ["first-nested"],
|
|
43
|
+
ignore: ["after-comment"]
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
});
|
package/stylelint/index.js
CHANGED
|
@@ -4,40 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
const defineConfig = require("stylelint-define-config").defineConfig;
|
|
6
6
|
|
|
7
|
+
const base = require("./_base.js");
|
|
8
|
+
|
|
7
9
|
module.exports = defineConfig({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"stylelint-config-html",
|
|
11
|
-
"stylelint-config-clean-order"
|
|
12
|
-
],
|
|
10
|
+
...base,
|
|
11
|
+
|
|
13
12
|
rules: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"custom-property-empty-line-before": [
|
|
22
|
-
"always",
|
|
23
|
-
{
|
|
24
|
-
except: ["after-custom-property"],
|
|
25
|
-
ignore: ["after-comment", "first-nested", "inside-single-line-block"]
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"declaration-empty-line-before": [
|
|
29
|
-
"always",
|
|
30
|
-
{
|
|
31
|
-
except: ["after-declaration", "first-nested"],
|
|
32
|
-
ignore: ["after-comment", "inside-single-line-block"]
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
"rule-empty-line-before": [
|
|
36
|
-
"always-multi-line",
|
|
37
|
-
{
|
|
38
|
-
except: ["first-nested"],
|
|
39
|
-
ignore: ["after-comment"]
|
|
40
|
-
}
|
|
41
|
-
]
|
|
13
|
+
...base.rules,
|
|
14
|
+
|
|
15
|
+
// disable identifier casing rules
|
|
16
|
+
"custom-media-pattern": null,
|
|
17
|
+
"custom-property-pattern": null,
|
|
18
|
+
"keyframes-name-pattern": null,
|
|
19
|
+
"selector-class-pattern": null
|
|
42
20
|
}
|
|
43
21
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const defineConfig = require("stylelint-define-config").defineConfig;
|
|
6
|
+
|
|
7
|
+
const base = require("./_base.js");
|
|
8
|
+
|
|
9
|
+
const camelCaseRegex = /^(?<=^|[^A-Z_a-z])_*[a-z]+[A-Z_a-z]*$/;
|
|
10
|
+
|
|
11
|
+
module.exports = defineConfig({
|
|
12
|
+
...base,
|
|
13
|
+
|
|
14
|
+
rules: {
|
|
15
|
+
...base.rules,
|
|
16
|
+
|
|
17
|
+
"custom-media-pattern": camelCaseRegex,
|
|
18
|
+
|
|
19
|
+
// custom properties (variables) should still be kebab-case
|
|
20
|
+
// "custom-property-pattern": camelCaseRegex,
|
|
21
|
+
|
|
22
|
+
"keyframes-name-pattern": camelCaseRegex,
|
|
23
|
+
"selector-class-pattern": camelCaseRegex
|
|
24
|
+
}
|
|
25
|
+
});
|