Description
Not Working with Preset Styles
when initiates eslint with one of the preset styles: google, standard or airbnb, eslint-mdx seems to conflict with the preset style.
Your environment
- OS: CentOS
- Env: node 10.19.0, yarn 1.22.4 eslint 6.8.0
Steps to reproduce:
- create a react app with create-react-app
yarn create react-app app
- init eslint in the app folder
cd app
npx eslint --init
- add mdx plugin
yarn add -D eslint-plugin-mdx
choose one of Standard
, Airbnb
, Google
style during initiation process.
4. add mdx to config
{
"extends": [
"plugin:mdx/recommended"
]
}
Now create a valid mdx file with import and jsx syntax and run eslint on the file.
Some weird errors are reported. It seems like something other than eslint-mdx is linting the mdx file.
Expected behaviour
no error is reported as the mdx is valid.
Actual behaviour
some weird errors are reported. The error reported is different for different preset style. Just to give an example, when the Airbnb style is chosen, 5:1 error JSX not allowed in files with extension '.mdx'
is reported.
Note
When the style part in the config file is removed,
{
"extends": [
"airbnb"
]
}
The problem disappeared. Therefore I guess that it's the conflict between the preset style and eslint-mdx that causes the problem.
This must be a very common scenario as all the steps follow the recommendation of eslint and eslint-mdx. But I cannot find a similar question on Google or StackOverflow. This might be helpful to others encountering the very problem in the future.