Skip to content

Two config objects created for JS & globals that could be merged #171

Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Starting with JS, ESM, no TypeScript or frameworks, with browser globals:

@eslint/create-config: v1.8.2

✔ What do you want to lint? · javascript
✔ How would you like to use ESLint? · problems
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · none
✔ Does your project use TypeScript? · no / yes
✔ Where does your code run? · browser

...creates this config:

import js from "@eslint/js";
import globals from "globals";
import { defineConfig } from "eslint/config";


export default defineConfig([
  { files: ["**/*.{js,mjs,cjs}"], plugins: { js }, extends: ["js/recommended"] },
  { files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: globals.browser } },
]);

That config could be simplified to:

export default defineConfig([
  {
    files: ["**/*.{js,mjs,cjs}"],
    extends: ["js/recommended"],
    languageOptions: { globals: globals.browser },
    plugins: { js },
  },
]);

I think it could be confusing to users that the recommended config initializer creates two objects when only one is necessary. I could see folks thinking the two are necessary because that's what "ESLint" did for them.

Suggestion: how about combining the objects if possible?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions