Skip to content

Commit

Permalink
chore: add tests for json/md
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Nov 4, 2024
1 parent 77337f8 commit cd750b8
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 1 deletion.
23 changes: 23 additions & 0 deletions tests/__snapshots__/esm-javascript-json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"configContent": "import globals from "globals";
import pluginJs from "@eslint/js";
import json from "@eslint/json";


/** @type {import('eslint').Linter.Config[]} */
export default [
{languageOptions: { globals: globals.node }},
pluginJs.configs.recommended,
{files: ["**/*.json"], language: "json/json", ...json.configs.recommended},
];",
"configFilename": "eslint.config.js",
"devDependencies": [
"eslint",
"globals",
"@eslint/js",
"@eslint/json",
],
"installFlags": [
"-D",
],
}
17 changes: 17 additions & 0 deletions tests/__snapshots__/esm-json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"configContent": "import json from "@eslint/json";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.json"], language: "json/json", ...json.configs.recommended},
];",
"configFilename": "eslint.config.js",
"devDependencies": [
"eslint",
"@eslint/json",
],
"installFlags": [
"-D",
],
}
17 changes: 17 additions & 0 deletions tests/__snapshots__/esm-json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"configContent": "import json from "@eslint/json";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.json5"], language: "json/json5", ...json.configs.recommended},
];",
"configFilename": "eslint.config.js",
"devDependencies": [
"eslint",
"@eslint/json",
],
"installFlags": [
"-D",
],
}
17 changes: 17 additions & 0 deletions tests/__snapshots__/esm-jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"configContent": "import json from "@eslint/json";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.jsonc"], language: "json/jsonc", ...json.configs.recommended},
];",
"configFilename": "eslint.config.js",
"devDependencies": [
"eslint",
"@eslint/json",
],
"installFlags": [
"-D",
],
}
17 changes: 17 additions & 0 deletions tests/__snapshots__/esm-markdown-commonmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"configContent": "import markdown from "@eslint/markdown";


/** @type {import('eslint').Linter.Config[]} */
export default [
...markdown.configs.recommended,
];",
"configFilename": "eslint.config.js",
"devDependencies": [
"eslint",
"@eslint/markdown",
],
"installFlags": [
"-D",
],
}
18 changes: 18 additions & 0 deletions tests/__snapshots__/esm-markdown-gfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configContent": "import markdown from "@eslint/markdown";


/** @type {import('eslint').Linter.Config[]} */
export default [
...markdown.configs.recommended,
{files: ["**/*.md"], language: "markdown/gfm"},
];",
"configFilename": "eslint.config.js",
"devDependencies": [
"eslint",
"@eslint/markdown",
],
"installFlags": [
"-D",
],
}
9 changes: 8 additions & 1 deletion tests/config-snapshots.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ describe("generate config for esm projects", () => {
env: ["browser", "node"]
};

const inputs = [];
const inputs = [
{ name: "esm-json", answers: { languages: ["json"] } },
{ name: "esm-json5", answers: { languages: ["json5"] } },
{ name: "esm-jsonc", answers: { languages: ["jsonc"] } },
{ name: "esm-markdown-commonmark", answers: { languages: ["md"], mdType: "commonmark" } },
{ name: "esm-markdown-gfm", answers: { languages: ["md"], mdType: "gfm" } },
{ name: "esm-javascript-json", answers: { languages: ["javascript", "json"], purpose: "problems", moduleType: "esm", framework: "none", useTs: false, env: ["node"] } }
];

// generate all possible combinations
for (let i = 0; i < choices.purpose.length; i++) {
Expand Down

0 comments on commit cd750b8

Please sign in to comment.