Skip to content

Commit

Permalink
apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke committed Oct 29, 2024
1 parent d705b4e commit db4ce62
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 56 deletions.
9 changes: 8 additions & 1 deletion lib/rules/no-irregular-whitespace/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const getRuleSelector = require('../../utils/getRuleSelector.cjs');
const report = require('../../utils/report.cjs');
const ruleMessages = require('../../utils/ruleMessages.cjs');
const ruleRawsAfterIndex = require('../../utils/ruleRawsAfterIndex.cjs');
const ruleRawsBetweenIndex = require('../../utils/ruleRawsBetweenIndex.cjs');
const validateOptions = require('../../utils/validateOptions.cjs');

const ruleName = 'no-irregular-whitespace';
Expand Down Expand Up @@ -138,6 +137,14 @@ function oneIndex() {
return 1;
}

/**
* @param {import('postcss').Rule} node
* @returns {number}
*/
function ruleRawsBetweenIndex(node) {
return node.selector.length;
}

rule.ruleName = ruleName;
rule.messages = messages;
rule.meta = meta;
Expand Down
9 changes: 8 additions & 1 deletion lib/rules/no-irregular-whitespace/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import getRuleSelector from '../../utils/getRuleSelector.mjs';
import report from '../../utils/report.mjs';
import ruleMessages from '../../utils/ruleMessages.mjs';
import ruleRawsAfterIndex from '../../utils/ruleRawsAfterIndex.mjs';
import ruleRawsBetweenIndex from '../../utils/ruleRawsBetweenIndex.mjs';
import validateOptions from '../../utils/validateOptions.mjs';

const ruleName = 'no-irregular-whitespace';
Expand Down Expand Up @@ -134,6 +133,14 @@ function oneIndex() {
return 1;
}

/**
* @param {import('postcss').Rule} node
* @returns {number}
*/
function ruleRawsBetweenIndex(node) {
return node.selector.length;
}

rule.ruleName = ruleName;
rule.messages = messages;
rule.meta = meta;
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/__tests__/atRuleRawsAfterNameIndex.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('atRuleRawsAfterNameIndex', () => {
expect(atRuleRawsAfterNameIndex(atRule(' @media (color) {}'))).toBe(6);
});

it('has a newline before the param', () => {
it('has a newline before the @', () => {
expect(atRuleRawsAfterNameIndex(atRule('\n@media (color) {}'))).toBe(6);
});
});
Expand Down
33 changes: 0 additions & 33 deletions lib/utils/__tests__/ruleRawsBetweenIndex.test.mjs

This file was deleted.

13 changes: 0 additions & 13 deletions lib/utils/ruleRawsBetweenIndex.cjs

This file was deleted.

7 changes: 0 additions & 7 deletions lib/utils/ruleRawsBetweenIndex.mjs

This file was deleted.

0 comments on commit db4ce62

Please sign in to comment.