Comments (8)
Please provide a runnable online reproduction, I don't use CRA personally.
And the report should reference a specific eslint rule, which I think is actually not part of eslint-mdx at all.
from eslint-mdx.
@onichandame this is coming from from the airbnb preset
https://github.com/airbnb/javascript/blob/0375265cbd43635f8062615995a6a86f22fd0fc2/packages/eslint-config-airbnb/rules/react.js#L318-L320
To support mdx, override the "jsx-filename-extension" rule with
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.mdx'] }]
in your eslint config.
from eslint-mdx.
Please see https://codesandbox.io/s/lingering-bush-7o3cn.
Basically I ran npx eslint --init
and selected Google style during setup. The the linebreak-style is changed to CRLF as the server seems to use CRLF on default.
Now if you run npx eslint test.mdx --fix
and reload test.mdx by simply clicking it in the Files list, some extra semicolons are added to the end of line 7, which is definitely wrong.
Standard
https://codesandbox.io/s/holy-fast-734lf
This example is created with the Standard style. if you run npx eslint test.mdx
in the terminal you will see the error Expected an assignment or function call and instead saw an expression
The problem when Airbnb style is chosen is described in my initial post, a re-production can be easily made. If you need a reproduction for this please give me a shout.
from eslint-mdx.
@ChristianMurphy Thanks! One problem solved. Sadly others remain.
https://codesandbox.io/s/vigilant-elion-urmpf
If you run npx eslint test.mdx
in the terminal, same problem which is mentioned in the Google style part persists.
from eslint-mdx.
I didn't run codebox actually, but the key problem is .mdx
files require eslint-mdx
as parser while other configs may overrie it.
So you can try to locate plugin:mdx/recommended
to last position of configs so that it will handle all files correctly.
Or, you can use overrides
feature of ESLint
according to README.
from eslint-mdx.
And please provide what are the specific error outputs exactly... You comments maybe not so helpful to locate your real problems.
from eslint-mdx.
@JounQin Thanks but none of your suggestions worked. https://codesandbox.io/s/lingering-bush-7o3cn has been updated according to your advice.
- moved
plugin:mdx/recommended
to the end of the extends section. - added overrides rules according to the README.
Steps to Reproduce
- go to https://codesandbox.io/s/lingering-bush-7o3cn
- fork so you can access the terminal with your own account
- open a new terminal by clicking
+
button (on the bottom right corner by default) - run
npx eslint test.mdx --fix
Output
Expected:
No error
Seen:
- the terminal prints 7:14 error Missing semicolon semi
- the line 3 of test.mdx has been changed from
<div>hi</div>;
to<div>hi</div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
from eslint-mdx.
@onichandame OK, I just open an issue and track it at #183.
There is no workaround for this issue temporarily, you can disable ESLint rule semi
for .mdx
files for now.
{
"overrides": [
{
"files": ".mdx",
"rules": {
"semi": 0
}
}
]
}
from eslint-mdx.
Related Issues (20)
- Parsing error with <img> tag HOT 3
- Parsing error mdx: Missing semicolon HOT 3
- Parsing error with Latex HOT 2
- Document usage in flat config HOT 1
- Parsing error: Expected value to be truthy HOT 4
- How can you type check React props with this plugin? HOT 4
- Please document how to make the linter fixable HOT 3
- Does not check nested code blocks (only lints top-level code blocks) HOT 6
- Research Spike: ESLint 9 compatibility HOT 7
- Incompatible w/ MDX v3? HOT 2
- There are serious issues when used with the `react/self-closing-comp` / `react/jsx-sort-props` rules. HOT 6
- `prettier/prettier` reports, but cannot be fixed automatically
- feat: use `worker.mts` for pure ESM
- feat: respect `.remarkignore`?
- Add more mdast specified nodes into estree AST
- on npm eslint-plugin-mdx v2.3.2 is tagged as latest while v3.1.3 should be HOT 2
- TypeError: Cannot use 'in' operator to search for 'start' in undefined
- maintenance: enable `strictNullChecks` option
- meta: how can we support `eslint-define-config` better? HOT 6
- mdx/code-blocks doesn't respect eslint-disable from outside of the block HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-mdx.