Skip to content

Commit

Permalink
fix: add support for stylelint 16
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Hall committed Dec 15, 2023
1 parent bb0392e commit 1c47ae4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes to Property Use Logical

## 5.0.1
### fixes
- add support for stylelint 16

## 5.0.0 (February 3rd, 2023)
### New feature
- Add support for CSS in JS #35
Expand Down
11 changes: 4 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const reportedDecls = new WeakMap();
// Ignore autofix on those expression value
const expressionRegex = /^\$\{.*\}$/g;

export default stylelint.createPlugin(ruleName, (method, opts, context) => {
function ruleFunc(method, opts, context) {
const propExceptions = [].concat(Object(opts).except || []);
const isAutofixable = (node) => isContextAutofixing(context) && !expressionRegex.test(node.value);
const dir = /^rtl$/i.test(Object(opts).direction) ? 'rtl' : 'ltr';
Expand Down Expand Up @@ -49,9 +49,6 @@ export default stylelint.createPlugin(ruleName, (method, opts, context) => {

if (isMethodValid && isMethodAlways(method)) {
walk(root, node => {

// MIGRATION from out of date props https://github.com/csstools/stylelint-use-logical/issues/1

migrationNoneSpec.forEach(([prop, props]) => {
validateRuleWithProps(node, prop, (outDateDecl) => {
console.warn(`Property ${prop[0]} is not part of Logical standards.`);
Expand Down Expand Up @@ -236,9 +233,9 @@ export default stylelint.createPlugin(ruleName, (method, opts, context) => {
});
}
};
});

export { ruleName }
}
ruleFunc.ruleName = ruleName;
export default stylelint.createPlugin(ruleName, ruleFunc);

const isMethodIndifferent = method => method === 'ignore' || method === false || method === null;
const isMethodAlways = method => method === 'always' || method === true;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stylelint-use-logical-spec",
"version": "5.0.0",
"version": "5.0.1",
"description": "Enforce usage of logical properties and values in CSS",
"license": "CC0-1.0",
"repository": {
Expand Down Expand Up @@ -40,7 +40,7 @@
"stylelint-tape": "^2.0.0"
},
"peerDependencies": {
"stylelint": ">=13"
"stylelint": ">=11 < 17"
},
"eslintConfig": {
"extends": "dev",
Expand Down

0 comments on commit 1c47ae4

Please sign in to comment.