Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. # max-nesting-depth
  2. Limit the depth of nesting.
  3. <!-- prettier-ignore -->
  4. ```css
  5. a { & > b { top: 0; } }
  6. /** ↑
  7. * This nesting */
  8. ```
  9. This rule works by checking rules' and at-rules' actual "nesting depth" against your specified max. Here's how nesting depths works:
  10. <!-- prettier-ignore -->
  11. ```css
  12. a {
  13. & b { /* nesting depth 1 */
  14. & .foo { /* nesting depth 2 */
  15. @media print { /* nesting depth 3 */
  16. & .baz { /* nesting depth 4 */
  17. color: pink;
  18. }
  19. }
  20. }
  21. }
  22. }
  23. ```
  24. Note that **root-level at-rules will _not_ be included in the nesting depth calculation**, because most users would take for granted that root-level at-rules are "free" (because necessary). So both of the following `.foo` rules have a nesting depth of 2, and will therefore pass if your `max` is less than or equal to 2:
  25. <!-- prettier-ignore -->
  26. ```css
  27. a {
  28. b { /* 1 */
  29. .foo {} /* 2 */
  30. }
  31. }
  32. @media print { /* ignored */
  33. a {
  34. b { /* 1 */
  35. .foo {} /* 2 */
  36. }
  37. }
  38. }
  39. ```
  40. This rule integrates into stylelint's core the functionality of the (now deprecated) plugin [`stylelint-statement-max-nesting-depth`](https://github.com/davidtheclark/stylelint-statement-max-nesting-depth).
  41. ## Options
  42. `int`: Maximum nesting depth allowed.
  43. For example, with `2`:
  44. The following patterns are considered violations:
  45. <!-- prettier-ignore -->
  46. ```css
  47. a {
  48. & .foo { /* 1 */
  49. &__foo { /* 2 */
  50. & > .bar {} /* 3 */
  51. }
  52. }
  53. }
  54. ```
  55. <!-- prettier-ignore -->
  56. ```css
  57. a {
  58. @media print { /* 1 */
  59. & .foo { /* 2 */
  60. & .bar {} /* 3 */
  61. }
  62. }
  63. }
  64. ```
  65. The following patterns are _not_ considered violations:
  66. <!-- prettier-ignore -->
  67. ```css
  68. a {
  69. & .foo { /* 1 */
  70. &__foo {} /* 2 */
  71. }
  72. }
  73. a .foo__foo .bar .baz {}
  74. ```
  75. <!-- prettier-ignore -->
  76. ```css
  77. @media print {
  78. a {
  79. & .foo { /* 1 */
  80. &__foo {} /* 2 */
  81. }
  82. }
  83. }
  84. ```
  85. ## Optional secondary options
  86. ### `ignore: ["blockless-at-rules"]`
  87. Ignore at-rules that only wrap other rules, and do not themselves have declaration blocks.
  88. For example, with `1`:
  89. The following patterns are considered violations:
  90. As the at-rules have a declarations blocks.
  91. <!-- prettier-ignore -->
  92. ```css
  93. a {
  94. &:hover { /* 1 */
  95. @media (min-width: 500px) { color: pink; } /* 2 */
  96. }
  97. }
  98. ```
  99. <!-- prettier-ignore -->
  100. ```css
  101. a {
  102. @nest > b { /* 1 */
  103. .foo { color: pink; } /* 2 */
  104. }
  105. }
  106. ```
  107. The following patterns are _not_ considered violations:
  108. As all of the following `.foo` rules would have a nesting depth of just 1.
  109. <!-- prettier-ignore -->
  110. ```css
  111. a {
  112. .foo { color: pink; } /* 1 */
  113. }
  114. ```
  115. <!-- prettier-ignore -->
  116. ```css
  117. @media print { /* ignored regardless of options */
  118. a {
  119. .foo { color: pink; } /* 1 */
  120. }
  121. }
  122. ```
  123. <!-- prettier-ignore -->
  124. ```css
  125. a {
  126. @media print { /* ignored because it's an at-rule without a declaration block of its own */
  127. .foo { color: pink; } /* 1 */
  128. }
  129. }
  130. ```
  131. ### `ignore: ["pseudo-classes"]`
  132. Ignore rules where the first selector in each selector list item is a pseudo-class
  133. For example, with `1`:
  134. The following patterns are considered violations:
  135. <!-- prettier-ignore -->
  136. ```css
  137. .a {
  138. .b { /* 1 */
  139. .c { /* 2 */
  140. top: 0;
  141. }
  142. }
  143. }
  144. ```
  145. <!-- prettier-ignore -->
  146. ```css
  147. .a {
  148. &:hover { /* ignored */
  149. .b { /* 1 */
  150. .c { /* 2 */
  151. top: 0;
  152. }
  153. }
  154. }
  155. }
  156. ```
  157. <!-- prettier-ignore -->
  158. ```css
  159. .a {
  160. .b { /* 1 */
  161. &::selection { /* 2 */
  162. color: #64FFDA;
  163. }
  164. }
  165. }
  166. ```
  167. <!-- prettier-ignore -->
  168. ```css
  169. .a {
  170. .b { /* 1 */
  171. &:hover, .c { /* 2 */
  172. top: 0;
  173. }
  174. }
  175. }
  176. ```
  177. The following patterns are _not_ considered violations:
  178. As all of the following pseudoclasses rules would have a nesting depth of just 1.
  179. <!-- prettier-ignore -->
  180. ```css
  181. .a {
  182. .b { /* 1 */
  183. &:hover { /* ignored */
  184. top: 0;
  185. }
  186. }
  187. }
  188. ```
  189. <!-- prettier-ignore -->
  190. ```css
  191. .a {
  192. .b { /* 1 */
  193. &:nest {
  194. &:nest-lvl2 { /* ignored */
  195. top: 0;
  196. }
  197. }
  198. }
  199. }
  200. ```
  201. <!-- prettier-ignore -->
  202. ```css
  203. .a {
  204. &:hover { /* ignored */
  205. .b { /* 1 */
  206. top: 0;
  207. }
  208. }
  209. }
  210. ```
  211. <!-- prettier-ignore -->
  212. ```css
  213. .a {
  214. &:nest { /* ignored */
  215. &:nest-lvl2 { /* ignored */
  216. top: 0;
  217. .b { /* 1 */
  218. bottom: 0;
  219. }
  220. }
  221. }
  222. }
  223. ```
  224. <!-- prettier-ignore -->
  225. ```css
  226. .a {
  227. .b { /* 1 */
  228. &:hover, &:focus { /* ignored */
  229. top: 0;
  230. }
  231. }
  232. }
  233. ```
  234. ### `ignoreAtRules: ["/regex/", /regex/, "string"]`
  235. Ignore the specified at-rules.
  236. For example, with `1` and given:
  237. ```
  238. ["/^my-/", "media"]
  239. ```
  240. The following patterns are _not_ considered violations:
  241. <!-- prettier-ignore -->
  242. ```css
  243. a {
  244. @media print { /* 1 */
  245. b { /* 2 */
  246. c { top: 0; } /* 3 */
  247. }
  248. }
  249. }
  250. ```
  251. <!-- prettier-ignore -->
  252. ```css
  253. a {
  254. b { /* 1 */
  255. @media print { /* 2 */
  256. c { top: 0; } /* 3 */
  257. }
  258. }
  259. }
  260. ```
  261. <!-- prettier-ignore -->
  262. ```css
  263. a {
  264. @my-at-rule print { /* 1 */
  265. b { /* 2 */
  266. c { top: 0; } /* 3 */
  267. }
  268. }
  269. }
  270. ```
  271. <!-- prettier-ignore -->
  272. ```css
  273. a {
  274. @my-other-at-rule print { /* 1 */
  275. b { /* 2 */
  276. c { top: 0; } /* 3 */
  277. }
  278. }
  279. }
  280. ```
  281. The following patterns are considered violations:
  282. <!-- prettier-ignore -->
  283. ```css
  284. a {
  285. @import print { /* 1 */
  286. b { top: 0; } /* 2 */
  287. }
  288. }
  289. ```
  290. <!-- prettier-ignore -->
  291. ```css
  292. a {
  293. @not-my-at-rule print { /* 1 */
  294. b { top: 0; } /* 2 */
  295. }
  296. }
  297. ```