From 1c47ae4b235365dd653f37640730b613e877108e Mon Sep 17 00:00:00 2001 From: Jordan Hall Date: Fri, 15 Dec 2023 22:54:17 +0000 Subject: [PATCH] fix: add support for stylelint 16 --- CHANGELOG.md | 4 ++++ index.js | 11 ++++------- package.json | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8431eb..a31cc3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/index.js b/index.js index b4973fd..1483b19 100644 --- a/index.js +++ b/index.js @@ -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'; @@ -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.`); @@ -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; diff --git a/package.json b/package.json index 1a012f0..4428b2c 100644 --- a/package.json +++ b/package.json @@ -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": { @@ -40,7 +40,7 @@ "stylelint-tape": "^2.0.0" }, "peerDependencies": { - "stylelint": ">=13" + "stylelint": ">=11 < 17" }, "eslintConfig": { "extends": "dev",