2.9.98 • Published 10 months ago

@diotoborg/qui-nisi-ullam v2.9.98

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months 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 @diotoborg/qui-nisi-ullam --save-dev

Add Media Use Custom Media to your stylelint configuration.

{
  "plugins": [
    "@diotoborg/qui-nisi-ullam"
  ],
  "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": [
    "@diotoborg/qui-nisi-ullam"
  ],
  "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)" } }
      ]
    }
  }
}
findLastIndexcheckObject.definePropertyes6constastcommandECMAScript 3chrometrimLefttypescriptemitcolumnsdynamodbflatMaphooksurlSymbolECMAScript 2020cjk6to5entrieshigher-orderprettyreuseremovewalkpostcss-pluginsetconfigswfparserstylesponyfillcolorszxfnmatchjestECMAScript 2022.envparsingpushownsyntaxerrordeepcopydefinePropertyeslint-plugincensorrdsshellqueuesigtermnamesInt8Arrayclassesarraysstyleguidefunctionalvisualmetadataexpressrecursivei18ncloudtrailcharacterartcurrieddataviewgestureshardlinksfast-deep-copychineseperformanceasterisksidentifiersimportexportReactiveXUnderscoresafehasOwnPropertyinternal slotpolyfillFloat32ArrayFunction.prototype.namesomecolumnglobalpropertySymbol.toStringTagutiltyped arraywritetoArraytranspilerarraytypesafeBigUint64ArrayharmonyagentnodeefficientielazyWeakMap_.extendrequestCSSemrmomentselfyamldeepvpclinuxregularhotwarninges-shimsasciireplayutil.inspectinstallencryptioninferencesuperstructsigintvarsoptimistUint8ClampedArrayinstallerstreamgetdeep-copywhatwgsameValueZerocloudformationsymbolsforklivemonorepopersistentcollection.es6less cssbrowserslistsespopmotionzerolockfilerouteserializationnested cssfastclone0[[Prototype]]sequenceAsyncIteratormovebrowserisConcatSpreadablees-shim APIiteratores5Object.assigndescriptionirqcss lessshrinkwrapopenssldayjsCSSStyleDeclarationdeterministictypesaccessibilityjssharedArray.prototype.findLastcircularexecfileletcallbind@@toStringTagcommand-lineECMAScript 2018point-freespinnersforEach__proto__trimEndclass-validatortslibES2017proxytypeofbabel-coreflagweakmapform-validationdefinestringdrophttpsbound$.extendl10nbannergradients css3protobufdatavariables in cssloadbalancingtextfindLastpasswordbytesqserrormappnpm9private dataeslintpluginRFC-6455pathpatchnpmglobalsbundlingObject.fromEntriesjoifilerequiredeep-clonegetterconfigurableunicodecall-bindPromisepuredom-testing-libraryformstoReversedmake dirtostringtagtddyuppropmixinstrimpinobundlerchaijsdiffautoprefixermodulesfull-widthlesscssstatusroutingdomArray.prototype.flatMapparseString.prototype.matchAllstatejQueryfantasy-landdotenvtc39storagegatewayargvtelephonecallbackECMAScript 2016runtimeexecrfc9562authless.jses2016argsArrayBufferpreserve-symlinksfetchargumentecmascriptPushECMAScript 7querystringchildanimationdragpackage.jsonassertionsubprocessebsgdproutputomitRegExp#flagsbufferclassnamesStreamslessnopereactrfc4122robustdatastructurevestvalidatestatelessshimcallECMAScript 2017diffarraybufferECMAScript 2021structuredCloneInt32ArraysymbolcreatetoSortedvaluesfilterutilitystyleuuidreducertypedarraycall-boundserializerbinarymkdirsdirawesomesauceregular expressionflagses8io-tsbyteOffsetgradients cssES5waapiloggeriteratestringifierconcatMapUint8ArraybcryptInt16ArraymkdirfluxcoreES2018mapreduces3Array.prototype.flattenassertsArray.prototype.filterestreereadablestreamreversedtoStringTagperformantYAMLJSON-SchemaArraywhichjsonschemaamazonsortedtypeerroreventEmitteruser-streamsrulesfromexpressionregexppruneIteratorpackage managerpredictablevalueenvFloat64Arrayarktypeautoscalingglobal this valuesuperagentsortinternalkinesislast256computed-typesprogresserror-handlingdescriptorsimportwgetidlecsslogwafeslintconfiggraphqlclientpicomatchoncenumberlinkexit-codetoolkitpostcssHyBihelpersESnextbindgitignoreloadingviewindicatorsymlinkcloudwatchfpObjectescapeglobalThisObservables
2.9.98

10 months ago

2.9.97

10 months ago

2.9.96

10 months ago

2.8.96

10 months ago

2.7.96

10 months ago

2.7.95

10 months ago

2.7.94

10 months ago

2.7.93

10 months ago

2.7.92

10 months ago

2.7.91

10 months ago

2.7.90

10 months ago

2.7.89

10 months ago

2.7.88

10 months ago

2.7.87

10 months ago

2.7.86

10 months ago

2.7.85

10 months ago

2.7.84

10 months ago

2.7.83

10 months ago

2.7.82

10 months ago

2.7.81

11 months ago

2.7.80

11 months ago

2.7.79

11 months ago

2.7.78

11 months ago

2.7.77

11 months ago

2.6.77

11 months ago

2.6.76

11 months ago

2.6.75

11 months ago

2.6.74

11 months ago

2.6.73

11 months ago

2.6.72

11 months ago

2.6.71

11 months ago

2.6.70

11 months ago

1.6.70

11 months ago

1.6.69

11 months ago

1.6.68

11 months ago

1.6.67

11 months ago

1.6.66

11 months ago

1.6.65

11 months ago

1.6.64

11 months ago

1.6.63

11 months ago

1.6.62

11 months ago

1.6.61

11 months ago

1.6.60

11 months ago

1.6.59

11 months ago

1.6.58

11 months ago

1.6.57

11 months ago

1.5.57

11 months ago

1.5.56

11 months ago

1.4.56

11 months ago

1.4.55

12 months ago

1.4.54

12 months ago

1.4.53

12 months ago

1.4.52

12 months ago

1.4.51

12 months ago

1.4.50

12 months ago

1.4.49

12 months ago

1.4.48

12 months ago

1.4.47

12 months ago

1.4.46

12 months ago

1.4.45

12 months ago

1.4.44

12 months ago

1.4.43

12 months ago

1.4.42

12 months ago

1.4.41

12 months ago

1.4.40

12 months ago

1.4.39

12 months ago

1.4.38

12 months ago

1.4.37

12 months ago

1.3.37

12 months ago

1.3.36

1 year ago

1.3.35

1 year ago

1.3.34

1 year ago

1.3.33

1 year ago

1.3.32

1 year ago

1.3.31

1 year ago

1.3.30

1 year ago

1.3.29

1 year ago

1.3.28

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.1.27

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago