Skip to content

Commit

Permalink
Remove redundant conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
immitsu committed Jul 18, 2021
1 parent a9bbbdb commit 15cca41
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions lib/utils/isStandardSyntaxRule.js
Expand Up @@ -13,8 +13,6 @@ module.exports = function (rule) {
return false;
}

// Casting this to any because 'selector' does not exist on type 'NodeRaws'
/** @type {any} */
const raws = rule.raws;

// Get full selector
Expand All @@ -24,39 +22,11 @@ module.exports = function (rule) {
return false;
}

// Called Less mixin (e.g. a { .mixin() })
// @ts-ignore TODO TYPES support LESS and SASS types somehow
if (rule.mixin) {
return false;
}

// Less detached rulesets
if (selector.startsWith('@') && selector.endsWith(':')) {
return false;
}

// Ignore Less &:extend rule
if ('extend' in rule && rule.extend) {
return false;
}

// Ignore mixin or &:extend rule
// https://github.com/shellscape/postcss-less/blob/master/lib/less-parser.js#L52
// @ts-ignore TODO TYPES support LESS and SASS types somehow
if (rule.params && rule.params[0]) {
return false;
}

// Non-outputting Less mixin definition (e.g. .mixin() {})
if (selector.endsWith(')') && !selector.includes(':')) {
return false;
}

// Less guards
if (/when\s+(not\s+)*\(/.test(selector)) {
return false;
}

// Less Parametric mixins (e.g. .mixin(@variable: x) {})
if (/\(@.*\)$/.test(selector)) {
return false;
Expand Down

0 comments on commit 15cca41

Please sign in to comment.