first commit
This commit is contained in:
56
node_modules/stylelint/lib/rules/comment-pattern/index.cjs
generated
vendored
Normal file
56
node_modules/stylelint/lib/rules/comment-pattern/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
// NOTICE: This file is generated by Rollup. To modify it,
|
||||
// please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
|
||||
'use strict';
|
||||
|
||||
const validateTypes = require('../../utils/validateTypes.cjs');
|
||||
const report = require('../../utils/report.cjs');
|
||||
const ruleMessages = require('../../utils/ruleMessages.cjs');
|
||||
const validateOptions = require('../../utils/validateOptions.cjs');
|
||||
|
||||
const ruleName = 'comment-pattern';
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
expected: (pattern) => `Expected comment to match pattern "${pattern}"`,
|
||||
});
|
||||
|
||||
const meta = {
|
||||
url: 'https://stylelint.io/user-guide/rules/comment-pattern',
|
||||
};
|
||||
|
||||
/** @type {import('stylelint').CoreRules[ruleName]} */
|
||||
const rule = (primary) => {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual: primary,
|
||||
possible: [validateTypes.isRegExp, validateTypes.isString],
|
||||
});
|
||||
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizedPattern = validateTypes.isString(primary) ? new RegExp(primary) : primary;
|
||||
|
||||
root.walkComments((comment) => {
|
||||
const text = comment.text;
|
||||
|
||||
if (normalizedPattern.test(text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.expected,
|
||||
messageArgs: [primary],
|
||||
node: comment,
|
||||
result,
|
||||
ruleName,
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
rule.ruleName = ruleName;
|
||||
rule.messages = messages;
|
||||
rule.meta = meta;
|
||||
|
||||
module.exports = rule;
|
||||
51
node_modules/stylelint/lib/rules/comment-pattern/index.mjs
generated
vendored
Normal file
51
node_modules/stylelint/lib/rules/comment-pattern/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { isRegExp, isString } from '../../utils/validateTypes.mjs';
|
||||
import report from '../../utils/report.mjs';
|
||||
import ruleMessages from '../../utils/ruleMessages.mjs';
|
||||
import validateOptions from '../../utils/validateOptions.mjs';
|
||||
|
||||
const ruleName = 'comment-pattern';
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
expected: (pattern) => `Expected comment to match pattern "${pattern}"`,
|
||||
});
|
||||
|
||||
const meta = {
|
||||
url: 'https://stylelint.io/user-guide/rules/comment-pattern',
|
||||
};
|
||||
|
||||
/** @type {import('stylelint').CoreRules[ruleName]} */
|
||||
const rule = (primary) => {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, {
|
||||
actual: primary,
|
||||
possible: [isRegExp, isString],
|
||||
});
|
||||
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizedPattern = isString(primary) ? new RegExp(primary) : primary;
|
||||
|
||||
root.walkComments((comment) => {
|
||||
const text = comment.text;
|
||||
|
||||
if (normalizedPattern.test(text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.expected,
|
||||
messageArgs: [primary],
|
||||
node: comment,
|
||||
result,
|
||||
ruleName,
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
rule.ruleName = ruleName;
|
||||
rule.messages = messages;
|
||||
rule.meta = meta;
|
||||
export default rule;
|
||||
Reference in New Issue
Block a user