Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var runLinter = (contents, file, context) => {
var customRules = context.customRules || {};
_.merge(stylelint.rules, customRules);
// console.log(stylelint.rules);
var config = context.lintConfig;
var configs = [{}, STYLELINT_CONFIG];
if (_.isObject(config)) {
configs.push(config);
}
config = _.merge(...configs);
return stylelint.lint(
{
code: contents,
function getStylelintRules() {
loadScript('/vendor/stylelint-bundle/stylelint-bundle.min.js');
const stylelint = require('stylelint');
const options = {};
const rxPossible = /\bpossible:("(?:[^"]*?)"|\[(?:[^\]]*?)\]|\{(?:[^}]*?)\})/g;
const rxString = /"([-\w\s]{3,}?)"/g;
for (const id of Object.keys(stylelint.rules)) {
const ruleCode = String(stylelint.rules[id]);
const sets = [];
let m, mStr;
while ((m = rxPossible.exec(ruleCode))) {
const possible = m[1];
const set = [];
while ((mStr = rxString.exec(possible))) {
const s = mStr[1];
if (s.includes(' ')) {
set.push(...s.split(/\s+/));
} else {
set.push(s);
}
}
if (possible.includes('ignoreAtRules')) {
set.push('ignoreAtRules');
}
function getStylelintRules() {
loadScript('/vendor/stylelint-bundle/stylelint-bundle.min.js');
const stylelint = require('stylelint');
const options = {};
const rxPossible = /\bpossible:("(?:[^"]*?)"|\[(?:[^\]]*?)\]|\{(?:[^}]*?)\})/g;
const rxString = /"([-\w\s]{3,}?)"/g;
for (const id of Object.keys(stylelint.rules)) {
const ruleCode = String(stylelint.rules[id]);
const sets = [];
let m, mStr;
while ((m = rxPossible.exec(ruleCode))) {
const possible = m[1];
const set = [];
while ((mStr = rxString.exec(possible))) {
const s = mStr[1];
if (s.includes(' ')) {
set.push(...s.split(/\s+/));
} else {
set.push(s);
}
}
if (possible.includes('ignoreAtRules')) {
set.push('ignoreAtRules');
'use strict';
const _ = require('lodash');
const cosmiconfig = require('cosmiconfig');
const columnify = require('columnify');
const stylelint = require('stylelint');
const chalk = require('chalk');
const yargs = require('yargs');
const Promise = require('bluebird');
const EOL = require('os').EOL;
const pkg = require('../../package.json');
const isDDeprecated = require('./is-deprecated');
const rules = {
stylelintAll: _.keys(stylelint.rules),
stylelintDeprecated: [],
stylelintNoDeprecated: [],
userRulesNames: []
};
/**
* Define command line arguments
*/
const argv = yargs
.usage('stylelint-find-rules [options]')
.example('stylelint-find-rules', '')
.example('stylelint-find-rules --no-d --no-i', '')
.example('stylelint-find-rules --config path/to/custom.config.js', '')
.option('u', {
type: 'boolean',
alias: 'unused',