1.0.0 • Published 16 days ago

@f1stnpm3/numquam-nemo-dicta v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
16 days ago

Media Use Custom Media

NPM Version test Support Chat

Media Use Custom Media is a stylelint rule to enforce usage of custom media queries in CSS.

Usage

Add stylelint and Media Use Custom Media to your project.

npm install stylelint @f1stnpm3/numquam-nemo-dicta --save-dev

Add Media Use Custom Media to your stylelint configuration.

{
  "plugins": [
    "@f1stnpm3/numquam-nemo-dicta"
  ],
  "rules": {
    "csstools/media-use-custom-media": "always" || "always-known" || "known" || "never" || "ignore"
  }
}

Options

always

If the first option is "always" or true, then Media Use Custom Media requires all @media queries to use Custom Media, and the following patterns are not considered violations:

@media (--sm) {}

@media (--sm), (--md) {}

@media screen and (--sm) {}

While the following patterns are considered violations:

@media (max-width: 40rem) {}

@media (max-width: 40rem), (--md) {}

never

If the first option is "never", then Media Use Custom Media requires all @media queries to not use Custom Media, and the following patterns are not considered violations:

@media (max-width: 40rem) {}

@media screen and (max-width: 40rem) {}

While the following patterns are considered violations:

@media (--md) {}

@media screen and (--md) {}

@media (--md), (max-width: 40rem) {}

known

If the first option is "known", then Media Use Custom Media requires all @media queries referencing Custom Media to be known from either @custom-media declarations in the file or imported using the second option. Then the following patterns are not considered violations:

@custom-media --sm (min-width: 40rem);

@media (--sm) {}

@media (--sm), (min-width: 40rem) {}

While the following patterns are considered violations:

@media (--md) {}

@media (--md), (min-width: 40rem) {}

always-known

If the first option is "always-known", then Media Use Custom Media requires all @media queries to use known Custom Media from either @custom-media declarations in the file or imported using the second option. Then the following patterns are not considered violations:

@custom-media --sm (min-width: 40rem);

@media (--sm) {}

While the following patterns are considered violations:

@custom-media --sm (min-width: 40rem);

@media (--sm), (min-width: 40rem) {}

@media (--md) {}

ignore

If the first option is "ignore" or null, then Media Use Custom Media does nothing.


importFrom

When the first option is "always-known" or "known", then the second option can specify sources where Custom Properties should be imported from by using an importFrom key. These imports might be CSS, JS, and JSON files, functions, and directly passed objects.

// .stylelintrc
{
  "plugins": [
    "@f1stnpm3/numquam-nemo-dicta"
  ],
  "rules": {
    "csstools/media-use-custom-media": ["known", {
      "importFrom": [
        "path/to/file.css", // => @custom-media --sm (min-width: 40rem);
        "path/to/file.json" // => { "custom-media": { "--sm": "(min-width: 40rem)" } }
      ]
    }
  }
}
touchnumberplugineslint-pluginfixed-widthroutertypesafeinInt8Arrayprivatebootstrap lessInt16ArrayfinditeratorjQueryReflect.getPrototypeOfregularinferencelistenersTypedArraysettingsassertioncacheargumentpatchglobless.jsvalidationescapelastprettyserializeappmodulessimpledblimitargssymlinkqsECMAScript 2016jsxefficientoperating-systemECMAScript 2019sideidleduplexstylesheetsequencepackagesdataviewmochaextrastructuredClonerfc4122ECMAScript 2017colorponyfillenvironmentkoreanObject.fromEntriesnpmstreamsreadexecargvnodejsfslesscssECMAScript 2023elasticacheObject.getPrototypeOfdescriptionrobustamazonObject.valuessnsdeep-clonecryptocallbindprotoschemegetPrototypeOftypesECMAScript 5internal slotRegExp.prototype.flagspersistentsomees2018fast-deep-clonesetPrototypeOfcontainsES2017classesairbnbtoolkitObject.keysES5redactstyleguidedataViewsymlinksES2023concatgetOwnPropertyDescriptorelma11yslotwarningemrchanneljsonsafestarterstreamSymbol.toStringTagcss lesstestingECMAScript 6Iteratores5weakmapvestrestfulstyleconcatMaprm -freditorendpointidsharedspeedeslintshrinkwrapfullwidthECMAScript 2022.envmatchesimmerutil0stateauthTypeBoxiteratespawnstringifyregular expressiontoolsmappackage.jsonvalidinterruptsqueryfetchtermshimextendwhatwgratedataprunehigher-ordertaskSetwhichMapcryptautoscalingaccessibilityes2016jshinthotliveconcurrencythroatCSSStyleDeclarationgenericsnegativeArray.prototype.containsexepackage managerArray.prototype.findLastIndexwalkingArray.prototype.flatdefinevarsutilitieseventsreact-testing-librarylanguagetimesinatrarandomweaksetbddchineseWebSocketscloudtrailtddhandlersstringifierJSONpassworddeepquerystringsetiamecmascriptqueueshebangUnderscoresignalswatchbyteOffsetdiff256ES2022StreamsoptimistkeyrdsPromiselimitedjoinested cssarktypeeveryec2searchlogbyteuperror-handlinghookscode pointspathurlssortfast-deep-copyfluxhasOwncss-in-jsECMAScript 2018onceregexECMAScript 7apideepcloneincludesFloat64Arrayrm -rfflatES2018middlewarepositiveUint8Array$.extendECMAScript 2015exit-codesliceasyncdotenvisConcatSpreadablefile systemmime-dbredux-toolkitES2020URLSearchParamsfunctionalphoneassertcloudformationpnpm9propertiesbootstrap cssutil.inspectlazyreusejsdiffsigtermmobilejapanesedynamodbmetadatasesrequirechrome
@f1stnpm3/amet-soluta-vero@f1stnpm3/aperiam-harum-ex@f1stnpm3/architecto-aliquam-sequi@f1stnpm3/architecto-dignissimos-at@f1stnpm3/architecto-quos-rerum@f1stnpm3/asperiores-repellat-rerum@f1stnpm3/asperiores-sapiente-illum@f1stnpm3/assumenda-totam-recusandae@f1stnpm3/atque-ex-nulla@f1stnpm3/a-voluptatem-et@f1stnpm3/ab-est-praesentium@f1stnpm3/accusamus-laboriosam-atque@f1stnpm3/accusantium-dicta-asperiores@f1stnpm3/accusantium-harum-ratione@f1stnpm3/ad-corporis-labore@f1stnpm3/adipisci-odit-similique@f1stnpm3/aliquid-reprehenderit-dolor@f1stnpm3/amet-fugit-fugit@f1stnpm3/consequuntur-distinctio-provident@f1stnpm3/corporis-maiores-dignissimos@f1stnpm3/corrupti-explicabo-optio@f1stnpm3/cum-assumenda-placeat@f1stnpm3/cumque-beatae-quod@f1stnpm3/cumque-labore-ullam@f1stnpm3/cumque-non-ex@f1stnpm3/cupiditate-dicta-ab@f1stnpm3/debitis-corrupti-quasi@f1stnpm3/debitis-distinctio-libero@f1stnpm3/deserunt-recusandae-voluptatum@f1stnpm3/dicta-recusandae-vel@f1stnpm3/dignissimos-aliquid-saepe@f1stnpm3/dignissimos-similique-quasi@f1stnpm3/distinctio-blanditiis-doloribus@f1stnpm3/dolore-mollitia-repellendus@f1stnpm3/dolorem-ipsam-pariatur@f1stnpm3/doloremque-voluptatem-explicabo@f1stnpm3/aut-laborum-illo@f1stnpm3/autem-expedita-fugiat@f1stnpm3/autem-occaecati-perferendis@f1stnpm3/beatae-commodi-autem@f1stnpm3/consectetur-iste-ipsa@f1stnpm3/consectetur-nemo-pariatur@f1stnpm3/consectetur-sunt-labore@f1stnpm3/consequatur-tempore-nemo@f1stnpm3/dolores-distinctio-enim@f1stnpm3/doloribus-architecto-architecto@f1stnpm3/doloribus-eius-laborum@f1stnpm3/dolorum-dolore-sed@f1stnpm3/ea-odit-est@f1stnpm3/eaque-accusantium-quis@f1stnpm3/eaque-vitae-dolorum@f1stnpm3/a-asperiores-dignissimos@f1stnpm3/sed-beatae-enim@f1stnpm3/sed-veritatis-culpa@f1stnpm3/sequi-corporis-libero@f1stnpm3/sequi-quaerat-necessitatibus@f1stnpm3/sunt-ullam-minus@f1stnpm3/suscipit-natus-veritatis@f1stnpm3/tempora-cum-provident@f1stnpm3/tempora-vero-alias@f1stnpm3/totam-cupiditate-at@f1stnpm3/totam-temporibus-eaque@f1stnpm3/ullam-ut-dolor@f1stnpm3/unde-cupiditate-molestias@f1stnpm3/veritatis-consectetur-error@f1stnpm3/vitae-minus-at@f1stnpm3/vitae-quos-ut@f1stnpm3/voluptate-ipsum-accusamus@f1stnpm3/voluptatem-fuga-numquam@f1stnpm3/voluptatem-tempore-consequuntur@f1stnpm3/voluptates-minus-fugiat@f1stnpm3/voluptates-minus-laboriosam@f1stnpm3/voluptates-quibusdam-provident@f1stnpm3/voluptates-quis-doloremque@f1stnpm3/voluptatum-corporis-similique@f1stnpm3/nulla-esse-laudantium@f1stnpm3/officia-magnam-accusantium@f1stnpm3/officiis-illo-eum@f1stnpm3/omnis-voluptatem-molestiae@f1stnpm3/optio-error-asperiores@f1stnpm3/pariatur-alias-vel@f1stnpm3/facilis-suscipit-rem@f1stnpm3/id-distinctio-minus@f1stnpm3/illo-reiciendis-voluptatibus@f1stnpm3/illum-earum-at@f1stnpm3/impedit-consequuntur-aliquam@f1stnpm3/in-rem-accusantium@f1stnpm3/inventore-vel-repellendus@f1stnpm3/ipsa-corrupti-reiciendis@f1stnpm3/eveniet-sunt-sed@f1stnpm3/excepturi-animi-ullam@f1stnpm3/exercitationem-asperiores-inventore@f1stnpm3/exercitationem-voluptate-esse@f1stnpm3/expedita-consequuntur-repellendus@f1stnpm3/explicabo-quidem-sunt@f1stnpm3/facilis-possimus-possimus@f1stnpm3/perferendis-itaque-animi@f1stnpm3/perspiciatis-voluptatem-quis@f1stnpm3/porro-optio-cumque@f1stnpm3/quas-est-odio
1.0.0

16 days ago