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

Does not support ESLint v9.0.0 #10

Open
stevepolitodesign opened this issue Apr 17, 2024 · 2 comments
Open

Does not support ESLint v9.0.0 #10

stevepolitodesign opened this issue Apr 17, 2024 · 2 comments

Comments

@stevepolitodesign
Copy link

stevepolitodesign commented Apr 17, 2024

Environment

yarn: 1.22.17
node: 21.4.0

Steps to reproduce

  1. Run yarn add eslint@latest
  2. Run yarn add @thoughtbot/eslint-config --dev
  3. Add .eslintrc.json with the following:
      {
        "extends": ["@thoughtbot/eslint-config/base"]
      }
  4. Add a sample file.
    // index.js
    const foo = 'bar';
  5. Run eslint command with ESLINT_USE_FLAT_CONFIG set to false per the latest release's recommendations.
    ESLINT_USE_FLAT_CONFIG=false yarn eslint *.js
    

Note the following output:

Oops! Something went wrong! :(

ESLint: 9.0.0

Error: Cannot read config file: /Users/polito/Desktop/thoughtbot_eslint_config_example/node_modules/@thoughtbot/eslint-config/base.js
Error: The ESLint patch script has only been tested with ESLint version 6.x, 7.x, and 8.x. (Your version: 9.0.0)
Consider reporting a GitHub issue:
https://github.com/microsoft/rushstack/issues
Referenced from: /Users/polito/Desktop/thoughtbot_eslint_config_example/.eslintrc.json
    at Object.<anonymous> (/Users/polito/Desktop/thoughtbot_eslint_config_example/node_modules/@rushstack/eslint-patch/lib/_patch-base.js:184:11)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/Users/polito/Desktop/thoughtbot_eslint_config_example/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:11:23)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
(node:1626) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details.
(Use `node --trace-warnings ...` to show where the warning was created)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@emilford
Copy link

These guides were shared while discussing Suspenders and this issue during our Web team sync.

Eslint Migrate to 9.x Guide
Configuration Migration Guide
Importing Plugins and Custom Parsers

@rakeshpetit
Copy link

rakeshpetit commented Apr 19, 2024

Based on the guides, I tried to create a eslint.config.js like this:

const globals = require("globals");
const js = require("@eslint/js");
const thoughtbotBase = require("@thoughtbot/eslint-config/base");

module.exports = [
  js.configs.recommended,
  {
    files: ["**/*.js"],
    plugins: {
      "@thoughtbot-eslint": thoughtbotBase,
    },
  },
];

but hit an error in @rushstack/eslint-patch.

Error: Failed to patch ESLint because the calling module was not recognized.
If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:
https://github.com/microsoft/rushstack/issues
    at Object.<anonymous> (.../eslint-config/node_modules/@rushstack/eslint-patch/lib/_patch-base.js:167:19)

This does seem like an issue in @rushstack/eslint-patch with an open microsoft/rushstack#4635 to sort eslint-patch for ESLint 9.

I found in a playground how Flat configs must be specified for ESLint 9.0.0+ and tried that. After installing a few @typescript-eslint dependencies, the config in the playground repo worked well for my example project. So this indicated that we need to add support for Flag configs in our eslint-config based on typescript-eslint/typescript-eslint#7935 where something similar was done.

Based on all this information, I feel like supporting ESLint 9.0.0+ might take longer due to our external dependencies.

stevepolitodesign added a commit to thoughtbot/suspenders that referenced this issue Apr 19, 2024
The recent release of [ESLint v9.0.0][] made it so [flat config][] is
the new default.

Until we can update [thoughtbot/eslint-config][] to [support][] this
version, we'll pin ESLint to `^8.9.0` in an effort to ship this next
release of Suspenders.

[ESLint v9.0.0]: https://eslint.org/blog/2024/04/eslint-v9.0.0-released/
[flat config]:  https://eslint.org/blog/2024/04/eslint-v9.0.0-released/#flat-config-is-now-the-default-and-has-some-changes
[thoughtbot/eslint-config]: https://github.com/thoughtbot/eslint-config
[support]: thoughtbot/eslint-config#10
stevepolitodesign added a commit to thoughtbot/suspenders that referenced this issue May 10, 2024
The recent release of [ESLint v9.0.0][] made it so [flat config][] is
the new default.

Until we can update [thoughtbot/eslint-config][] to [support][] this
version, we'll pin ESLint to `^8.9.0` in an effort to ship this next
release of Suspenders.

[ESLint v9.0.0]: https://eslint.org/blog/2024/04/eslint-v9.0.0-released/
[flat config]:  https://eslint.org/blog/2024/04/eslint-v9.0.0-released/#flat-config-is-now-the-default-and-has-some-changes
[thoughtbot/eslint-config]: https://github.com/thoughtbot/eslint-config
[support]: thoughtbot/eslint-config#10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants