-
Notifications
You must be signed in to change notification settings - Fork 86
docs: add migration docs #559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1ae2b0b
3f574bb
4c9541a
517e57a
cc39e9e
1ebbe17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,132 @@ | ||||||||||||||||||
| # Migration | ||||||||||||||||||
|
|
||||||||||||||||||
| ## From `eslint-plugin-markdown` | ||||||||||||||||||
|
|
||||||||||||||||||
| Starting with v6, `@eslint/markdown` officially replaced `eslint-plugin-markdown`. | ||||||||||||||||||
| You can take the following steps to migrate from the old package. | ||||||||||||||||||
|
|
||||||||||||||||||
| > [!NOTE] | ||||||||||||||||||
| > `@eslint/markdown` requires that you're on at least ESLint v9. | ||||||||||||||||||
lumirlumir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||
|
|
||||||||||||||||||
| ### Update dependencies | ||||||||||||||||||
|
|
||||||||||||||||||
| - `pnpm remove eslint-plugin-markdown` | ||||||||||||||||||
| - `pnpm add -D @eslint/markdown` | ||||||||||||||||||
michaelfaith marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||
|
|
||||||||||||||||||
| ### Update `eslint.config.js/ts` | ||||||||||||||||||
|
|
||||||||||||||||||
| Make the following updates to your config, based on how you're currently using `eslint-plugin-markdown`. | ||||||||||||||||||
|
|
||||||||||||||||||
| #### Configs | ||||||||||||||||||
|
|
||||||||||||||||||
| ```diff | ||||||||||||||||||
| // eslint.config.js | ||||||||||||||||||
| import { defineConfig } from "eslint/config"; | ||||||||||||||||||
| - import markdown from "eslint-plugin-markdown"; | ||||||||||||||||||
| + import markdown from "@eslint/markdown"; | ||||||||||||||||||
|
|
||||||||||||||||||
| export default defineConfig([ | ||||||||||||||||||
| - ...markdown.configs.recommended, | ||||||||||||||||||
| + markdown.configs.recommended, | ||||||||||||||||||
|
|
||||||||||||||||||
| // your other configs | ||||||||||||||||||
| ]); | ||||||||||||||||||
|
|
||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| If you were previously applying rules from other languages to code blocks within your markdown files, you can use this plugin's `processor` config to still allow for that. | ||||||||||||||||||
|
|
||||||||||||||||||
| ```js | ||||||||||||||||||
| // eslint.config.js | ||||||||||||||||||
| import { defineConfig } from "eslint/config"; | ||||||||||||||||||
| import markdown from "@eslint/markdown"; | ||||||||||||||||||
|
|
||||||||||||||||||
| export default defineConfig([ | ||||||||||||||||||
| markdown.configs.recommended, | ||||||||||||||||||
| markdown.configs.processor, | ||||||||||||||||||
|
|
||||||||||||||||||
| // your other configs | ||||||||||||||||||
| ]); | ||||||||||||||||||
| ``` | ||||||||||||||||||
lumirlumir marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
|
|
||||||||||||||||||
| [!IMPORTANT] | ||||||||||||||||||
michaelfaith marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||
| > Because this plugin uses a new language to power its linting, you may need to update the other configs you're using so that you limit those to only apply to `js / ts` files. | ||||||||||||||||||
| > Otherwise, those rules will be applied to markdown files now, too, which can lead to unexpected failures. | ||||||||||||||||||
|
|
||||||||||||||||||
| ```js | ||||||||||||||||||
| // eslint.config.js | ||||||||||||||||||
| import { defineConfig } from "eslint/config"; | ||||||||||||||||||
| import js from "@eslint/js"; | ||||||||||||||||||
| import markdown from "@eslint/markdown"; | ||||||||||||||||||
|
|
||||||||||||||||||
| export default defineConfig([ | ||||||||||||||||||
| { | ||||||||||||||||||
| name: "your-project/recommended-rules", | ||||||||||||||||||
| files: ["**/*.js"], | ||||||||||||||||||
| plugins: { | ||||||||||||||||||
| js, | ||||||||||||||||||
| }, | ||||||||||||||||||
| extends: ["js/recommended"], | ||||||||||||||||||
| }, | ||||||||||||||||||
| markdown.configs.recommended, | ||||||||||||||||||
|
||||||||||||||||||
| markdown.configs.recommended, | |
| { | |
| files: ["**/*.md"], | |
| plugins: { | |
| markdown | |
| }, | |
| extends: ["markdown/recommended"] | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. And that's the case even for configs that already declare files and plugins in the configs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Uh oh!
There was an error while loading. Please reload this page.