-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove support for Stylelint less than 16.0.0 #94
Conversation
@jeddy3 I found a workaround for the segfault error. Please try using However, I don't identify why segfault errors don't occur in the Related: stylelint/stylelint#7329 |
@ybiquitous Thanks for digging into some more! I've pushed a commit to use the light runner. Unfortunately, Windows is now tripping up with this error: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:' Prettier is using the runner on their codebase, so we can be confident it should work on Windows. It could be something with our preset or with how I'm configuring Jest (although, I've tried to match Prettier's config settings). I try to look into it myself over the weekend, but please share if you have any ideas. |
Um, I'm not 100% sure, but how about trying the const loadLint = () => import("stylelint").then((m) => m.default.lint);
global.testRule = getTestRule({ plugins: ["./lib/index.js"], loadLint }); See also: |
@ybiquitous Thank you for the suggestion. I tried, but the error remained. Debugging on Windows is a pain without a Windows machine to hand... pushing commits and waiting on the CI. However, I continued digging. I remembered we could pass plugin objects directly to the import { getTestRule } from "jest-preset-stylelint";
const plugin = await import("./lib/index.js");
global.testRule = getTestRule({ plugins: [plugin] }); Is this an acceptable workaround to document in the migration guide, or should we dig deeper to discover why plugin locators aren't resolving correctly in Jest on Windows? I did try using |
Congrats for the CI green! 🎉
If we will create a new helper using I guess it's more straightforward to import a plugin in its test (like fb5cd86) than a global setup file (this feature is specific for Jest at this time). For example: // test file per rule
import rule from "../index.js";
const {
rule: { messages, ruleName },
} = rule;
testRule({
// 🙆🏼♂️ Good
plugins: [rule],
// 🙅🏼♂️ Bad
plugins: ["./index.js"],
ruleName,
// other settings...
});
//-------------------//
// 🙅🏼♂️ Bad
// jest.setup.js
global.testRule = getTestRule({
plugins: [plugin],
}); If this would makes sense, it seems we should update the plugin testing guide and the Just to confirm, the way to pass a plugin object directly would never raise a problem even in Windows, right? |
Yes, I agree. It feels like passing the plugin object directly is:
I agree. We don't need to dig deeper into the issue as we'll push this pattern in our docs because it's future-facing.
I don't believe so. Stylelint has always accepted a plugin object directly in the |
Closes #95
Support for stylelint@16 onwards.