diff options
author | Man <rawww@DESKTOP-N753HBN.localdomain> | 2020-02-05 15:47:09 +0300 |
---|---|---|
committer | Man <rawww@DESKTOP-N753HBN.localdomain> | 2020-02-05 15:47:09 +0300 |
commit | 32abafa21fbd1f94fc34cdff0a292729a33c4b61 (patch) | |
tree | 795f49833677b1bb813c0e24256573a66b1cf313 /assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist | |
parent | 5d526501aba7b338a6ff6ac64c21b3bf1d38db30 (diff) |
Removed node_module folder
Diffstat (limited to 'assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist')
-rw-r--r-- | assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist/README.md | 86 | ||||
-rw-r--r-- | assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist/index.js | 56 |
2 files changed, 0 insertions, 142 deletions
diff --git a/assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist/README.md b/assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist/README.md deleted file mode 100644 index 3bbf99f..0000000 --- a/assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# declaration-property-value-whitelist - -Specify a whitelist of allowed property and value pairs within declarations. - -```css -a { text-transform: uppercase; } -/** ↑ ↑ - * These properties and these values */ -``` - -## Options - -`object`: `{ - "unprefixed-property-name": ["array", "of", "values"], - "unprefixed-property-name": ["/regex/", "non-regex"] -}` - -If a property name is found in the object, only its whitelisted property values are allowed. This rule complains about all non-matching values. (If the property name is not included in the object, anything goes.) - -If a property name is surrounded with `"/"` (e.g. `"/^animation/"`), it is interpreted as a regular expression. This allows, for example, easy targeting of shorthands: `/^animation/` will match `animation`, `animation-duration`, `animation-timing-function`, etc. - -The same goes for values. Keep in mind that a regular expression value is matched against the entire value of the declaration, not specific parts of it. For example, a value like `"10px solid rgba( 255 , 0 , 0 , 0.5 )"` will *not* match `"/^solid/"` (notice beginning of the line boundary) but *will* match `"/\\s+solid\\s+/"` or `"/\\bsolid\\b/"`. - -Be careful with regex matching not to accidentally consider quoted string values and `url()` arguments. For example, `"/red/"` will match value such as `"1px dotted red"` as well as `"\"red\""` and `"white url(/mysite.com/red.png)"`. - -Given: - -```js -{ - "transform": ["/scale/"], - "whitespace": ["nowrap"], - "/color/": ["/^green/"] -} -``` - -The following patterns are considered violations: - -```css -a { whitespace: pre; } -``` - -```css -a { transform: translate(1, 1); } -``` - -```css -a { -webkit-transform: translate(1, 1); } -``` - -```css -a { color: pink; } -``` - -```css -a { background-color: pink; } -``` - -The following patterns are *not* considered violations: - -```css -a { color: pink; } -``` - -```css -a { whitespace: nowrap; } -``` - -```css -a { transform: scale(1, 1); } -``` - -```css -a { -webkit-transform: scale(1, 1); } -``` - -```css -a { color: green; } -``` - -```css -a { background-color: green; } -``` - -```css -a { background: pink; } -``` diff --git a/assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist/index.js b/assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist/index.js deleted file mode 100644 index c780152..0000000 --- a/assets/node_modules/stylelint/lib/rules/declaration-property-value-whitelist/index.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; - -const _ = require('lodash'); -const matchesStringOrRegExp = require('../../utils/matchesStringOrRegExp'); -const postcss = require('postcss'); -const report = require('../../utils/report'); -const ruleMessages = require('../../utils/ruleMessages'); -const validateOptions = require('../../utils/validateOptions'); - -const ruleName = 'declaration-property-value-whitelist'; - -const messages = ruleMessages(ruleName, { - rejected: (property, value) => `Unexpected value "${value}" for property "${property}"`, -}); - -function rule(whitelist) { - return (root, result) => { - const validOptions = validateOptions(result, ruleName, { - actual: whitelist, - possible: [_.isObject], - }); - - if (!validOptions) { - return; - } - - root.walkDecls((decl) => { - const prop = decl.prop; - const value = decl.value; - - const unprefixedProp = postcss.vendor.unprefixed(prop); - const propWhitelist = _.find(whitelist, (list, propIdentifier) => - matchesStringOrRegExp(unprefixedProp, propIdentifier), - ); - - if (_.isEmpty(propWhitelist)) { - return; - } - - if (matchesStringOrRegExp(value, propWhitelist)) { - return; - } - - report({ - message: messages.rejected(prop, value), - node: decl, - result, - ruleName, - }); - }); - }; -} - -rule.ruleName = ruleName; -rule.messages = messages; -module.exports = rule; |