Socket
Socket
Sign inDemoInstall

stylelint

Package Overview
Dependencies
Maintainers
7
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylelint - npm Package Compare versions

Comparing version 14.15.0 to 14.16.0

lib/formatters/calcSeverityCounts.js

16

lib/augmentConfig.js

@@ -153,3 +153,9 @@ 'use strict';

if (config.plugins) {
config.plugins = [config.plugins].flat().map((lookup) => getModulePath(configDir, lookup, cwd));
config.plugins = [config.plugins].flat().map((lookup) => {
if (typeof lookup === 'string') {
return getModulePath(configDir, lookup, cwd);
}
return lookup;
});
}

@@ -326,4 +332,10 @@

for (const pluginLookup of normalizedPlugins) {
let pluginImport = require(pluginLookup);
let pluginImport;
if (typeof pluginLookup === 'string') {
pluginImport = require(pluginLookup);
} else {
pluginImport = pluginLookup;
}
// Handle either ES6 or CommonJS modules

@@ -330,0 +342,0 @@ pluginImport = pluginImport.default || pluginImport;

12

lib/formatters/compactFormatter.js
'use strict';
const preprocessWarnings = require('./preprocessWarnings');
/**

@@ -8,4 +10,6 @@ * @type {import('stylelint').Formatter}

return results
.flatMap((result) =>
result.warnings.map(
.flatMap((result) => {
const { warnings } = preprocessWarnings(result);
return warnings.map(
(warning) =>

@@ -17,5 +21,5 @@ `${result.source}: ` +

`${warning.text}`,
),
)
);
})
.join('\n');
};
'use strict';
const preprocessWarnings = require('./preprocessWarnings');
/**

@@ -13,4 +15,6 @@ * @see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

return results
.flatMap(({ source, warnings }) =>
warnings.map(({ line, column, endLine, endColumn, text, severity, rule }) => {
.flatMap((result) => {
const { source, warnings } = preprocessWarnings(result);
return warnings.map(({ line, column, endLine, endColumn, text, severity, rule }) => {
const msg = buildMessage(text, metadata[rule]);

@@ -21,4 +25,4 @@

: `::${severity} file=${source},line=${line},col=${column},endLine=${endLine},endColumn=${endColumn},title=${title}::${msg}`;
}),
)
});
})
.join('\n');

@@ -25,0 +29,0 @@ };

@@ -8,4 +8,6 @@ 'use strict';

const calcSeverityCounts = require('./calcSeverityCounts');
const pluralize = require('../utils/pluralize');
const { assertNumber } = require('../utils/validateTypes');
const preprocessWarnings = require('./preprocessWarnings');
const terminalLink = require('./terminalLink');

@@ -42,3 +44,3 @@

function deprecationsFormatter(results) {
const allDeprecationWarnings = results.flatMap((result) => result.deprecations);
const allDeprecationWarnings = results.flatMap((result) => result.deprecations || []);

@@ -74,3 +76,3 @@ if (allDeprecationWarnings.length === 0) {

const allInvalidOptionWarnings = results.flatMap((result) =>
result.invalidOptionWarnings.map((warning) => warning.text),
(result.invalidOptionWarnings || []).map((warning) => warning.text),
);

@@ -133,22 +135,4 @@ const uniqueInvalidOptionWarnings = [...new Set(allInvalidOptionWarnings)];

function formatter(messages, source, cwd) {
if (!messages.length) return '';
if (messages.length === 0) return '';
const orderedMessages = [...messages].sort((a, b) => {
// positionless first
if (!a.line && b.line) return -1;
// positionless first
if (a.line && !b.line) return 1;
if (a.line < b.line) return -1;
if (a.line > b.line) return 1;
if (a.column < b.column) return -1;
if (a.column > b.column) return 1;
return 0;
});
/**

@@ -204,3 +188,3 @@ * Create a list of column widths, needed to calculate

const cleanedMessages = orderedMessages.map((message) => {
const cleanedMessages = messages.map((message) => {
const { line, column, severity } = message;

@@ -240,9 +224,3 @@ /**

.split('\n')
.map(
/**
* @param {string} el
* @returns {string}
*/
(el) => el.replace(/(\d+)\s+(\d+)/, (_m, p1, p2) => dim(`${p1}:${p2}`)),
)
.map((el) => el.replace(/(\d+)\s+(\d+)/, (_m, p1, p2) => dim(`${p1}:${p2}`)).trimEnd())
.join('\n');

@@ -261,19 +239,6 @@

let errorCount = 0;
let warningCount = 0;
const counts = { error: 0, warning: 0 };
output = results.reduce((accum, result) => {
// Treat parseErrors as warnings
if (result.parseErrors) {
for (const error of result.parseErrors) {
result.warnings.push({
line: error.line,
column: error.column,
rule: error.stylelintType,
severity: 'error',
text: `${error.text} (${error.stylelintType})`,
});
errorCount += 1;
}
}
preprocessWarnings(result);

@@ -287,12 +252,3 @@ accum += formatter(

for (const warning of result.warnings) {
switch (warning.severity) {
case 'error':
errorCount += 1;
break;
case 'warning':
warningCount += 1;
break;
default:
throw new Error(`Unknown severity: "${warning.severity}"`);
}
calcSeverityCounts(warning.severity, counts);
}

@@ -309,2 +265,4 @@

const errorCount = counts.error;
const warningCount = counts.warning;
const total = errorCount + warningCount;

@@ -311,0 +269,0 @@

'use strict';
const preprocessWarnings = require('./preprocessWarnings');
/**

@@ -10,2 +12,4 @@ * @type {import('stylelint').Formatter}

for (const [index, result] of results.entries()) {
preprocessWarnings(result);
lines.push(

@@ -27,6 +31,15 @@ `${result.errored ? 'not ok' : 'ok'} ${index + 1} - ${result.ignored ? 'ignored ' : ''}${

` column: ${warning.column}`,
` endLine: ${warning.endLine}`,
` endColumn: ${warning.endColumn}`,
` ruleId: ${warning.rule}`,
);
if (typeof warning.endLine === 'number') {
lines.push(` endLine: ${warning.endLine}`);
}
if (typeof warning.endColumn === 'number') {
lines.push(` endColumn: ${warning.endColumn}`);
}
if (typeof warning.rule === 'string') {
lines.push(` ruleId: ${warning.rule}`);
}
}

@@ -33,0 +46,0 @@

@@ -0,1 +1,3 @@

'use strict';
const supportsHyperlinks = require('supports-hyperlinks');

@@ -2,0 +4,0 @@

'use strict';
const calcSeverityCounts = require('./calcSeverityCounts');
const pluralize = require('../utils/pluralize');
const preprocessWarnings = require('./preprocessWarnings');
/**

@@ -7,14 +11,22 @@ * @type {import('stylelint').Formatter}

module.exports = function unixFormatter(results) {
const lines = results.flatMap((result) =>
result.warnings.map(
(warning) =>
const counts = { error: 0, warning: 0 };
const lines = results.flatMap((result) => {
preprocessWarnings(result);
return result.warnings.map((warning) => {
calcSeverityCounts(warning.severity, counts);
return (
`${result.source}:${warning.line}:${warning.column}: ` +
`${warning.text} [${warning.severity}]\n`,
),
);
`${warning.text} [${warning.severity}]`
);
});
});
const total = lines.length;
let output = lines.join('');
let output = lines.join('\n');
if (total > 0) {
output += `\n${total} problem${total !== 1 ? 's' : ''}\n`;
output += `\n\n${total} ${pluralize('problem', total)}`;
output += ` (${counts.error} ${pluralize('error', counts.error)}`;
output += `, ${counts.warning} ${pluralize('warning', counts.warning)})\n`;
}

@@ -21,0 +33,0 @@

@@ -17,9 +17,16 @@ 'use strict';

const mediaFeatureNames = uniteSets(deprecatedMediaFeatureNames, [
const rangeTypeMediaFeatureNames = new Set([
'aspect-ratio',
'color-index',
'color',
'height',
'monochrome',
'resolution',
'width',
]);
const mediaFeatureNames = uniteSets(deprecatedMediaFeatureNames, rangeTypeMediaFeatureNames, [
'any-hover',
'any-pointer',
'aspect-ratio',
'color',
'color-gamut',
'color-index',
'display-mode',

@@ -29,3 +36,2 @@ 'dynamic-range',

'grid',
'height',
'hover',

@@ -48,3 +54,2 @@ 'inverted-colors',

'min-width',
'monochrome',
'orientation',

@@ -58,3 +63,2 @@ 'overflow-block',

'prefers-reduced-transparency',
'resolution',
'scan',

@@ -64,7 +68,7 @@ 'scripting',

'video-dynamic-range',
'width',
]);
module.exports = {
rangeTypeMediaFeatureNames,
mediaFeatureNames,
};

@@ -200,2 +200,3 @@ 'use strict';

)(),
'media-feature-range-notation': importLazy(() => require('./media-feature-range-notation'))(),
'media-feature-range-operator-space-after': importLazy(() =>

@@ -202,0 +203,0 @@ require('./media-feature-range-operator-space-after'),

{
"name": "stylelint",
"version": "14.15.0",
"version": "14.16.0",
"description": "A mighty, modern CSS linter.",

@@ -127,3 +127,3 @@ "keywords": [

"html-tags": "^3.2.0",
"ignore": "^5.2.0",
"ignore": "^5.2.1",
"import-lazy": "^4.0.0",

@@ -142,3 +142,3 @@ "imurmurhash": "^0.1.4",

"postcss-safe-parser": "^6.0.0",
"postcss-selector-parser": "^6.0.10",
"postcss-selector-parser": "^6.0.11",
"postcss-value-parser": "^4.2.0",

@@ -176,4 +176,4 @@ "resolve-from": "^5.0.0",

"deepmerge": "^4.2.2",
"eslint": "^8.27.0",
"eslint-config-stylelint": "^17.0.0",
"eslint": "^8.28.0",
"eslint-config-stylelint": "^17.1.0",
"husky": "^8.0.2",

@@ -183,3 +183,3 @@ "jest": "^28.1.3",

"jest-watch-typeahead": "^2.2.0",
"lint-staged": "^13.0.3",
"lint-staged": "^13.0.4",
"node-fetch": "^3.3.0",

@@ -193,6 +193,6 @@ "np": "^7.6.2",

"postcss-sass": "^0.5.0",
"postcss-scss": "^4.0.5",
"postcss-scss": "^4.0.6",
"remark-cli": "^11.0.0",
"sugarss": "^4.0.1",
"typescript": "^4.8.4"
"typescript": "^4.9.3"
},

@@ -199,0 +199,0 @@ "engines": {

@@ -10,3 +10,6 @@ declare module 'stylelint' {

export type ConfigExtends = string | string[];
export type ConfigPlugins = string | string[];
export type PluginType =
| { default?: { ruleName: string; rule: Rule } }
| { ruleName: string; rule: Rule };
export type ConfigPlugins = string | PluginType | (string | PluginType)[];
export type ConfigProcessor = string | [string, Object];

@@ -13,0 +16,0 @@ export type ConfigProcessors = string | ConfigProcessor[];

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc