@style-contract/binary-win32-x64 0.7.2 → 0.8.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 +12 -7
- package/package.json +1 -1
- package/style-contract.exe +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# StyleContract
|
|
2
2
|
|
|
3
|
-
StyleContract is a fast, standalone Rust CLI that verifies the contract between TypeScript CSS Module references and CSS/SCSS declarations. It detects missing symbols, unused classes and `:export` keys, empty style rules, unsafe module-to-module stylesheet imports, naming mismatches, and dynamic accesses that cannot be checked safely.
|
|
3
|
+
StyleContract is a fast, standalone Rust CLI that verifies the contract between TypeScript CSS Module references and CSS/SCSS declarations. It detects missing symbols, unused classes and `:export` keys, empty style rules, unsafe module-to-module stylesheet imports, optional naming mismatches, and dynamic accesses that cannot be checked safely.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ The platform packages use names such as `@style-contract/binary-win32-x64`. They
|
|
|
17
17
|
It can then be run from package scripts or directly with `npx`:
|
|
18
18
|
|
|
19
19
|
```console
|
|
20
|
-
npx style-contract
|
|
20
|
+
npx style-contract
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Alternatively, build and install directly from the Rust source:
|
|
@@ -28,19 +28,24 @@ cargo install --path .
|
|
|
28
28
|
|
|
29
29
|
## Use
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Naming enforcement is optional. With no convention, StyleContract uses `none`: it emits no naming diagnostics and treats `styles.primaryButton` as a reference to both `.primaryButton` and `.primary-button`. This is deliberately not convention detection.
|
|
32
|
+
|
|
33
|
+
Choose an explicit convention on the command line or in a config file when a project should enforce one:
|
|
32
34
|
|
|
33
35
|
```console
|
|
34
36
|
style-contract --convention camel-case
|
|
35
37
|
style-contract --convention kebab-case
|
|
36
38
|
style-contract --convention camel-to-kebab
|
|
39
|
+
style-contract --convention none
|
|
37
40
|
```
|
|
38
41
|
|
|
39
|
-
`camel-case` accepts both lower-camel names such as `primaryButton` and capitalized names such as `ComponentRoot`. `camel-to-kebab`
|
|
42
|
+
`camel-case` accepts both lower-camel names such as `primaryButton` and capitalized names such as `ComponentRoot`. `camel-to-kebab` requires lower-camel TypeScript references and maps `styles.primaryButton` to `.primary-button`. `kebab-case` references use bracket notation such as `styles["primary-button"]`. In `none`, kebab references remain exact: `styles["primary-button"]` does not also reference `.primaryButton`.
|
|
40
43
|
|
|
41
44
|
Available options:
|
|
42
45
|
|
|
43
46
|
```text
|
|
47
|
+
--convention <none|camel-case|kebab-case|camel-to-kebab>
|
|
48
|
+
Naming convention (default: none)
|
|
44
49
|
--source <PATH> Source folder (default: ./src)
|
|
45
50
|
--output <minimal|rich> Output style (default: rich)
|
|
46
51
|
--config <PATH> JSON5 configuration file (auto: ./style-contract.json)
|
|
@@ -88,7 +93,7 @@ Supported rules:
|
|
|
88
93
|
- `empty-rule`
|
|
89
94
|
- `module-to-module-import`
|
|
90
95
|
|
|
91
|
-
All enabled rules are errors except `naming-convention-global`, `dynamic-reference`, `empty-rule`, and `module-to-module-import`, which are warnings. `unused-dependent-class` is disabled by default; when enabled, it verifies that classes declared in same-element compound selectors are used together with a complete prerequisite class path in one JSX `className` expression or `clsx(...)` call. `empty-rule` reports selector blocks that contain only whitespace or comments; empty `:export` and structural at-rule blocks are not reported. `module-to-module-import` reports `@use`, `@forward`, and `@import` dependencies from one `.module.css` or `.module.scss` file to another. Imports from ordinary non-module stylesheets remain allowed. The warning exists because Sass merges the imported module's classes into the importing module's generated class map, which can expose unexpected classes and compound through transitive import chains.
|
|
96
|
+
All enabled rules are errors except `naming-convention-local`, `naming-convention-global`, `dynamic-reference`, `empty-rule`, and `module-to-module-import`, which are warnings. Naming-convention rules do not emit findings in `none` mode. `unused-dependent-class` is disabled by default; when enabled, it verifies that classes declared in same-element compound selectors are used together with a complete prerequisite class path in one JSX `className` expression or `clsx(...)` call. `empty-rule` reports selector blocks that contain only whitespace or comments; empty `:export` and structural at-rule blocks are not reported. `module-to-module-import` reports `@use`, `@forward`, and `@import` dependencies from one `.module.css` or `.module.scss` file to another. Imports from ordinary non-module stylesheets remain allowed. The warning exists because Sass merges the imported module's classes into the importing module's generated class map, which can expose unexpected classes and compound through transitive import chains.
|
|
92
97
|
|
|
93
98
|
### Targeted suppressions
|
|
94
99
|
|
|
@@ -132,7 +137,7 @@ Rich output uses compiler-style diagnostics, terminal colors, linked-looking sou
|
|
|
132
137
|
|
|
133
138
|
The MVP supports `.ts`, `.tsx`, `.css`, and `.scss`, default or namespace CSS Module imports, relative imports, tsconfig `baseUrl`/`paths`, dot and literal bracket access, and static destructuring. It recognizes literal class selectors, nested literal SCSS selectors, empty selector blocks, `:export` blocks, CSS Modules `:global`/`:local` functions and blocks, Sass `@use`/`@forward`/`@import` dependencies, Sass `@extend`, and same-file or relative-file CSS Modules `composes` references.
|
|
134
139
|
|
|
135
|
-
Classes in `.module.css` and `.module.scss` are local by default. Classes in other stylesheets are global by default.
|
|
140
|
+
Classes in `.module.css` and `.module.scss` are local by default. Classes in other stylesheets are global by default. With an explicit convention, global classes are checked against the warning-level global convention rule, but are not CSS Module exports and therefore do not participate in missing or unused checks.
|
|
136
141
|
|
|
137
142
|
Dynamic Sass-generated selectors and computed accesses such as `styles[name]` produce warnings. Because their complete usage cannot be proven, unused-symbol findings are suppressed for that stylesheet. StyleContract detects module-to-module Sass dependencies but does not evaluate Sass or flatten imported classes into the importing module's symbol table. Sass evaluation and `composes` evaluation remain outside the MVP.
|
|
138
143
|
|
|
@@ -149,5 +154,5 @@ cargo build --release
|
|
|
149
154
|
|
|
150
155
|
Releases are published from version tags. Before the first release, create or claim the `@style-contract` organization on npm, grant the publisher access to it, and add an npm automation token to the GitHub repository as the `NPM_TOKEN` Actions secret.
|
|
151
156
|
|
|
152
|
-
Keep the version in `package.json`, `Cargo.toml`, `Cargo.lock`, and every platform package dependency identical. The release verifier enforces this. Push a tag matching that version, such as `v0.
|
|
157
|
+
Keep the version in `package.json`, `Cargo.toml`, `Cargo.lock`, and every platform package dependency identical. The release verifier enforces this. Push a tag matching that version, such as `v0.8.0`; the release workflow builds and publishes all eight platform packages before publishing `style-contract`.
|
|
153
158
|
|
package/package.json
CHANGED
package/style-contract.exe
CHANGED
|
Binary file
|