mdx-js / eslint-mdx

ESLint Parser/Plugin for MDX
https://npmjs.org/eslint-plugin-mdx
MIT License
264 stars 32 forks source link

When I'm linting got this error: `Parsing error: Invalid character` #361

Closed Mnigos closed 2 years ago

Mnigos commented 2 years ago

Initial checklist

Affected packages and versions

eslint-8.3.0; eslint-plugin-mdx-1.16.0

Link to runnable example

No response

Steps to reproduce

.eslintrc.js

// eslint-disable-next-line unicorn/prefer-module
module.exports = {
  root: true,
  env: {
    browser: true,
    es6: true,
  },
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 12,
    sourceType: 'module',
  },
  settings: {
    react: {
      version: 'detect',
    },
    'import/resolver': 'typescript',
  },
  plugins: ['@typescript-eslint', 'prettier', 'eslint-plugin-import-helpers'],
  extends: [
    'plugin:@typescript-eslint/recommended',
    'prettier',
    'plugin:react/recommended',
    'plugin:react/jsx-runtime',
    'plugin:react-hooks/recommended',
    'plugin:import/recommended',
    'plugin:import/typescript',
    'plugin:sonarjs/recommended',
    'plugin:unicorn/recommended',
    'plugin:jsx-a11y/recommended',
    'plugin:mdx/recommended',
  ],
  ignorePatterns: ['remix.config.js', 'remix.env.d.ts', '.eslintrc.js'],
  rules: {
    'prettier/prettier': 'warn',
    'prefer-const': 'warn',
    'no-console': 'off',
    '@typescript-eslint/no-unused-vars': 'error',
    'import-helpers/order-imports': 'off',
    // ignore only until https://github.com/sindresorhus/eslint-plugin-unicorn/pull/1628 is opened
    'unicorn/filename-case': ['warn', { case: 'kebabCase', ignore: [/^\$/] }],
    'unicorn/no-null': 'off',
    'mdx/code-blocks': 'off',
  },
}

Expected behavior

I got file

# Architecture Decision Records

* [1. use-english](0001-use-english.md)
* [2. choose-web-framework](0002-choose-web-framework.md)
* [3. choose-project-management-tool](0003-choose-project-management-tool.md)
* [4. choose-cms](0004-choose-cms.md)
* [5. repo-hosting](0005-repo-hosting.md)

I think every thing should go Ok.

Actual behavior

And error at line 1:0

C:\...\docs\README.md
  1:0  error  Parsing error: Invalid character

Runtime

Node v16

Package manager

npm v6

OS

Windows

Build and bundle tools

Remix

JounQin commented 2 years ago

See https://github.com/mdx-js/eslint-mdx#notice

And please provide a minimal and runnable reproduction next time.

king-open commented 1 year ago

Why does the vue module not found appear after installation?

ChristianMurphy commented 1 year ago

@king-open please open a dedicated issue, as your question is completely unrelated to the issue you commented on.

The issue is most likely in your package.json file. eslint-mdx does not modify or touch any vue related dependencies. It is likely vue was already incorrectly installed, and running your package manager exposed the issue.