-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Stylelint in peer dependency #22
Conversation
Hm. Right now we have a warning:
And error:
|
Seems like it happens because this repo is using Rollup to compile ESM to CJS because |
Hi, I'm a maintainer of Stylelint. The stylelint-use-logical/index.js Line 145 in faea20d
Although this code works with Stylelint v15, it's an undocumented behavior. See the v15 plugin documentation. I strongly recommend fixing this plugin as follows. It works with both v15 and v16: --- a/index.js
+++ b/index.js
@@ -7,7 +7,7 @@ import walk from './lib/walk';
const reportedDecls = new WeakMap();
-export default stylelint.createPlugin(ruleName, (method, opts, context) => {
+function ruleFunc(method, opts, context) {
const propExceptions = [].concat(Object(opts).except || []);
const isAutofix = isContextAutofixing(context);
const dir = /^rtl$/i.test(Object(opts).direction) ? 'rtl' : 'ltr';
@@ -140,9 +140,11 @@ 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; |
Is that a good practice to add properties onto function? |
I'm unsure if that's a good practice or not. But it respects compatibility. |
@JounQin sure. JS allows it and I do not know big disadvantages. |
I think we should add back the previous support for compatibility, and export |
It doesn't work well with TypeScript by default. |
See discussion at csstools#22
We should move the discussion to Stylelint repo. Anyway this is a Stylelint current API. |
@jonathantneal I updated PR with @ybiquitous fixes |
@@ -42,7 +42,7 @@ | |||
"stylelint-tape": "3.0.0" | |||
}, | |||
"peerDependencies": { | |||
"stylelint": ">= 11 < 16" | |||
"stylelint": ">= 11 < 17" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new plugin structure works on >=11 <15
? @ybiquitous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a new structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so it's still compatible here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. export { ruleName }
happens to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ybiquitous Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Stylelint API was not changed, we should not change this range.
We just moved to a correct API which worked before by accident and stop working in Stylelint 16.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Stylelint API was not changed, we should not change this range.
I'm just confirming whether current pattern also works on >=11 <15
.
We just moved to a correct API which worked before by accident and stop working in Stylelint 16.
That's why I said for compatibility, stylelint should not remove the API, and the API is better than current one IMO.
Hi, there! Any updates? |
No updates yet, but I haven't forgotten. |
Hi, again) Do you have any news about access? |
Thank you @ai, and everyone else 🙇 |
This has been released as |
Thanks a lot for your work. I've just migrated to 2.1.1 and I still getting an error message: Is there some configurations that I should update? |
That message is kinda expected. But at this time it is only a warning and shouldn't be to much of a nuisance :) Unless I misunderstood and that message is also a hard error? |
Oh, I see, thanks for clarification. It works. |
Migration to Stylelint 16 should not be hard
https://github.com/stylelint/stylelint/blob/main/docs/migration-guide/to-16.md