Sha256: 6b41b5a5a84672342ebc441d677f4575b23b8f36e9892f7d557524f55fef66aa

Contents?: true

Size: 1.13 KB

Versions: 23

Compression:

Stored size: 1.13 KB

Contents

'use strict';

const isStandardSyntaxDeclaration = require('../utils/isStandardSyntaxDeclaration');
const isStandardSyntaxProperty = require('../utils/isStandardSyntaxProperty');
const report = require('../utils/report');
const styleSearch = require('style-search');

module.exports = function (opts) {
	opts.root.walkDecls((decl) => {
		if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop)) {
			return;
		}

		const declString = decl.toString();

		styleSearch(
			{
				source: declString,
				target: ',',
				functionArguments: 'skip',
			},
			(match) => {
				const indexToCheckAfter = opts.determineIndex
					? opts.determineIndex(declString, match)
					: match.startIndex;

				if (indexToCheckAfter === false) {
					return;
				}

				checkComma(declString, indexToCheckAfter, decl);
			},
		);
	});

	function checkComma(source, index, node) {
		opts.locationChecker({
			source,
			index,
			err: (m) => {
				if (opts.fix && opts.fix(node, index)) {
					return;
				}

				report({
					message: m,
					node,
					index,
					result: opts.result,
					ruleName: opts.checkedRuleName,
				});
			},
		});
	}
};

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
trusty-cms-5.0.7 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-5.0.6 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-5.0.5 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-5.0.4 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-5.0.3 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-5.0.2 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-5.0.1 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.3.5 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-5.0.0 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.3.4 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.3.3 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.3.2 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.3.1 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.3 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.2.3 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.2.2 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.2.1 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.2 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.1.9 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js
trusty-cms-4.1.8 node_modules/stylelint/lib/rules/valueListCommaWhitespaceChecker.js