Comments (20)
I made a pull request for adding it to a project. I get the following error message.
/home/travis/build/maasglobal/scrapql/README.md
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: README.md/0_0.ts.
The file must be included in at least one of the projects provided
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: README.md/1_1.ts.
The file must be included in at least one of the projects provided
...
See https://github.com/maasglobal/scrapql/pull/73/files
and https://travis-ci.com/github/maasglobal/scrapql/builds/160517417
from eslint-plugin-markdown.
Having the same issue as @mohanraj-r, can this issue be reopened as it doesn't seem possible to use parserOptions.project
with this plugin
from eslint-plugin-markdown.
@btmills Thanks for this plugin!
@cyberixae
I faced the same error for my typescript project when I used js
or javascript
for the code blocks. But the errors went away once I switched to ts
or typescript
(which seems different than your situation).
Error:
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: README.md/0_0.js.
The file must be included in at least one of the projects provided
Setup that is working for me currently with v2:
.eslintrc.js
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
},
plugins: [
'markdown',
],
overrides: [
{
// Enable the Markdown processor for all .md files.
files: ['**/*.md'],
processor: 'markdown/markdown',
},
]
}
tsconfig.eslint.json:
{
"compilerOptions": { "strict": true },
"include": ["./packages/**/*.ts", "*.js"]
}
I tried including "**/*.md/*.js"
in the include
list above - but it didn't seem to make a difference.
from eslint-plugin-markdown.
Now that [email protected]
is out, any chance this could be readdressed?
from eslint-plugin-markdown.
Same issue. Any known workaround?
from eslint-plugin-markdown.
@btmills Why #114 was closed? Where I can see working configuration example for Typescript? I tried your example, but no success
from eslint-plugin-markdown.
Unfortunately it's not possible to use type-aware linting rules with any ESLint processors, this Markdown plugin included. Since code blocks aren't real .ts
files on disk, the TypeScript compiler doesn't know how readme.md/0_0.ts
fits into any known tsconfig.json
. If you remove parserOptions.project
, you should still be able to use the @typescript-eslint
rules that don't require a tsconfig.json
. For more details, check out #155 (comment) from the PR where I added the TypeScript example to the repository.
from eslint-plugin-markdown.
@laozhu remove parserOptions.project
from your config for Markdown code blocks. tsc
doesn't support type-aware lint rules in Markdown code blocks. For details, see #114 (comment).
from eslint-plugin-markdown.
Thank you for this issue.
For now, we cannot check ts
code blocks. But ESLint 6 will support multiple processors (eslint/eslint#11552), then we will get the ability to lint ts
code blocks.
from eslint-plugin-markdown.
👋 I'm now actively working on implementing the new processor API so that this plugin can extract TypeScript code blocks and pass them to ESLint! I'm tracking progress in #138, so subscribe to that issue if you'd like updates, and I'll close this so that #138 is the primary issue for this work.
from eslint-plugin-markdown.
I see #138 is now closed. Does this mean that TypeScript is now supported? There is no mention of TypeScript in readme.
from eslint-plugin-markdown.
v2.0.0-alpha.0, released this weekend, should work with ```ts
code blocks! Please try it out and let me know how it goes. I'm also working on a set of examples, so if you're so inclined, I'd welcome a PR to add add an examples/typescript
subdirectory with TypeScript working!
from eslint-plugin-markdown.
Maybe adding sourceType: 'module'
to parserOptions
breaks markdown plugin.
from eslint-plugin-markdown.
Same issue, if add *.md mask for linting.
Steps for reproduce:
- change
eslint **/*.{ts,json,js}
to eslint**/*.{ts,json,js,md}
in package.json - npm run lint
- Have error:
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: readme.md\0_0.js.
The file must be included in at least one of the projects provided
from eslint-plugin-markdown.
@viT-1 if something is broken in the TypeScript example, please open an issue describing what's broken or better yet a PR to fix it! If you're able to use some @typescript-eslint
rules but not the type-aware rules, see the comment above you for why that's not currently possible.
from eslint-plugin-markdown.
The same problem here, any workaround to avoid the error message from tsc
?
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: no-console.md/2_2.ts.
The file must be included in at least one of the projects provided.
from eslint-plugin-markdown.
Thank you, solved this. Some types-required rules have to be disabled for typescript blocks in markdown.
from eslint-plugin-markdown.
I've tried changing the eslint command for a project here from "eslint --ext .ts,.tsx,.js ." to "eslint ." and am seeing the same error reported by others here
/home/bumble/software/snabbdom/README.md
790:1 error Parsing error: ESLint was configured to run on `<tsconfigRootDir>/README.md/33_33.tsx` using `parserOptions.project`:
- <tsconfigRootDir>/tsconfig.json
- <tsconfigRootDir>/test/tsconfig.json
However, none of those TSConfigs include this file. Either:
- Change ESLint's list of included files to not include this file
- Change one of those TSConfigs to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file
The project does not define parserOptions.project
for markdown files https://github.com/snabbdom/snabbdom/blob/master/.eslintrc.json
Would anyone tell me what I'm doing wrong? I've tried explicitly setting null parserOptions.project, but it did not have any effect
{
"files": ["**/*.md"],
"processor": "markdown/markdown",
"parserOptions": {
"project": null
}
}
from eslint-plugin-markdown.
The issue was resolved by explicitly ignoring README-related files in the eslint typescript configuration. The full PR and changes are here snabbdom/snabbdom#1074
from eslint-plugin-markdown.
For flat config, this snippet should help:
{
files: ['**/*.md/**'],
languageOptions: {
parserOptions: {
project: null,
},
},
}
from eslint-plugin-markdown.
Related Issues (20)
- Typescript examples are not working / out of date HOT 4
- Switch from cjs to esm HOT 2
- Support ESLint 8.x HOT 5
- feat: option to ignore certain languages HOT 19
- wrong Configuring HOT 1
- [FR] option to ignore code blocks by meta string HOT 4
- Usage with TypeScript and type-aware rules HOT 2
- Invitation to move to official `eslint-community` org HOT 8
- Is there a option to disable `Parsing error: Identifier '' has already been declared` HOT 11
- Doesn't work with custom parser HOT 13
- Support for JS inside HTML inside Markdown. HOT 6
- request: update dependencies HOT 3
- Configure file name based on block meta HOT 7
- plugin is not working here [problem and workaround identified inside this issue] HOT 3
- Rule removing redundant trailing slashes from links HOT 1
- Flat config HOT 7
- TypeError: Converting circular structure to JSON HOT 3
- Bug: Uncaught undefined for reporting after a code block HOT 1
- feat: Support different names for code block languages HOT 3
- Support ESLint 9.x HOT 1
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-plugin-markdown.