eslint-mdx icon indicating copy to clipboard operation
eslint-mdx copied to clipboard

Research Spike: ESLint 9 compatibility

Open ChristianMurphy opened this issue 2 years ago • 13 comments
trafficstars

Initial checklist

Problem

ESLint 9 is changing the plugin API: https://eslint.org/blog/2023/09/preparing-custom-rules-eslint-v9/ There may be changes needed in ESLint-MDX

Solution

Check to see if any changed/removed APIs are used, migrate if needed.

Alternatives

  • No change may be needed
  • We could remain on eslint 8 for a while if the migration is challenging

ChristianMurphy avatar Oct 05 '23 19:10 ChristianMurphy

image

I don't see how to test eslint@9 at this point.

JounQin avatar Dec 05 '23 15:12 JounQin

https://github.com/eslint/eslint/releases/tag/v9.0.0-alpha.0

ChristianMurphy avatar Dec 30 '23 13:12 ChristianMurphy

Since the new flat config no longer resolves files, and supports eslint.config.mjs, I think ESLint MDX integrations can switch to ESM.

remcohaszing avatar Dec 30 '23 13:12 remcohaszing

Since the new flat config no longer resolves files, and supports eslint.config.mjs, I think ESLint MDX integrations can switch to ESM.

I'd like to keep dual. Legacy .eslintrc configs are still supported.

JounQin avatar Dec 30 '23 17:12 JounQin

Legacy configuration are deprecated https://eslint.org/blog/2023/12/eslint-v9.0.0-alpha.0-released/

There are far less quirks and hacks packaging as pure ESM, rather than dealing with dual packaging limitations.

ChristianMurphy avatar Dec 30 '23 17:12 ChristianMurphy

https://github.com/mdx-js/eslint-mdx/issues/496

@ChristianMurphy

worker.mts will bypass all the limitations.

They're deprecated but still supported. I don't want to break anyone's current workflow before they're ready including myself.

For example, compatibility with other plugins.

https://github.com/import-js/eslint-plugin-import/issues/2948#issuecomment-1872563600

JounQin avatar Dec 30 '23 17:12 JounQin

What's the plan?

tianyingchun avatar May 29 '24 22:05 tianyingchun

If you don't use Markdown, then the current version [email protected] appears to work in ESLint v9 by copying the flat config which is exported:

eslint.config.js or eslint.config.mjs

import eslintMdx from 'eslint-mdx';
import mdx from 'eslint-plugin-mdx';

/** @type {import('eslint').Linter.FlatConfig} */
const config = [
  {
    files: ['**/*.mdx'],
    languageOptions: {
      sourceType: 'module',
      ecmaVersion: 'latest',
      parser: eslintMdx,
      globals: {
        React: false,
      },
    },
    plugins: {
      mdx,
    },
    rules: {
      'mdx/remark': 'warn',
      'no-unused-expressions': 'error',
      'react/react-in-jsx-scope': 0,
    },
  },
];

export default config;

karlhorky avatar Aug 02 '24 14:08 karlhorky

i have integrating mdx into a plugin it can works fine for eslint V9 https://github.com/hyperse-io/eslint-config-hyperse

tianyingchun avatar Aug 03 '24 01:08 tianyingchun

what's plan for ESLint V9, i used it in local, it seems that everything works fine except we need to bump eslint-plugin-markdown to latest version (5.1.0) for now it used "eslint-plugin-markdown": "^3.0.1"?

tianyingchun avatar Aug 11 '24 00:08 tianyingchun