Skip to content

Commit

Permalink
docs: improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Dec 11, 2024
1 parent 20ffc3d commit 10e86dc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Declarations (mode `local`, by default):
In pure mode, all selectors must contain at least one local class or id
selector

To ignore this rule for a specific selector, add the following comment in front
To ignore this rule for a specific selector, add the a `/* cssmodules-pure-ignore */` comment in front
of the selector:

```css
Expand All @@ -69,6 +69,20 @@ of the selector:
}
```

or by adding a `/* cssmodules-pure-no-check */` comment at the top of a file to disable this check for the whole file:

```css
/* cssmodules-pure-no-check */

:global(#modal-backdrop) {
...;
}

:global(#my-id) {
...;
}
```

## Building

```bash
Expand Down
9 changes: 9 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,15 @@ const tests = [
/* cssmodules-pure-no-check */`,
error: /is not pure/,
},
{
name: "should ignore no-check comment if not at root level #2",
options: { mode: "pure" },
input: `/* Some file description */
.class { color: red; }
/* cssmodules-pure-no-check */
:global(.foo) { color: blue }`,
error: /is not pure/,
},
{
name: "should allow other comments before no-check comment",
options: { mode: "pure" },
Expand Down

0 comments on commit 10e86dc

Please sign in to comment.