UNPKG

stylelint

Version:

A mighty CSS linter that helps you avoid errors and enforce conventions.

26 lines (20 loc) 718 B
// 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 selectorParser = require('postcss-selector-parser'); /** * @param {string} selector * @param {import('stylelint').PostcssResult} result * @param {import('postcss').Node} node * @returns {import('postcss-selector-parser').Root | undefined} */ function parseSelectorAST(selector, result, node) { if (!selector) return undefined; try { return selectorParser().astSync(selector); } catch (err) { result.warn(`Cannot parse selector (${err})`, { node, stylelintType: 'parseError' }); return undefined; } } module.exports = parseSelectorAST;