Skip to content

Commit

Permalink
Added support for postcss-styled-syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
hudochenkov committed Jan 5, 2023
1 parent 508bdb2 commit 51e1b46
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 56 deletions.
187 changes: 146 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"stylelint": "^14.0.0"
},
"devDependencies": {
"@stylelint/postcss-css-in-js": "^0.38.0",
"eslint": "^8.31.0",
"eslint-config-hudochenkov": "^9.0.0",
"eslint-config-prettier": "^8.6.0",
Expand All @@ -39,6 +38,7 @@
"lint-staged": "^13.1.0",
"postcss-html": "^1.5.0",
"postcss-less": "^6.0.0",
"postcss-styled-syntax": "^0.1.0",
"prettier": "~2.8.1",
"prettier-config-hudochenkov": "^0.3.0",
"stylelint": "^14.16.1"
Expand Down
2 changes: 1 addition & 1 deletion rules/order/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ testRule({
testRule({
ruleName,
config: [['declarations', 'rules', 'at-rules']],
customSyntax: '@stylelint/postcss-css-in-js',
customSyntax: 'postcss-styled-syntax',
fix: true,

accept: [
Expand Down
2 changes: 1 addition & 1 deletion rules/properties-alphabetical-order/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ testRule({
testRule({
ruleName,
config: [true],
customSyntax: '@stylelint/postcss-css-in-js',
customSyntax: 'postcss-styled-syntax',
fix: true,

accept: [
Expand Down
2 changes: 1 addition & 1 deletion rules/properties-order/tests/flat.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ testRule({
testRule({
ruleName,
config: [['top', 'color']],
customSyntax: '@stylelint/postcss-css-in-js',
customSyntax: 'postcss-styled-syntax',
fix: true,

accept: [
Expand Down
2 changes: 1 addition & 1 deletion rules/properties-order/tests/no-empty-line-between.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ testRule({
},
],
],
customSyntax: '@stylelint/postcss-css-in-js',
customSyntax: 'postcss-styled-syntax',
fix: true,

accept: [
Expand Down
4 changes: 2 additions & 2 deletions rules/properties-order/tests/report-when-not-fixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test(`show warning if --fix enabled, but it didn't fix`, () => {
const options = {
code,
config: stylelintConfig,
customSyntax: '@stylelint/postcss-css-in-js',
customSyntax: 'postcss-styled-syntax',
fix: true,
};

Expand Down Expand Up @@ -58,7 +58,7 @@ test(`show warning if --fix enabled, and it fixed`, () => {
const options = {
code,
config: stylelintConfig,
customSyntax: '@stylelint/postcss-css-in-js',
customSyntax: 'postcss-styled-syntax',
fix: true,
};

Expand Down
10 changes: 2 additions & 8 deletions utils/getContainingNode.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
module.exports = function getContainingNode(node) {
// For styled-components declarations are children of Root node
if (
node.type !== 'rule' &&
node.type !== 'atrule' &&
node.parent.document &&
node.parent.document.nodes &&
node.parent.document.nodes.some((item) => item.type === 'root')
) {
// For styled-components: declarations are children of Root node
if (node.type !== 'rule' && node.type !== 'atrule' && node.parent.type === 'root') {
return node.parent;
}

Expand Down

0 comments on commit 51e1b46

Please sign in to comment.