Skip to content

Commit

Permalink
Add tests for eslint-plugin-markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Oct 26, 2019
1 parent 38304fd commit 7dc3ecf
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 1 deletion.
5 changes: 5 additions & 0 deletions examples/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,10 @@ module.exports = {
parser: vue.configs.base.parser,
plugins: ["vue"],
},
{
// Markdown JS code blocks.
files: ["*.md"],
plugins: ["markdown"],
},
],
};
34 changes: 34 additions & 0 deletions examples/markdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Markdown

```js
import b1 from "b"
import a1 from "a";
```

Some text.

```js
code();

import b2 from "b";
import a2 from "a";

code()

import c2 from "c";

import e2 from "e";
import d2 from "d"

;[].forEach()
```

- Item 1.
- Item 2.

```js
import b3 from "b"
import a3 from "a"
```

End text.
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"scripts": {
"eslint": "eslint .",
"eslint:fix": "npm run eslint -- --fix",
"eslint:examples": "eslint --rulesdir src --no-ignore --fix-dry-run --format json --report-unused-disable-directives examples --ext .js,.ts,.vue",
"eslint:examples": "eslint --rulesdir src --no-ignore --fix-dry-run --format json --report-unused-disable-directives examples --ext .js,.ts,.vue,.md",
"prettier": "prettier --write \"*.md\"",
"doctoc": "doctoc README.md",
"jest": "jest",
Expand All @@ -43,6 +43,7 @@
"eslint-config-lydell": "14.0.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jest": "22.17.0",
"eslint-plugin-markdown": "^1.0.1",
"eslint-plugin-prettier": "3.1.0",
"eslint-plugin-vue": "5.2.3",
"jest": "24.9.0",
Expand Down
37 changes: 37 additions & 0 deletions test/__snapshots__/examples.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,43 @@ import Thing from "side-effects";
`;

exports[`examples markdown.md 1`] = `
# Markdown
\`\`\`js
import a1 from "a";
import b1 from "b"
\`\`\`
Some text.
\`\`\`js
code();
import a2 from "a";
import b2 from "b";
code()
import c2 from "c";
import d2 from "d"
import e2 from "e";
;[].forEach()
\`\`\`
- Item 1.
- Item 2.
\`\`\`js
import a3 from "a"
import b3 from "b"
\`\`\`
End text.
`;

exports[`examples prettier-comments.js 1`] = `
/* eslint prettier/prettier: "error" */
// This is just a test to make sure that this plugin plays well with Prettier.
Expand Down

0 comments on commit 7dc3ecf

Please sign in to comment.