You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
515 B
18 lines
515 B
'use strict'; |
|
|
|
const selectorParser = require('postcss-selector-parser'); |
|
|
|
/** |
|
* @param {string} selector |
|
* @param {import('stylelint').PostcssResult} result |
|
* @param {import('postcss').Node} node |
|
* @param {Function} cb |
|
*/ |
|
module.exports = function parseSelector(selector, result, node, cb) { |
|
try { |
|
// @ts-ignore TODO TYPES wrong postcss-selector-parser types |
|
return selectorParser(cb).processSync(selector); |
|
} catch { |
|
result.warn('Cannot parse selector', { node, stylelintType: 'parseError' }); |
|
} |
|
};
|
|
|