Skip to content
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

Support for eslint 9.0.0 #137

Closed
AlbertSabate opened this issue Apr 8, 2024 · 15 comments
Closed

Support for eslint 9.0.0 #137

AlbertSabate opened this issue Apr 8, 2024 · 15 comments
Assignees
Labels
enhancement New feature or request

Comments

@AlbertSabate
Copy link

Describe the need
ESLint 9.0.0 has been released as stable.

Currently, the ESlint version of this package is pointing to version 8.43.0, which has many deprecation notices for version 9.0.0.

This version updates the code to prevent using deprecated fn from version 8.x and start using the new fns of 9.x

The version has been updated to 8.56.0 and migrated to a non-deprecated FNS.

ESLint has not been bumped to version 9, as many changes are required to maintain backward compatibility. However, the package works well in the new version.

Tests are passing. And I tested a bit on my end. This is not a guarantee that I did not break anything. And Code reviews will be really appreciated :)

Note that the package has been bumped to 0.14.0.

Suggested Solution
Make it work

Possible Alternatives
NA

Additional context

  • [ X] I would be willing to contribute a PR to implement this feature

#136

@AlbertSabate
Copy link
Author

Hello @suiyun39, for you reference I've opened the PR #136 in regards of this issue, maybe you can continue from that branch if you want to amend anything? Will save you some hours of work :)

@suiyun39
Copy link

@AlbertSabate

Thanks for reminding, that reference is only for tracking: when can upgrade my eslint config package to eslint 9.0.0.

At the same time, I'd be happy to make some contributions to this project. But at the moment, I don't know the guidelines for this update. For example, should new version be compatible with eslint 8.x? We should create a minor version or major version?

@AlbertSabate
Copy link
Author

I would love to know it also. Maybe @joshwilsonvu can answer that? And let us know next steps?

In the meanwhile, for your reference, you can use the following with eslint 9.0.0 compatible using this in your package.json:

"eslint-plugin-solid": "git://github.com/AlbertSabate/eslint-plugin-solid#06897bafb97bd31f4021bafb124badcf4589ba58",

You can code review the changes on that commit.

@joshwilsonvu
Copy link
Collaborator

Hello, thank you all for taking the reins on this so far. (Started a new job recently and have been busy 🙂)

Currently, the plugin is tested with ESLint v8 down to v6. From what I understand, the breaking changes in ESLint v9 are fairly minor for plugin authors. I don't see a compelling reason to drop support for any old versions, until it becomes difficult to pass tests for those versions while supporting the newest version.

Re: versioning, since we're still in v0.x, it technically doesn't matter too much, but adding support for v9 would count as a new feature and could go in a minor. I may take the opportunity to release a v1 major version bump (without breaking changes) once the current batch of PRs and issues are resolved. The pace of rapid changes has slowed enough for that to make sense to me, and I think big changes to reactivity can wait until a v2.

I intend to do as much of that as I can tomorrow, and make a few infra updates soon to make releases a less manual, time-intensive process. I'm very thankful for all the community involvement and would like to make this project more collaborative, so that I'm less of a bottleneck.

@pauliesnug
Copy link
Contributor

v9 support was added to eslint-plugin-solid in #140, with #141 awaiting a peer dependency update

@Borber
Copy link

Borber commented May 27, 2024

When can it be released?

@Crazytieguy
Copy link

It looks like the build failed due to the lint script failing:

> eslint --ext .js,.jsx,.ts,.tsx --ignore-pattern test/fixture/invalid . "--max-warnings=0"

Invalid option '--ext' - perhaps you meant '-c'?
You're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.
 ELIFECYCLE  Command failed with exit code 2.

@pauliesnug
Copy link
Contributor

@Crazytieguy @Borber It was just released in the latest 4 commits, including v9 and flat config support

@joshwilsonvu
Copy link
Collaborator

Yes--v9 support was released in v0.14.0! This v0.14.1 release just fixes the peer dependency and makes some internal updates to use ESLint v9, which don't affect users.

@SomeAspy
Copy link
Contributor

If you are looking for an example config, its for the most part quite simple.

You can see my config on my site here
The migration guide is also available on eslint's site

However, the most basic configuration can be seen in the project readme, https://github.com/solidjs-community/eslint-plugin-solid?tab=readme-ov-file#flat-configuration

@onx2
Copy link

onx2 commented Jul 26, 2024

Whoops accidentally deleted my comment and meant to append. @SomeAspy

I'm getting this error when running my lint, even when using your version 🤔
TypeError: solidEslintPlugin.configs.flat/typescript is not iterable

import pluginJs from "@eslint/js";
import solidEslintPlugin from "eslint-plugin-solid";
import globals from "globals";
import typescriptESLint from "typescript-eslint";

export default [
  {
    languageOptions: { globals: globals.browser },
  },
  {
    /**
     * @note Must be in its own object
     * @see  https://github.com/eslint/eslint/discussions/18304
     * @docs https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects
     */
    ignores: [
      "**/dist/*",
      "**/i18n/*",
      "**/*.d.ts",
      "**/*.generated.*",
      "**/storybook-static/*",
    ],
  },
  pluginJs.configs.recommended,
  ...typescriptESLint.configs.recommended,
  ...solidEslintPlugin.configs["flat/typescript"],
];

I got this format from https://github.com/solidjs-community/eslint-plugin-solid?tab=readme-ov-file#flat-configuration.

// package.json dev deps
"@eslint/js": "9.7.0",
"eslint": "9.7.0",
"eslint-plugin-solid": "0.14.1",
"typescript-eslint": "7.17.0",

Full error:
image

Would definitely appreciate any insight, I don't seem to have this issue with any other plugin

@SomeAspy
Copy link
Contributor

It looks like the issue here might be the spread operator in front of solidEslintPlugin

@onx2
Copy link

onx2 commented Jul 26, 2024

Oh boy... 🤦🏼 this is what I get for doing multiple things at once. Thank you.

@eagerestwolf
Copy link

So, this can be resolved once and for all now 🎉. @typescript-eslint/utils version 8 is out now with native support for ESLint 9. That was the only real issue I had noticed was pnpm complaining about that peer dep. Otherwise, it's been working fine for me. Granted, I don't quite follow the recommended config.

// @ts-check

import { fixupConfigRules } from "@eslint/compat";
import js from "@eslint/js";
import gitignore from "eslint-config-flat-gitignore";
import jsxA111y from "eslint-plugin-jsx-a11y";
import perfectionist from "eslint-plugin-perfectionist";
import prettier from "eslint-plugin-prettier/recommended";
import solid from "eslint-plugin-solid/configs/typescript.js";
import tailwind from "eslint-plugin-tailwindcss";
import ts from "typescript-eslint";

/* @type {import("eslint").Linter.FlatConfig[]} */
export default [
  // Respect the .gitignore
  gitignore(),

  // JavaScript
  js.configs.recommended,

  // TypeScript
  ...ts.configs.recommendedTypeChecked,
  ...ts.configs.stylisticTypeChecked,
  {
    languageOptions: {
      parserOptions: {
        project: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },

  // JavaScript...again
  {
    files: ["**/*.cjs", "**/*.js", "**/*.jsx", "**/*.mjs"],
    ...ts.configs.disableTypeChecked,
  },

  // Pedanticism
  perfectionist.configs["recommended-natural"],

  // JSX/Solid/TailwindCSS
  ...fixupConfigRules(jsxA111y.flatConfigs.recommended),
  solid,
  ...tailwind.configs["flat/recommended"],

  // Prettier...because prettier
  prettier,

  // Rule overrides
  {
    rules: {
      "perfectionist/sort-imports": [
        "error",
        {
          groups: [
            ["builtin", "builtin-type"],
            ["external", "external-type"],
            ["internal", "internal-type"],
            ["parent", "parent-type"],
            ["sibling", "sibling-type"],
            ["index", "index-type"],
            ["side-effect", "side-effect-style"],
            ["object", "unknown"],
          ],
          ignoreCase: true,
          internalPattern: ["@/**"],
          newlinesBetween: "always",
          order: "asc",
          type: "natural",
        },
      ],
    },
  },
];

@pauliesnug
Copy link
Contributor

This can be closed, the only thing missing is bumping our internal use of typescript-eslint@v8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants