{"_id":"@apostrophecms/stylelint-no-mixed-decls-stable","name":"@apostrophecms/stylelint-no-mixed-decls-stable","dist-tags":{"latest":"1.2.0"},"versions":{"1.2.0":{"name":"@apostrophecms/stylelint-no-mixed-decls-stable","version":"1.2.0","description":"A Stylelint plugin that enforces Sass's `mixed-decls` rule.","keywords":["stylelint","stylelint-plugin","scss","sass","mixed-declarations","mixed-decls","apostrophecms"],"main":"index.js","scripts":{"lint":"eslint .","pretest":"npm run lint","test":"nyc mocha"},"repository":{"type":"git","url":"git+https://github.com/apostrophecms/apostrophe.git","directory":"packages/stylelint-no-mixed-decls"},"homepage":"https://github.com/apostrophecms/apostrophe/tree/main/packages/stylelint-no-mixed-decls#readme","author":{"name":"Apostrophe Technologies, Inc."},"license":"MIT","bugs":{"url":"https://github.com/apostrophecms/stylelint-no-mixed-decls/issues"},"peerDependencies":{"stylelint":">= 16.1.0"},"devDependencies":{"eslint":"^9.39.1","eslint-config-apostrophe":"workspace:^","mocha":"^11.7.5","nyc":"^17.1.0","postcss-scss":"^4.0.9","stylelint-config-standard-scss":"^14.0.0"},"apostropheTestConfig":{"requiresMongo":false},"gitHead":"b3e29f004f514041e1e389293ae67017c60d006e","_id":"@apostrophecms/stylelint-no-mixed-decls-stable@1.2.0","_nodeVersion":"24.10.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-iFmteTu9CCCj1KHOjPvVYLpnz4q7bmwiMmtZgkbgndGniVWT2fzi+o4UmSh4i+OzRR5T5PJVpnmDXNxNGnYy7g==","shasum":"e873a2521ac16bf8d1c183549b9576686f2434dd","tarball":"https://registry.npmjs.org/@apostrophecms/stylelint-no-mixed-decls-stable/-/stylelint-no-mixed-decls-stable-1.2.0.tgz","fileCount":11,"unpackedSize":15632,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDcOyvEQejndym+qNNEJa1unQLKq2cU2b7NpfaYNQFdvAiEA2CUzE47Aw1ziOpoMiEcfQ0SbsqFLbo1Gjs2qbECIUrw="}]},"_npmUser":{"name":"boutell","email":"tom@apostrophecms.com"},"directories":{},"maintainers":[{"name":"alexgilbert","email":"alex@apostrophecms.com"},{"name":"boutell","email":"tom@apostrophecms.com"},{"name":"romanek","email":"stuart+npm@apostrophecms.com"},{"name":"bodonkey","email":"robert.means1969+apostrophecms@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/stylelint-no-mixed-decls-stable_1.2.0_1781112831739_0.5092984114073102"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-10T17:33:51.574Z","1.2.0":"2026-06-10T17:33:51.915Z","modified":"2026-06-10T17:33:52.212Z"},"maintainers":[{"name":"alexgilbert","email":"alex@apostrophecms.com"},{"name":"boutell","email":"tom@apostrophecms.com"},{"name":"romanek","email":"stuart+npm@apostrophecms.com"},{"name":"bodonkey","email":"robert.means1969+apostrophecms@gmail.com"}],"description":"A Stylelint plugin that enforces Sass's `mixed-decls` rule.","homepage":"https://github.com/apostrophecms/apostrophe/tree/main/packages/stylelint-no-mixed-decls#readme","keywords":["stylelint","stylelint-plugin","scss","sass","mixed-declarations","mixed-decls","apostrophecms"],"repository":{"type":"git","url":"git+https://github.com/apostrophecms/apostrophe.git","directory":"packages/stylelint-no-mixed-decls"},"author":{"name":"Apostrophe Technologies, Inc."},"bugs":{"url":"https://github.com/apostrophecms/stylelint-no-mixed-decls/issues"},"license":"MIT","readme":"# @apostrophecms/stylelint-no-mixed-decls \n\nA Stylelint plugin that enforces Sass's `mixed-decls` rule — requiring declarations and nested rules to be ordered according to Sass's updated behavior.\n\n> ⚠️ Since Sass `1.77.0+`, CSS blocks can no longer freely mix declarations and nested rules.  \n> If you want to declare additional styles after nested rules, those declarations must be placed inside a `& { }` block.\n>\n> See: https://sass-lang.com/documentation/breaking-changes/mixed-decls/\n\n## What this plugin does\n\n- Prevents declarations appearing after nested rules within a CSS block unless they're wrapped in a `& { }` block.\n- Handle `@include` statements that may contain nested rules.\n\n## Installation\n\n```bash\nnpm install @apostrophecms/stylelint-no-mixed-decls --save-dev\n```\n\n## Usage\n\nAdd it to your Stylelint configuration:\n\n```js\n{\n  \"plugins\": [ \"@apostrophecms/stylelint-no-mixed-decls\" ],\n  \"rules\": {\n    \"@apostrophecms/stylelint-no-mixed-decls\": true\n  }\n}\n```\n\nYou can set a `contain-nested` option to list mixins that are known to contain nested rules.  \nThis is an answer to the [limitations](#limitations) that this plugin cannot analyze mixin definitions from other files.\n\n```js\n{\n  \"plugins\": [ \"@apostrophecms/stylelint-no-mixed-decls\" ],\n  \"rules\": {\n    \"@apostrophecms/stylelint-no-mixed-decls\": [\n      true,\n      {\n        \"contain-nested\": [ \"external-mixin-known-to-contain-nested-rules\" ]\n      }\n    ] \n  }\n}\n```\n\n## Example: Correct Usage\n\n```scss\n.foo {\n  color: red;\n\n  &--large {\n    font-size: 24px;\n  }\n\n  & {\n    font-weight: bold;\n  }\n}\n```\n\n```scss\n@mixin foo {\n  display: block;\n  clear: both;\n}\n\n.foo {\n  @include foo;\n  @include external-mixin; // not known to contain nested rules\n  color: red;\n}\n```\n\n```scss\n@mixin foo {\n  display: block;\n  clear: both;\n\n  &--large {\n    font-size: 24px;\n  }\n}\n\n.foo {\n  @include foo;\n\n  & {\n    color: red;\n  }\n}\n```\n\n```scss\n@mixin foo {\n  & {\n    display: block;\n    clear: both;\n  }\n}\n\n.foo {\n  font-weight: bold;\n\n  & {\n    color: red;\n  }\n\n  @include foo;\n}\n```\n\n## Example: Incorrect Usage (will report)\n\n```scss\n.foo {\n  color: red;\n\n  &--large {\n    font-size: 24px;\n  }\n\n  font-weight: bold; // ❌ Cannot mix declarations and nested rules. Group them together or wrap declarations in a nested \"& { }\" block. See https://sass-lang.com/documentation/breaking-changes/mixed-decls/\n}\n```\n\n```scss\n@mixin foo {\n  display: block;\n  clear: both;\n\n  &--large {\n    font-size: 24px;\n  }\n}\n\n.foo {\n  @include foo;\n  color: red; // ❌ Cannot mix declarations and nested rules. Group them together or wrap declarations in a nested \"& { }\" block. See https://sass-lang.com/documentation/breaking-changes/mixed-decls/\n}\n```\n\n```scss\n@mixin foo {\n  display: block; // ❌ Cannot mix declarations and nested rules. Group them together or wrap declarations in a nested \"& { }\" block. See https://sass-lang.com/documentation/breaking-changes/mixed-decls/\n  clear: both; // ❌ Cannot mix declarations and nested rules. Group them together or wrap declarations in a nested \"& { }\" block. See https://sass-lang.com/documentation/breaking-changes/mixed-decls/\n}\n\n.foo {\n  font-weight: bold;\n\n  & {\n    color: red;   \n  }\n\n  @include foo;\n}\n```\n\n```scss\n.foo {\n  @include external-mixin-known-to-contain-nested-rules;\n\n  color: red; // ❌ Cannot mix declarations and nested rules. Group them together or wrap declarations in a nested \"& { }\" block. See https://sass-lang.com/documentation/breaking-changes/mixed-decls/\n}\n```\n\n## Why this matters\n\nThis plugin ensures your Sass code adheres to modern CSS nesting behavior,\nprevents breaking builds on newer Sass versions,\nand keeps your codebase cleanly structured.\n\n## Limitations\n\nThis plugin only analyzes mixins defined within the same file being linted.\nIt does not resolve or inspect mixin definitions from other files,\neven if those files are imported via Sass `@use` or `@import`.\n\nAs a result:\n\n- If a mixin with the same name exists in multiple files with different contents\n(some containing nested rules, others not), this plugin will only be aware of\nthe mixin definitions present in the file currently being linted.\n\n- It will not detect nested rules within mixins defined elsewhere or included\nfrom external files.\n\n**Recommendation:**\n\nTo ensure accurate linting results, define critical mixins with nested rules consistently\nor colocate them with the code that uses them.\nAlternatively, wrap declarations following `@include` statements\nin a nested `& { }` block as a safe default when unsure of the mixin's contents.\n\n**Use `contain-nested` option:**\n\nThis option can be used to list mixins that are known to contain nested rules,\nso that the plugin can treat them accordingly,\neven if their definition is not present in the file they are used.\n\n## Please contribute!\n\nWe welcome contributions! If you find a bug or something missing,\nplease open an issue or submit a pull request.\n","readmeFilename":"README.md","_rev":"1-7df63135dcd71cc57cbe24eccc25ff4d"}