-
-
Notifications
You must be signed in to change notification settings - Fork 254
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
add support for @stylistic/eslint-plugin
#272
base: main
Are you sure you want to change the base?
Conversation
Hi! Can you describe what your motivating use case is for this? |
Sure thing! I'd like to be able to use the stylistic rules from I think this makes sense from a comprehensive purpose — since |
Thanks! Just so that I understand what you’re doing correctly: Why don’t you enable just the rules from |
Great question! Two answers:
|
Aha, turning on all rules from a plugin and then disabling the ones that conflict – I can see that being a thing. 👍 Then I have a request: I would rather have all the |
Totally fair, makes sense! I anticipated you might comment about that, since it was a very different style than what was in that file before. |
I've mostly completed this — I just need to figure out how to get the tests working properly. It's very confusing because there are five different stylistic plugins — |
Any news? Would love to have this built-in |
I will see if I can get this finished up! |
🦋 Changeset detectedLatest commit: c4651b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Any update on the merge? |
No updates, I will probably need someone else to take this over. The logic is done, I simply need help finishing up the unit tests. Further complicating this is that ESLint Stylistic plans to merge their various packages (default, JavaScript, TypeScript, JSX) into one. |
For those wanting this and banging their heads against the unit tests, note:
(I’m not involved in the project anymore, I just occasionally read notifications on the repo.) |
I'm making a fork of the now archived UPDATE: Yeah, the tests could use a little love. We can get the current tests in a friendly state with this PR using a fairly simple patch (see dropdown below). Things are just failing now because the plugins aren't actually enabled in the testing pass for legacy configs, and those tests are smart enough to see they aren't present. Click to Opendiff --git a/.eslintrc.base.js b/.eslintrc.base.js
index a17afc8..a01f52d 100644
--- a/.eslintrc.base.js
+++ b/.eslintrc.base.js
@@ -98,6 +98,15 @@ module.exports = {
files: ["test-lint/{react,flowtype}.js"],
parserOptions: { parser: "@babel/eslint-parser" },
},
+ {
+ files: ["test-lint/@stylistic.js"],
+ extends: [
+ "plugin:@stylistic/all-extends",
+ "plugin:@stylistic/js/all-extends",
+ "plugin:@stylistic/jsx/all-extends",
+ "plugin:@stylistic/ts/all-extends",
+ ],
+ },
],
settings: {
react: {
diff --git a/eslint.base.config.js b/eslint.base.config.js
index a15d6f2..91d2d0a 100644
--- a/eslint.base.config.js
+++ b/eslint.base.config.js
@@ -89,9 +89,11 @@ module.exports = [
...vue.configs.recommended.rules,
},
},
- ...eslintrcBase.overrides.map(({ parserOptions, ...override }) => ({
- ...override,
- languageOptions: { parser: require(parserOptions.parser) },
- })),
+ ...eslintrcBase.overrides
+ .filter(({ parserOptions }) => parserOptions)
+ .map(({ parserOptions, ...override }) => ({
+ ...override,
+ languageOptions: { parser: require(parserOptions.parser) },
+ })),
{ files: ["test-lint/@stylistic.js"], ...stylistic.configs["all-flat"] },
]; Mind you, this probably isn't a "proper" fix in that we probably want to make sure we have separate files for the |
This is a bit of a hack... but we've already acknowledged the whole testing suite could use a rewrite, so this should be fine for the time being.
I've submitted a PR against this branch here, which fixes up the tests. It applies the patch above, creates separate We should be good to go soon! 🚀 |
Thank you for this much needed PR! Any news on this? I can see that the PR adding tests was done some weeks ago 😿 . Having this merged is definitely something a lot of people (including myself) would love to have, especially as people migrate to @Stylistic. |
Update Unit Tests for `@stylistic` Plugins
@Kenneth-Sills merged! |
Thank you! @JounQin, this is now ready for workflows and review. 😄 |
Thanks for fixing this, guys! Do we have any updates? My team has been waiting for this PR so we can add |
Seems promising, I'll find some time this weekend to review. |
@abrahamguo thx for doing this! I used this PR directly in my project and solved the issue of |
What part exactly? I'm also having Prettier conflicting with @stylistic/quotes. Edit: nvm, forked PR's branch and installed from there, errors gone. |
Since formatting rules have been deprecated from core ESLint and moved to
@stylistic/eslint-plugin
, this PR adds support for all the same rules in@stylistic/eslint-plugin
. Despite its name,@stylistic/eslint-plugin
still has rules that can be used with prettier:This PR also updates
package-lock.json
tolockfileVersion: 3
(the version used by the current versions ofnpm
) and ignores the.idea
folder created by JetBrains IDEs.