added all files to project

This commit is contained in:
2022-03-10 10:36:59 +01:00
parent 09dd957b33
commit 46a936d7de
25351 changed files with 3883356 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
# custom-media-pattern
Specify a pattern for custom media query names.
<!-- prettier-ignore -->
```css
@custom-media --foo (max-width: 30em);
/** ↑
* The pattern of this */
```
## Options
`regex|string`
A string will be translated into a RegExp like so `new RegExp(yourString)` — so be sure to escape properly.
Given the string:
```
"foo-.+"
```
The following patterns are considered violations:
<!-- prettier-ignore -->
```css
@custom-media --bar (min-width: 30em);
```
The following patterns are _not_ considered violations:
<!-- prettier-ignore -->
```css
@custom-media --foo-bar (min-width: 30em);
```
+54
View File
@@ -0,0 +1,54 @@
// @ts-nocheck
'use strict';
const _ = require('lodash');
const atRuleParamIndex = require('../../utils/atRuleParamIndex');
const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');
const ruleName = 'custom-media-pattern';
const messages = ruleMessages(ruleName, {
expected: (pattern) => `Expected custom media query name to match pattern "${pattern}"`,
});
function rule(pattern) {
return (root, result) => {
const validOptions = validateOptions(result, ruleName, {
actual: pattern,
possible: [_.isRegExp, _.isString],
});
if (!validOptions) {
return;
}
const regexpPattern = _.isString(pattern) ? new RegExp(pattern) : pattern;
root.walkAtRules((atRule) => {
if (atRule.name.toLowerCase() !== 'custom-media') {
return;
}
const customMediaName = atRule.params.match(/^--(\S+)\b/)[1];
if (regexpPattern.test(customMediaName)) {
return;
}
report({
message: messages.expected(pattern),
node: atRule,
index: atRuleParamIndex(atRule),
result,
ruleName,
});
});
};
}
rule.ruleName = ruleName;
rule.messages = messages;
module.exports = rule;