Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rules/content-property-no-static-value/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';

export const ruleName = 'a11y/content-property-no-static-value';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/font-size-is-readable/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';

export const ruleName = 'a11y/font-size-is-readable';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/line-height-is-vertical-rhythmed/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';

export const ruleName = 'a11y/line-height-is-vertical-rhythmed';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/media-prefers-color-scheme/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';
import isStandardSyntaxSelector from 'stylelint/lib/utils/isStandardSyntaxSelector';
import isStandardSyntaxAtRule from 'stylelint/lib/utils/isStandardSyntaxAtRule';
import isCustomSelector from 'stylelint/lib/utils/isCustomSelector';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/media-prefers-reduced-motion/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { utils } from 'stylelint';
import { parse } from 'postcss';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';
import isStandardSyntaxSelector from 'stylelint/lib/utils/isStandardSyntaxSelector';
import isStandardSyntaxAtRule from 'stylelint/lib/utils/isStandardSyntaxAtRule';
import isCustomSelector from 'stylelint/lib/utils/isCustomSelector';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-display-none/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';

export const ruleName = 'a11y/no-display-none';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-obsolete-attribute/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';
import { obsoleteAttributes } from './obsoleteAttributes';

export const ruleName = 'a11y/no-obsolete-attribute';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-obsolete-element/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';
import { obsoleteElements } from './obsoleteElements';

export const ruleName = 'a11y/no-obsolete-element';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-outline-none/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';

export const ruleName = 'a11y/no-outline-none';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-spread-text/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';

export const ruleName = 'a11y/no-spread-text';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-text-align-justify/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';

export const ruleName = 'a11y/no-text-align-justify';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/selector-pseudo-class-focus/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils } from 'stylelint';
import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.cjs';

const deepFlatten = (arr) => [].concat(...arr.map((v) => (Array.isArray(v) ? deepFlatten(v) : v)));

Expand Down
26 changes: 26 additions & 0 deletions src/utils/isStandardSyntaxRule.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

const isStandardSyntaxSelector = require('stylelint/lib/utils/isStandardSyntaxSelector');

/**
* Check whether a Node is a standard rule
*
* @param {import('postcss').Rule | import('postcss-less').Rule} rule
* @returns {boolean}
*/
module.exports = function isStandardSyntaxRule(rule) {
if (rule.type !== 'rule') {
return false;
}

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

if (!isStandardSyntaxSelector(rule.selector)) {
return false;
}

return true;
};