Skip to content

Commit

Permalink
fix: add global ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Nov 8, 2024
1 parent db14381 commit 08bd343
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/create-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if (sharedConfigIndex === -1) {
// passed "--config"
const packageName = argv[sharedConfigIndex + 1];
const type = argv.includes("--eslintrc") ? "eslintrc" : "flat";
const answers = { config: { packageName, type } };
const answers = { config: { packageName, type }, language: ["javascript"] };
const generator = new ConfigGenerator({ cwd, packageJsonPath, answers });

generator.calc();
Expand Down
2 changes: 2 additions & 0 deletions lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ export class ConfigGenerator {
importContent += "import pluginReact from \"eslint-plugin-react\";\n";
exportContent += " pluginReact.configs.flat.recommended,\n";
}
} else {
exportContent += " {ignores: [\"**/*.js\", \"**/*.cjs\", \"**/*.mjs\"]},\n";
}

if (languages?.some(item => item.startsWith("json"))) {
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-airbnb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
...compat.extends("airbnb"),
];",
"configFilename": "eslint.config.mjs",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-airbnb-base
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
...compat.extends("airbnb-base"),
];",
"configFilename": "eslint.config.mjs",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-standard
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
...compat.extends("standard"),
];",
"configFilename": "eslint.config.mjs",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-standard-flat
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
...[].concat(config),
];",
"configFilename": "eslint.config.mjs",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-standard-flat2
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
...[].concat(config),
];",
"configFilename": "eslint.config.mjs",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/config@eslint-config-xo
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
...[].concat(config),
];",
"configFilename": "eslint.config.mjs",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-json-problems
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
{files: ["**/*.json"], language: "json/json", ...json.configs.recommended},
];",
"configFilename": "eslint.config.js",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-json-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
{files: ["**/*.json"], language: "json/json"},
];",
"configFilename": "eslint.config.js",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-json5-problems
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
{files: ["**/*.json5"], language: "json/json5", ...json.configs.recommended},
];",
"configFilename": "eslint.config.js",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-json5-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
{files: ["**/*.json5"], language: "json/json5"},
];",
"configFilename": "eslint.config.js",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-jsonc-problems
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
{files: ["**/*.jsonc"], language: "json/jsonc", ...json.configs.recommended},
];",
"configFilename": "eslint.config.js",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-jsonc-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
{files: ["**/*.jsonc"], language: "json/jsonc"},
];",
"configFilename": "eslint.config.js",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-markdown-commonmark-problems
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
...markdown.configs.recommended,
];",
"configFilename": "eslint.config.js",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-markdown-commonmark-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
{files: ["**/*.md"], language: "markdown/commonmark"},
];",
"configFilename": "eslint.config.js",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-markdown-gfm-problems
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
...markdown.configs.recommended,
{files: ["**/*.md"], language: "markdown/gfm"},
];",
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/esm-markdown-gfm-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/** @type {import('eslint').Linter.Config[]} */
export default [
{ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"]},
{files: ["**/*.md"], language: "markdown/gfm"},
];",
"configFilename": "eslint.config.js",
Expand Down

0 comments on commit 08bd343

Please sign in to comment.