@codelaw/rules-css 0.0.0-stage → 0.1.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/LICENSE +23 -0
- package/NOTICE +45 -0
- package/README.md +181 -2
- package/codelaw-pack.toml +6 -0
- package/data/css/at-rules.json +97 -0
- package/data/css/deprecated.json +178 -0
- package/data/css/descriptors.json +121 -0
- package/data/css/functions.json +49 -0
- package/data/css/keywords.json +332 -0
- package/data/css/media.json +271 -0
- package/data/css/prefixed.json +266 -0
- package/data/css/properties-groups.json +183 -0
- package/data/css/properties.json +1326 -0
- package/data/css/property-keywords.json +394 -0
- package/data/css/selectors.json +281 -0
- package/data/css/shorthands.json +351 -0
- package/data/css/type-selectors.json +447 -0
- package/data/css/units.json +123 -0
- package/package.json +14 -4
- package/presets/css/conventions.toml +4 -0
- package/presets/css/recommended.toml +44 -0
- package/presets/css/standard.toml +31 -0
- package/rules/css/alpha-value-notation.cases.md +37 -0
- package/rules/css/alpha-value-notation.md +44 -0
- package/rules/css/annotation-no-unknown.md +44 -0
- package/rules/css/at-rule-descriptor-no-unknown.md +46 -0
- package/rules/css/at-rule-descriptor-value-no-unknown.md +50 -0
- package/rules/css/at-rule-no-deprecated.cases.md +13 -0
- package/rules/css/at-rule-no-deprecated.md +47 -0
- package/rules/css/at-rule-no-unknown.cases.md +25 -0
- package/rules/css/at-rule-no-unknown.md +49 -0
- package/rules/css/at-rule-no-vendor-prefix.md +44 -0
- package/rules/css/at-rule-prelude-no-invalid.md +52 -0
- package/rules/css/block-no-redundant-nested-style-rules.md +40 -0
- package/rules/css/color-function-alias-notation.md +42 -0
- package/rules/css/color-function-notation.md +42 -0
- package/rules/css/color-hex-length.cases.md +13 -0
- package/rules/css/color-hex-length.md +41 -0
- package/rules/css/comment-no-empty.md +38 -0
- package/rules/css/container-name-pattern.md +45 -0
- package/rules/css/custom-media-pattern.md +41 -0
- package/rules/css/custom-property-no-missing-var-function.cases.md +61 -0
- package/rules/css/custom-property-no-missing-var-function.md +46 -0
- package/rules/css/custom-property-pattern.md +45 -0
- package/rules/css/declaration-block-no-duplicate-custom-properties.md +44 -0
- package/rules/css/declaration-block-no-duplicate-properties.cases.md +61 -0
- package/rules/css/declaration-block-no-duplicate-properties.md +44 -0
- package/rules/css/declaration-block-no-redundant-longhand-properties.md +49 -0
- package/rules/css/declaration-block-no-shorthand-property-overrides.md +44 -0
- package/rules/css/declaration-property-value-keyword-no-deprecated.md +40 -0
- package/rules/css/declaration-property-value-no-unknown.cases.md +16 -0
- package/rules/css/declaration-property-value-no-unknown.md +46 -0
- package/rules/css/font-family-no-duplicate-names.cases.md +31 -0
- package/rules/css/font-family-no-duplicate-names.md +37 -0
- package/rules/css/font-family-no-missing-generic-family-keyword.cases.md +62 -0
- package/rules/css/font-family-no-missing-generic-family-keyword.md +44 -0
- package/rules/css/function-calc-no-unspaced-operator.cases.md +33 -0
- package/rules/css/function-calc-no-unspaced-operator.md +42 -0
- package/rules/css/hue-degree-notation.md +41 -0
- package/rules/css/import-notation.md +37 -0
- package/rules/css/keyframe-block-no-duplicate-selectors.md +54 -0
- package/rules/css/keyframe-declaration-no-important.md +50 -0
- package/rules/css/keyframe-selector-notation.md +61 -0
- package/rules/css/keyframes-name-pattern.md +49 -0
- package/rules/css/layer-name-pattern.md +41 -0
- package/rules/css/length-zero-no-unit.cases.md +41 -0
- package/rules/css/length-zero-no-unit.md +39 -0
- package/rules/css/lightness-notation.md +41 -0
- package/rules/css/media-feature-name-no-unknown.md +48 -0
- package/rules/css/media-feature-name-no-vendor-prefix.md +50 -0
- package/rules/css/media-feature-name-value-no-unknown.md +46 -0
- package/rules/css/media-feature-range-notation.cases.md +61 -0
- package/rules/css/media-feature-range-notation.md +45 -0
- package/rules/css/media-query-no-invalid.cases.md +60 -0
- package/rules/css/media-query-no-invalid.md +48 -0
- package/rules/css/media-type-no-deprecated.md +48 -0
- package/rules/css/named-grid-areas-no-invalid.md +47 -0
- package/rules/css/nesting-selector-no-missing-scoping-root.md +44 -0
- package/rules/css/no-descending-specificity.cases.md +69 -0
- package/rules/css/no-descending-specificity.md +57 -0
- package/rules/css/no-duplicate-at-import-rules.md +35 -0
- package/rules/css/no-duplicate-selector.cases.md +67 -0
- package/rules/css/no-duplicate-selector.md +48 -0
- package/rules/css/no-empty-block.cases.md +42 -0
- package/rules/css/no-empty-block.md +42 -0
- package/rules/css/no-empty-source.md +40 -0
- package/rules/css/no-important.md +43 -0
- package/rules/css/no-invalid-double-slash-comments.md +44 -0
- package/rules/css/no-invalid-position-at-import-rule.md +48 -0
- package/rules/css/no-invalid-position-declaration.cases.md +35 -0
- package/rules/css/no-invalid-position-declaration.md +40 -0
- package/rules/css/no-irregular-whitespace.md +38 -0
- package/rules/css/no-unknown-property.cases.md +53 -0
- package/rules/css/no-unknown-property.md +45 -0
- package/rules/css/number-max-precision.md +41 -0
- package/rules/css/property-no-deprecated.md +40 -0
- package/rules/css/property-no-vendor-prefix.md +40 -0
- package/rules/css/selector-anb-no-unmatchable.md +42 -0
- package/rules/css/selector-class-pattern.md +45 -0
- package/rules/css/selector-id-pattern.md +45 -0
- package/rules/css/selector-no-vendor-prefix.md +40 -0
- package/rules/css/selector-not-notation.md +42 -0
- package/rules/css/selector-pseudo-class-no-unknown.cases.md +53 -0
- package/rules/css/selector-pseudo-class-no-unknown.md +44 -0
- package/rules/css/selector-pseudo-element-colon-notation.cases.md +13 -0
- package/rules/css/selector-pseudo-element-colon-notation.md +41 -0
- package/rules/css/selector-pseudo-element-no-unknown.md +44 -0
- package/rules/css/selector-type-no-unknown.cases.md +41 -0
- package/rules/css/selector-type-no-unknown.md +45 -0
- package/rules/css/shorthand-property-no-redundant-values.cases.md +34 -0
- package/rules/css/shorthand-property-no-redundant-values.md +37 -0
- package/rules/css/string-no-newline.cases.md +27 -0
- package/rules/css/string-no-newline.md +45 -0
- package/rules/css/syntax-string-no-invalid.md +46 -0
- package/rules/css/value-no-vendor-prefix.md +40 -0
- package/rules/graph/no-unused-css-classes.md +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arpit Arya
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
SPDX-License-Identifier: MIT
|
package/NOTICE
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@codelaw/rules-css / codelaw-rules-css
|
|
2
|
+
|
|
3
|
+
The rules are reimplementations written for codelaw. Their `ported_from:`
|
|
4
|
+
fields name the stylelint rules (https://stylelint.io, MIT License) whose
|
|
5
|
+
documented behaviour they reproduce; no stylelint code or documentation text
|
|
6
|
+
is included.
|
|
7
|
+
|
|
8
|
+
The data tables in data/css/ come from these sources:
|
|
9
|
+
|
|
10
|
+
stylelint 17.16.0 — https://github.com/stylelint/stylelint
|
|
11
|
+
Copyright (c) 2015 - present Maxime Thirouin, David Clark & Richard Hallows
|
|
12
|
+
MIT License.
|
|
13
|
+
css/at-rules, css/selectors, css/type-selectors (with the packages below),
|
|
14
|
+
css/media, css/units, css/keywords, css/properties-groups, css/shorthands,
|
|
15
|
+
css/functions and css/prefixed are extracted from lib/reference/*.mjs and
|
|
16
|
+
lib/utils/isAutoprefixable.mjs; css/deprecated is transcribed from the
|
|
17
|
+
rules at-rule-no-deprecated, property-no-deprecated and
|
|
18
|
+
declaration-property-value-keyword-no-deprecated; css/properties includes
|
|
19
|
+
its previouslyKnownProperties list.
|
|
20
|
+
|
|
21
|
+
known-css-properties 0.37.0 — https://github.com/known-css/known-css-properties
|
|
22
|
+
Copyright (c) 2017 Mavrix Technologies
|
|
23
|
+
MIT License.
|
|
24
|
+
css/properties.
|
|
25
|
+
|
|
26
|
+
html-tags 5.1.0 — https://github.com/sindresorhus/html-tags
|
|
27
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
28
|
+
MIT License.
|
|
29
|
+
css/type-selectors (html).
|
|
30
|
+
|
|
31
|
+
svg-tags 1.0.0 — https://github.com/element-io/svg-tags
|
|
32
|
+
Copyright (c) 2014 Athan Reines.
|
|
33
|
+
MIT License.
|
|
34
|
+
css/type-selectors (svg).
|
|
35
|
+
|
|
36
|
+
mathml-tag-names 4.0.0 — https://github.com/wooorm/mathml-tag-names
|
|
37
|
+
Copyright (c) Titus Wormer <tituswormer@gmail.com>
|
|
38
|
+
MIT License.
|
|
39
|
+
css/type-selectors (mathml).
|
|
40
|
+
|
|
41
|
+
css/descriptors and css/property-keywords were written for this pack from
|
|
42
|
+
the W3C CSS specifications.
|
|
43
|
+
|
|
44
|
+
No data comes from MDN data or @mdn/browser-compat-data (CC0-1.0, which is
|
|
45
|
+
not an OSI-approved licence).
|
package/README.md
CHANGED
|
@@ -1,3 +1,182 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @codelaw/rules-css · codelaw-rules-css
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
codelaw's rules for CSS — one of the five first-party rule packs
|
|
4
|
+
([SR-RULE-PACKS](../../records/0101_rule-packs.md)). The same files ship on npm
|
|
5
|
+
as `@codelaw/rules-css` and on PyPI as `codelaw-rules-css`. The rules also run
|
|
6
|
+
on the CSS inside HTML: `<style>` elements and `style=""` attributes.
|
|
7
|
+
|
|
8
|
+
```toml
|
|
9
|
+
# codelaw.toml
|
|
10
|
+
extends = ["codelaw:css/recommended", "codelaw:css/standard"]
|
|
11
|
+
preview = true # every rule is `preview` until a corpus run promotes it
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Presets
|
|
15
|
+
|
|
16
|
+
| preset | rules | ported from |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `css/recommended` | 41 | stylelint-config-recommended 18.0.0 (stylelint 17.16.0) — all 41 rules |
|
|
19
|
+
| `css/standard` | 28 | the rules stylelint-config-standard 40.0.0 adds to the recommended set, less the 13 layout rules (see below). It holds only the additions: extend it together with `css/recommended` |
|
|
20
|
+
| `css/conventions` | 1 | house conventions, opt-in: `css/no-important` |
|
|
21
|
+
|
|
22
|
+
Three starter rules match stylelint rules and sit in `css/recommended` under
|
|
23
|
+
their starter ids: `css/no-empty-block` (`block-no-empty`),
|
|
24
|
+
`css/no-duplicate-selector` (`no-duplicate-selectors`) and
|
|
25
|
+
`css/no-unknown-property` (`property-no-unknown`). Every other rule keeps its
|
|
26
|
+
stylelint name under `css/`.
|
|
27
|
+
|
|
28
|
+
Where stylelint-config-recommended sets options (`at-rule-prelude-no-invalid`,
|
|
29
|
+
`declaration-block-no-duplicate-properties`, `selector-type-no-unknown`,
|
|
30
|
+
`string-no-newline`), those are the codelaw rule's defaults. Where
|
|
31
|
+
stylelint-config-standard picks a style (`"modern"`, `"percentage"`, `"short"`,
|
|
32
|
+
kebab-case patterns), the codelaw rule implements that style; the patterns stay
|
|
33
|
+
configurable through each rule's `pattern` option.
|
|
34
|
+
|
|
35
|
+
Every rule is **reimplemented**, not vendored: a native Rust implementation in
|
|
36
|
+
`crates/codelaw-native/src/css_*.rs` reads the stylesheet with its own small CSS
|
|
37
|
+
reader, and the rule files, messages and docs are written fresh. Each rule's
|
|
38
|
+
`ported_from:` names the source rule.
|
|
39
|
+
|
|
40
|
+
## How the ports differ
|
|
41
|
+
|
|
42
|
+
| rule | difference |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `css/at-rule-descriptor-value-no-unknown` | keyword-valued descriptors and the `@property` `syntax` type only; stylelint uses the full CSSTree grammar |
|
|
45
|
+
| `css/at-rule-no-deprecated` | only `@nest` has a fix |
|
|
46
|
+
| `css/at-rule-prelude-no-invalid` | `@property`, `@font-palette-values`, `@position-try`, `@counter-style`, `@keyframes`, `@layer`, `@import`, `@namespace`, `@charset` and prelude-less at-rules; `@supports`, `@container`, `@page` and `@scope` preludes are not checked |
|
|
47
|
+
| `css/no-empty-block` | `@layer name {}` is not reported: it fixes the order of cascade layers |
|
|
48
|
+
| `css/declaration-property-value-no-unknown` | single-keyword values of about forty keyword-valued properties, from a table written for this pack; stylelint validates every value with CSSTree |
|
|
49
|
+
| `css/function-calc-no-unspaced-operator` | whitespace other than one space around an operator is left to the formatter |
|
|
50
|
+
| `css/no-descending-specificity` | a nested `&` is resolved against each parent selector separately, not as `:is()` of all of them |
|
|
51
|
+
| `css/no-unknown-property` | properties from `known-css-properties` plus stylelint's list of previously known names, not CSSTree; a fix is offered when a known name is one or two edits away |
|
|
52
|
+
| `css/color-function-notation` | values with `var()` inside the function are skipped |
|
|
53
|
+
| `css/declaration-block-no-redundant-longhand-properties` | reported without a fix |
|
|
54
|
+
| `css/media-feature-name-no-vendor-prefix` | reported without a fix; the advice is `resolution` with `dppx` |
|
|
55
|
+
| `css/media-feature-range-notation` | the fix does not merge a `min-` and `max-` pair into one range |
|
|
56
|
+
|
|
57
|
+
Rules whose data stylelint takes from CSSTree (whose syntax data derives from
|
|
58
|
+
MDN data, CC0-1.0, which is not an OSI licence) use the tables listed under
|
|
59
|
+
[Data](#data) instead.
|
|
60
|
+
|
|
61
|
+
## Ported
|
|
62
|
+
|
|
63
|
+
| codelaw rule | stylelint rule | preset | fix |
|
|
64
|
+
|---|---|---|---|
|
|
65
|
+
| `css/annotation-no-unknown` | `annotation-no-unknown` | recommended | manual |
|
|
66
|
+
| `css/at-rule-descriptor-no-unknown` | `at-rule-descriptor-no-unknown` | recommended | manual |
|
|
67
|
+
| `css/at-rule-descriptor-value-no-unknown` | `at-rule-descriptor-value-no-unknown` | recommended | manual |
|
|
68
|
+
| `css/at-rule-no-deprecated` | `at-rule-no-deprecated` | recommended | auto |
|
|
69
|
+
| `css/at-rule-no-unknown` | `at-rule-no-unknown` | recommended | manual |
|
|
70
|
+
| `css/at-rule-prelude-no-invalid` | `at-rule-prelude-no-invalid` | recommended | manual |
|
|
71
|
+
| `css/no-empty-block` | `block-no-empty` | recommended | auto |
|
|
72
|
+
| `css/comment-no-empty` | `comment-no-empty` | recommended | auto |
|
|
73
|
+
| `css/custom-property-no-missing-var-function` | `custom-property-no-missing-var-function` | recommended | suggest |
|
|
74
|
+
| `css/declaration-block-no-duplicate-custom-properties` | `declaration-block-no-duplicate-custom-properties` | recommended | manual |
|
|
75
|
+
| `css/declaration-block-no-duplicate-properties` | `declaration-block-no-duplicate-properties` | recommended | suggest |
|
|
76
|
+
| `css/declaration-block-no-shorthand-property-overrides` | `declaration-block-no-shorthand-property-overrides` | recommended | manual |
|
|
77
|
+
| `css/declaration-property-value-keyword-no-deprecated` | `declaration-property-value-keyword-no-deprecated` | recommended | suggest |
|
|
78
|
+
| `css/declaration-property-value-no-unknown` | `declaration-property-value-no-unknown` | recommended | manual |
|
|
79
|
+
| `css/font-family-no-duplicate-names` | `font-family-no-duplicate-names` | recommended | auto |
|
|
80
|
+
| `css/font-family-no-missing-generic-family-keyword` | `font-family-no-missing-generic-family-keyword` | recommended | manual |
|
|
81
|
+
| `css/function-calc-no-unspaced-operator` | `function-calc-no-unspaced-operator` | recommended | suggest |
|
|
82
|
+
| `css/keyframe-block-no-duplicate-selectors` | `keyframe-block-no-duplicate-selectors` | recommended | manual |
|
|
83
|
+
| `css/keyframe-declaration-no-important` | `keyframe-declaration-no-important` | recommended | suggest |
|
|
84
|
+
| `css/media-feature-name-no-unknown` | `media-feature-name-no-unknown` | recommended | manual |
|
|
85
|
+
| `css/media-feature-name-value-no-unknown` | `media-feature-name-value-no-unknown` | recommended | manual |
|
|
86
|
+
| `css/media-query-no-invalid` | `media-query-no-invalid` | recommended | manual |
|
|
87
|
+
| `css/media-type-no-deprecated` | `media-type-no-deprecated` | recommended | manual |
|
|
88
|
+
| `css/named-grid-areas-no-invalid` | `named-grid-areas-no-invalid` | recommended | manual |
|
|
89
|
+
| `css/nesting-selector-no-missing-scoping-root` | `nesting-selector-no-missing-scoping-root` | recommended | manual |
|
|
90
|
+
| `css/no-descending-specificity` | `no-descending-specificity` | recommended | manual |
|
|
91
|
+
| `css/no-duplicate-at-import-rules` | `no-duplicate-at-import-rules` | recommended | suggest |
|
|
92
|
+
| `css/no-duplicate-selector` | `no-duplicate-selectors` | recommended | manual |
|
|
93
|
+
| `css/no-empty-source` | `no-empty-source` | recommended | manual |
|
|
94
|
+
| `css/no-invalid-double-slash-comments` | `no-invalid-double-slash-comments` | recommended | manual |
|
|
95
|
+
| `css/no-invalid-position-at-import-rule` | `no-invalid-position-at-import-rule` | recommended | manual |
|
|
96
|
+
| `css/no-invalid-position-declaration` | `no-invalid-position-declaration` | recommended | manual |
|
|
97
|
+
| `css/no-irregular-whitespace` | `no-irregular-whitespace` | recommended | suggest |
|
|
98
|
+
| `css/property-no-deprecated` | `property-no-deprecated` | recommended | suggest |
|
|
99
|
+
| `css/no-unknown-property` | `property-no-unknown` | recommended | suggest |
|
|
100
|
+
| `css/selector-anb-no-unmatchable` | `selector-anb-no-unmatchable` | recommended | manual |
|
|
101
|
+
| `css/selector-pseudo-class-no-unknown` | `selector-pseudo-class-no-unknown` | recommended | manual |
|
|
102
|
+
| `css/selector-pseudo-element-no-unknown` | `selector-pseudo-element-no-unknown` | recommended | manual |
|
|
103
|
+
| `css/selector-type-no-unknown` | `selector-type-no-unknown` | recommended | manual |
|
|
104
|
+
| `css/string-no-newline` | `string-no-newline` | recommended | manual |
|
|
105
|
+
| `css/syntax-string-no-invalid` | `syntax-string-no-invalid` | recommended | manual |
|
|
106
|
+
| `css/alpha-value-notation` | `alpha-value-notation` | standard | suggest |
|
|
107
|
+
| `css/at-rule-no-vendor-prefix` | `at-rule-no-vendor-prefix` | standard | suggest |
|
|
108
|
+
| `css/block-no-redundant-nested-style-rules` | `block-no-redundant-nested-style-rules` | standard | suggest |
|
|
109
|
+
| `css/color-function-alias-notation` | `color-function-alias-notation` | standard | suggest |
|
|
110
|
+
| `css/color-function-notation` | `color-function-notation` | standard | suggest |
|
|
111
|
+
| `css/color-hex-length` | `color-hex-length` | standard | auto |
|
|
112
|
+
| `css/container-name-pattern` | `container-name-pattern` | standard | manual |
|
|
113
|
+
| `css/custom-media-pattern` | `custom-media-pattern` | standard | manual |
|
|
114
|
+
| `css/custom-property-pattern` | `custom-property-pattern` | standard | manual |
|
|
115
|
+
| `css/declaration-block-no-redundant-longhand-properties` | `declaration-block-no-redundant-longhand-properties` | standard | manual |
|
|
116
|
+
| `css/hue-degree-notation` | `hue-degree-notation` | standard | auto |
|
|
117
|
+
| `css/import-notation` | `import-notation` | standard | auto |
|
|
118
|
+
| `css/keyframe-selector-notation` | `keyframe-selector-notation` | standard | auto |
|
|
119
|
+
| `css/keyframes-name-pattern` | `keyframes-name-pattern` | standard | manual |
|
|
120
|
+
| `css/layer-name-pattern` | `layer-name-pattern` | standard | manual |
|
|
121
|
+
| `css/length-zero-no-unit` | `length-zero-no-unit` | standard | auto |
|
|
122
|
+
| `css/lightness-notation` | `lightness-notation` | standard | auto |
|
|
123
|
+
| `css/media-feature-name-no-vendor-prefix` | `media-feature-name-no-vendor-prefix` | standard | manual |
|
|
124
|
+
| `css/media-feature-range-notation` | `media-feature-range-notation` | standard | auto |
|
|
125
|
+
| `css/number-max-precision` | `number-max-precision` | standard | suggest |
|
|
126
|
+
| `css/property-no-vendor-prefix` | `property-no-vendor-prefix` | standard | suggest |
|
|
127
|
+
| `css/selector-class-pattern` | `selector-class-pattern` | standard | manual |
|
|
128
|
+
| `css/selector-id-pattern` | `selector-id-pattern` | standard | manual |
|
|
129
|
+
| `css/selector-no-vendor-prefix` | `selector-no-vendor-prefix` | standard | suggest |
|
|
130
|
+
| `css/selector-not-notation` | `selector-not-notation` | standard | suggest |
|
|
131
|
+
| `css/selector-pseudo-element-colon-notation` | `selector-pseudo-element-colon-notation` | standard | auto |
|
|
132
|
+
| `css/shorthand-property-no-redundant-values` | `shorthand-property-no-redundant-values` | standard | auto |
|
|
133
|
+
| `css/value-no-vendor-prefix` | `value-no-vendor-prefix` | standard | suggest |
|
|
134
|
+
| `css/no-important` | — | conventions | manual |
|
|
135
|
+
|
|
136
|
+
## Not ported, and why
|
|
137
|
+
|
|
138
|
+
Every rule of stylelint-config-recommended is ported. These are the rules
|
|
139
|
+
stylelint-config-standard adds that are layout, which the formatter owns
|
|
140
|
+
([SR-FORMATTER](../../records/0105_formatter.md)):
|
|
141
|
+
|
|
142
|
+
| rule | why |
|
|
143
|
+
|---|---|
|
|
144
|
+
| `at-rule-empty-line-before` | never: layout (blank lines) |
|
|
145
|
+
| `comment-empty-line-before` | never: layout (blank lines) |
|
|
146
|
+
| `comment-whitespace-inside` | never: layout (whitespace) |
|
|
147
|
+
| `custom-property-empty-line-before` | never: layout (blank lines) |
|
|
148
|
+
| `declaration-block-single-line-max-declarations` | never: layout (line breaks) |
|
|
149
|
+
| `declaration-empty-line-before` | never: layout (blank lines) |
|
|
150
|
+
| `font-family-name-quotes` | never: layout (quotes) |
|
|
151
|
+
| `function-name-case` | never: layout (case) |
|
|
152
|
+
| `function-url-quotes` | never: layout (quotes) |
|
|
153
|
+
| `rule-empty-line-before` | never: layout (blank lines) |
|
|
154
|
+
| `selector-attribute-quotes` | never: layout (quotes) |
|
|
155
|
+
| `selector-type-case` | never: layout (case) |
|
|
156
|
+
| `value-keyword-case` | never: layout (case) |
|
|
157
|
+
|
|
158
|
+
## Upstream versions
|
|
159
|
+
|
|
160
|
+
- stylelint 17.16.0 — rule behaviour and documentation, read to reimplement.
|
|
161
|
+
- stylelint-config-recommended 18.0.0 and stylelint-config-standard 40.0.0 — the rule sets.
|
|
162
|
+
|
|
163
|
+
## Data
|
|
164
|
+
|
|
165
|
+
`data/css/*.json` are the tables the rules read. See `NOTICE` for sources and licences.
|
|
166
|
+
|
|
167
|
+
| table | holds | source |
|
|
168
|
+
|---|---|---|
|
|
169
|
+
| `css/properties` | known property names | known-css-properties 0.37.0, plus stylelint's `previouslyKnownProperties` |
|
|
170
|
+
| `css/at-rules` | known, deprecated and nesting at-rules, page-margin boxes | stylelint `reference/atKeywords.mjs` |
|
|
171
|
+
| `css/selectors` | pseudo-classes and pseudo-elements | stylelint `reference/selectors.mjs` |
|
|
172
|
+
| `css/type-selectors` | HTML, SVG and MathML element names | stylelint `reference/selectors.mjs` with html-tags 5.1.0; svg-tags 1.0.0; mathml-tag-names 4.0.0 |
|
|
173
|
+
| `css/media` | media features, their values and deprecated media types | stylelint `reference/mediaFeatures.mjs`, `reference/mediaTypes.mjs` |
|
|
174
|
+
| `css/units` | length units and all units | stylelint `reference/units.mjs` |
|
|
175
|
+
| `css/keywords` | CSS-wide, font-family, system-font and colour keywords | stylelint `reference/keywords.mjs` |
|
|
176
|
+
| `css/properties-groups` | colour properties and the properties allowed in `@page` and its margin boxes | stylelint `reference/properties.mjs` |
|
|
177
|
+
| `css/shorthands` | each shorthand's longhands and the properties it resets | stylelint `reference/properties.mjs` |
|
|
178
|
+
| `css/functions` | colour and math functions | stylelint `reference/functions.mjs` |
|
|
179
|
+
| `css/prefixed` | prefixes, and the at-rules, selectors, properties and values a build tool prefixes | stylelint `reference/prefixes.mjs` and `utils/isAutoprefixable.mjs` |
|
|
180
|
+
| `css/deprecated` | deprecated at-rules, properties and keywords with their replacements | stylelint `at-rule-no-deprecated`, `property-no-deprecated` and `declaration-property-value-keyword-no-deprecated` |
|
|
181
|
+
| `css/descriptors` | the descriptors of each at-rule, and keyword values of some | written for this pack from the CSS specifications |
|
|
182
|
+
| `css/property-keywords` | the keywords of single-keyword properties | written for this pack from the CSS specifications |
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
name = "@codelaw/rules-css"
|
|
2
|
+
version = "0.1.0"
|
|
3
|
+
min_codelaw = "0.1.0"
|
|
4
|
+
languages = ["css"]
|
|
5
|
+
presets = ["css/recommended", "css/standard", "css/conventions"]
|
|
6
|
+
description = "codelaw's rules for CSS, also run on HTML <style> elements and style attributes (SR-RULE-PACKS)"
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"known": [
|
|
3
|
+
"annotation",
|
|
4
|
+
"apply",
|
|
5
|
+
"bottom-center",
|
|
6
|
+
"bottom-left",
|
|
7
|
+
"bottom-left-corner",
|
|
8
|
+
"bottom-right",
|
|
9
|
+
"bottom-right-corner",
|
|
10
|
+
"character-variant",
|
|
11
|
+
"container",
|
|
12
|
+
"counter-style",
|
|
13
|
+
"custom-media",
|
|
14
|
+
"custom-selector",
|
|
15
|
+
"document",
|
|
16
|
+
"font-face",
|
|
17
|
+
"font-feature-values",
|
|
18
|
+
"font-palette-values",
|
|
19
|
+
"function",
|
|
20
|
+
"historical-forms",
|
|
21
|
+
"import",
|
|
22
|
+
"keyframes",
|
|
23
|
+
"layer",
|
|
24
|
+
"left-bottom",
|
|
25
|
+
"left-middle",
|
|
26
|
+
"left-top",
|
|
27
|
+
"media",
|
|
28
|
+
"namespace",
|
|
29
|
+
"nest",
|
|
30
|
+
"ornaments",
|
|
31
|
+
"page",
|
|
32
|
+
"position-try",
|
|
33
|
+
"property",
|
|
34
|
+
"right-bottom",
|
|
35
|
+
"right-middle",
|
|
36
|
+
"right-top",
|
|
37
|
+
"scope",
|
|
38
|
+
"scroll-timeline",
|
|
39
|
+
"starting-style",
|
|
40
|
+
"styleset",
|
|
41
|
+
"stylistic",
|
|
42
|
+
"supports",
|
|
43
|
+
"swash",
|
|
44
|
+
"top-center",
|
|
45
|
+
"top-left",
|
|
46
|
+
"top-left-corner",
|
|
47
|
+
"top-right",
|
|
48
|
+
"top-right-corner",
|
|
49
|
+
"view-transition",
|
|
50
|
+
"viewport"
|
|
51
|
+
],
|
|
52
|
+
"deprecated": [
|
|
53
|
+
"document",
|
|
54
|
+
"nest",
|
|
55
|
+
"viewport"
|
|
56
|
+
],
|
|
57
|
+
"nesting": [
|
|
58
|
+
"apply",
|
|
59
|
+
"container",
|
|
60
|
+
"layer",
|
|
61
|
+
"media",
|
|
62
|
+
"scope",
|
|
63
|
+
"starting-style",
|
|
64
|
+
"supports"
|
|
65
|
+
],
|
|
66
|
+
"declaration_containing": [
|
|
67
|
+
"mixin",
|
|
68
|
+
"scope"
|
|
69
|
+
],
|
|
70
|
+
"page_margin": [
|
|
71
|
+
"bottom-center",
|
|
72
|
+
"bottom-left",
|
|
73
|
+
"bottom-left-corner",
|
|
74
|
+
"bottom-right",
|
|
75
|
+
"bottom-right-corner",
|
|
76
|
+
"left-bottom",
|
|
77
|
+
"left-middle",
|
|
78
|
+
"left-top",
|
|
79
|
+
"right-bottom",
|
|
80
|
+
"right-middle",
|
|
81
|
+
"right-top",
|
|
82
|
+
"top-center",
|
|
83
|
+
"top-left",
|
|
84
|
+
"top-left-corner",
|
|
85
|
+
"top-right",
|
|
86
|
+
"top-right-corner"
|
|
87
|
+
],
|
|
88
|
+
"font_feature_value_types": [
|
|
89
|
+
"annotation",
|
|
90
|
+
"character-variant",
|
|
91
|
+
"historical-forms",
|
|
92
|
+
"ornaments",
|
|
93
|
+
"styleset",
|
|
94
|
+
"stylistic",
|
|
95
|
+
"swash"
|
|
96
|
+
]
|
|
97
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
{
|
|
2
|
+
"at_rules": [
|
|
3
|
+
"document",
|
|
4
|
+
"nest",
|
|
5
|
+
"viewport"
|
|
6
|
+
],
|
|
7
|
+
"color_properties": [
|
|
8
|
+
"border-color",
|
|
9
|
+
"scrollbar-color"
|
|
10
|
+
],
|
|
11
|
+
"colors": {
|
|
12
|
+
"activeborder": "ButtonBorder",
|
|
13
|
+
"activecaption": "Canvas",
|
|
14
|
+
"appworkspace": "Canvas",
|
|
15
|
+
"background": "Canvas",
|
|
16
|
+
"buttonhighlight": "ButtonFace",
|
|
17
|
+
"buttonshadow": "ButtonFace",
|
|
18
|
+
"captiontext": "CanvasText",
|
|
19
|
+
"inactiveborder": "ButtonBorder",
|
|
20
|
+
"inactivecaption": "Canvas",
|
|
21
|
+
"inactivecaptiontext": "GrayText",
|
|
22
|
+
"infobackground": "Canvas",
|
|
23
|
+
"infotext": "CanvasText",
|
|
24
|
+
"menu": "Canvas",
|
|
25
|
+
"menutext": "CanvasText",
|
|
26
|
+
"scrollbar": "Canvas",
|
|
27
|
+
"threeddarkshadow": "ButtonBorder",
|
|
28
|
+
"threedface": "ButtonFace",
|
|
29
|
+
"threedhighlight": "ButtonBorder",
|
|
30
|
+
"threedlightshadow": "ButtonBorder",
|
|
31
|
+
"threedshadow": "ButtonBorder",
|
|
32
|
+
"window": "Canvas",
|
|
33
|
+
"windowframe": "ButtonBorder",
|
|
34
|
+
"windowtext": "CanvasText"
|
|
35
|
+
},
|
|
36
|
+
"keywords": {
|
|
37
|
+
"appearance": {
|
|
38
|
+
"button": "auto",
|
|
39
|
+
"checkbox": "auto",
|
|
40
|
+
"listbox": "auto",
|
|
41
|
+
"menulist": "auto",
|
|
42
|
+
"meter": "auto",
|
|
43
|
+
"progress-bar": "auto",
|
|
44
|
+
"push-button": "auto",
|
|
45
|
+
"radio": "auto",
|
|
46
|
+
"searchfield": "auto",
|
|
47
|
+
"slider-horizontal": "auto",
|
|
48
|
+
"square-button": "auto",
|
|
49
|
+
"textarea": "auto"
|
|
50
|
+
},
|
|
51
|
+
"box-sizing": {
|
|
52
|
+
"padding-box": null
|
|
53
|
+
},
|
|
54
|
+
"height": {
|
|
55
|
+
"intrinsic": null,
|
|
56
|
+
"min-intrinsic": null
|
|
57
|
+
},
|
|
58
|
+
"image-orientation": {
|
|
59
|
+
"flip": null
|
|
60
|
+
},
|
|
61
|
+
"image-rendering": {
|
|
62
|
+
"optimizequality": "smooth",
|
|
63
|
+
"optimizespeed": "pixelated"
|
|
64
|
+
},
|
|
65
|
+
"max-height": {
|
|
66
|
+
"intrinsic": null,
|
|
67
|
+
"min-intrinsic": null
|
|
68
|
+
},
|
|
69
|
+
"max-width": {
|
|
70
|
+
"intrinsic": null,
|
|
71
|
+
"min-intrinsic": null
|
|
72
|
+
},
|
|
73
|
+
"min-height": {
|
|
74
|
+
"intrinsic": null,
|
|
75
|
+
"min-intrinsic": null
|
|
76
|
+
},
|
|
77
|
+
"min-width": {
|
|
78
|
+
"intrinsic": null,
|
|
79
|
+
"min-intrinsic": null
|
|
80
|
+
},
|
|
81
|
+
"overflow": {
|
|
82
|
+
"overlay": "auto"
|
|
83
|
+
},
|
|
84
|
+
"overflow-x": {
|
|
85
|
+
"overlay": "auto"
|
|
86
|
+
},
|
|
87
|
+
"overflow-y": {
|
|
88
|
+
"overlay": "auto"
|
|
89
|
+
},
|
|
90
|
+
"text-decoration": {
|
|
91
|
+
"blink": null
|
|
92
|
+
},
|
|
93
|
+
"text-decoration-line": {
|
|
94
|
+
"blink": null
|
|
95
|
+
},
|
|
96
|
+
"text-justify": {
|
|
97
|
+
"distribute": "inter-character"
|
|
98
|
+
},
|
|
99
|
+
"text-orientation": {
|
|
100
|
+
"sideways-right": "sideways"
|
|
101
|
+
},
|
|
102
|
+
"user-select": {
|
|
103
|
+
"element": "contain"
|
|
104
|
+
},
|
|
105
|
+
"width": {
|
|
106
|
+
"intrinsic": null,
|
|
107
|
+
"min-intrinsic": null
|
|
108
|
+
},
|
|
109
|
+
"word-break": {
|
|
110
|
+
"break-word": null
|
|
111
|
+
},
|
|
112
|
+
"zoom": {
|
|
113
|
+
"reset": "1"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"properties": {
|
|
117
|
+
"-khtml-box-align": "align-items",
|
|
118
|
+
"-khtml-box-direction": null,
|
|
119
|
+
"-khtml-box-flex": "flex-grow",
|
|
120
|
+
"-khtml-box-lines": null,
|
|
121
|
+
"-khtml-box-ordinal-group": "order",
|
|
122
|
+
"-khtml-box-orient": null,
|
|
123
|
+
"-khtml-box-pack": null,
|
|
124
|
+
"-khtml-user-modify": null,
|
|
125
|
+
"-moz-box-align": "align-items",
|
|
126
|
+
"-moz-box-direction": null,
|
|
127
|
+
"-moz-box-flex": "flex-grow",
|
|
128
|
+
"-moz-box-lines": null,
|
|
129
|
+
"-moz-box-ordinal-group": "order",
|
|
130
|
+
"-moz-box-orient": null,
|
|
131
|
+
"-moz-box-pack": null,
|
|
132
|
+
"-moz-user-modify": null,
|
|
133
|
+
"-ms-box-align": "align-items",
|
|
134
|
+
"-ms-box-direction": null,
|
|
135
|
+
"-ms-box-flex": "flex-grow",
|
|
136
|
+
"-ms-box-lines": null,
|
|
137
|
+
"-ms-box-ordinal-group": "order",
|
|
138
|
+
"-ms-box-orient": null,
|
|
139
|
+
"-ms-box-pack": null,
|
|
140
|
+
"-webkit-box-align": "align-items",
|
|
141
|
+
"-webkit-box-direction": null,
|
|
142
|
+
"-webkit-box-flex": "flex-grow",
|
|
143
|
+
"-webkit-box-lines": null,
|
|
144
|
+
"-webkit-box-ordinal-group": "order",
|
|
145
|
+
"-webkit-box-orient": null,
|
|
146
|
+
"-webkit-box-pack": null,
|
|
147
|
+
"-webkit-user-modify": null,
|
|
148
|
+
"clip": null,
|
|
149
|
+
"grid-column-gap": "column-gap",
|
|
150
|
+
"grid-gap": "gap",
|
|
151
|
+
"grid-row-gap": "row-gap",
|
|
152
|
+
"ime-mode": null,
|
|
153
|
+
"page-break-after": "break-after",
|
|
154
|
+
"page-break-before": "break-before",
|
|
155
|
+
"page-break-inside": "break-inside",
|
|
156
|
+
"position-try-options": "position-try-fallbacks",
|
|
157
|
+
"scroll-snap-coordinate": null,
|
|
158
|
+
"scroll-snap-destination": null,
|
|
159
|
+
"scroll-snap-margin": "scroll-margin",
|
|
160
|
+
"scroll-snap-margin-bottom": "scroll-margin-bottom",
|
|
161
|
+
"scroll-snap-margin-left": "scroll-margin-left",
|
|
162
|
+
"scroll-snap-margin-right": "scroll-margin-right",
|
|
163
|
+
"scroll-snap-margin-top": "scroll-margin-top",
|
|
164
|
+
"scroll-snap-points-x": null,
|
|
165
|
+
"scroll-snap-points-y": null,
|
|
166
|
+
"scroll-snap-type-x": null,
|
|
167
|
+
"scroll-snap-type-y": null,
|
|
168
|
+
"word-wrap": "overflow-wrap"
|
|
169
|
+
},
|
|
170
|
+
"property_value_remap": {
|
|
171
|
+
"page-break-after": {
|
|
172
|
+
"always": "page"
|
|
173
|
+
},
|
|
174
|
+
"page-break-before": {
|
|
175
|
+
"always": "page"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"descriptors": {
|
|
3
|
+
"color-profile": [
|
|
4
|
+
"components",
|
|
5
|
+
"rendering-intent",
|
|
6
|
+
"src"
|
|
7
|
+
],
|
|
8
|
+
"counter-style": [
|
|
9
|
+
"additive-symbols",
|
|
10
|
+
"fallback",
|
|
11
|
+
"negative",
|
|
12
|
+
"pad",
|
|
13
|
+
"prefix",
|
|
14
|
+
"range",
|
|
15
|
+
"speak-as",
|
|
16
|
+
"suffix",
|
|
17
|
+
"symbols",
|
|
18
|
+
"system"
|
|
19
|
+
],
|
|
20
|
+
"font-face": [
|
|
21
|
+
"ascent-override",
|
|
22
|
+
"descent-override",
|
|
23
|
+
"font-display",
|
|
24
|
+
"font-family",
|
|
25
|
+
"font-feature-settings",
|
|
26
|
+
"font-language-override",
|
|
27
|
+
"font-named-instance",
|
|
28
|
+
"font-size",
|
|
29
|
+
"font-stretch",
|
|
30
|
+
"font-style",
|
|
31
|
+
"font-variant",
|
|
32
|
+
"font-variation-settings",
|
|
33
|
+
"font-weight",
|
|
34
|
+
"font-width",
|
|
35
|
+
"line-gap-override",
|
|
36
|
+
"size-adjust",
|
|
37
|
+
"src",
|
|
38
|
+
"subscript-position-override",
|
|
39
|
+
"subscript-size-override",
|
|
40
|
+
"superscript-position-override",
|
|
41
|
+
"superscript-size-override",
|
|
42
|
+
"unicode-range"
|
|
43
|
+
],
|
|
44
|
+
"font-feature-values": [
|
|
45
|
+
"font-display"
|
|
46
|
+
],
|
|
47
|
+
"font-palette-values": [
|
|
48
|
+
"base-palette",
|
|
49
|
+
"font-family",
|
|
50
|
+
"override-colors"
|
|
51
|
+
],
|
|
52
|
+
"page": [
|
|
53
|
+
"bleed",
|
|
54
|
+
"marks",
|
|
55
|
+
"page-margin-safety",
|
|
56
|
+
"page-orientation",
|
|
57
|
+
"size"
|
|
58
|
+
],
|
|
59
|
+
"property": [
|
|
60
|
+
"inherits",
|
|
61
|
+
"initial-value",
|
|
62
|
+
"syntax"
|
|
63
|
+
],
|
|
64
|
+
"view-transition": [
|
|
65
|
+
"navigation",
|
|
66
|
+
"types"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"keyword_values": {
|
|
70
|
+
"counter-style/system": [
|
|
71
|
+
"additive",
|
|
72
|
+
"alphabetic",
|
|
73
|
+
"cyclic",
|
|
74
|
+
"extends",
|
|
75
|
+
"fixed",
|
|
76
|
+
"numeric",
|
|
77
|
+
"symbolic"
|
|
78
|
+
],
|
|
79
|
+
"font-face/font-display": [
|
|
80
|
+
"auto",
|
|
81
|
+
"block",
|
|
82
|
+
"fallback",
|
|
83
|
+
"optional",
|
|
84
|
+
"swap"
|
|
85
|
+
],
|
|
86
|
+
"font-face/font-style": [
|
|
87
|
+
"italic",
|
|
88
|
+
"normal",
|
|
89
|
+
"oblique"
|
|
90
|
+
],
|
|
91
|
+
"font-feature-values/font-display": [
|
|
92
|
+
"auto",
|
|
93
|
+
"block",
|
|
94
|
+
"fallback",
|
|
95
|
+
"optional",
|
|
96
|
+
"swap"
|
|
97
|
+
],
|
|
98
|
+
"font-palette-values/base-palette": [
|
|
99
|
+
"dark",
|
|
100
|
+
"light"
|
|
101
|
+
],
|
|
102
|
+
"page/marks": [
|
|
103
|
+
"crop",
|
|
104
|
+
"cross",
|
|
105
|
+
"none"
|
|
106
|
+
],
|
|
107
|
+
"page/page-orientation": [
|
|
108
|
+
"rotate-left",
|
|
109
|
+
"rotate-right",
|
|
110
|
+
"upright"
|
|
111
|
+
],
|
|
112
|
+
"property/inherits": [
|
|
113
|
+
"false",
|
|
114
|
+
"true"
|
|
115
|
+
],
|
|
116
|
+
"view-transition/navigation": [
|
|
117
|
+
"auto",
|
|
118
|
+
"none"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
}
|