ITADN

Curly "all" being overriden in a flat file config

#341ClosedQuitch 创建于 2025-07-29
Q
Quitchcommented
In the eslint configuration below, eslint-config-prettier is disabling the curly rule despite it being in a condition that documentation suggests should work. ```js import js from "@eslint/js"; import lodash from "eslint-plugin-lodash"; import prettier from "eslint-config-prettier/flat"; import globals from "globals"; import { defineConfig } from "eslint/config"; export default defineConfig([ { files: ["**/*.js"], languageOptions: { ecmaVersion: 6, // only some ES6 support - PA uses Chrome 40 parserOptions: { ecmaFeatures: { impliedStrict: true, }, }, globals: { ...globals.browser, ...globals.jquery, ...globals.amd, api: "readonly", model: "writable", _: "readonly", loc: "readonly", ko: "readonly", requireGW: "readonly", star_system_templates: "readonly", parse: "readonly", createjs: "readonly", loadHtml: "readonly", locTree: "readonly", globals: "readonly", CommanderUtility: "readonly", Build: "readonly", i18n: "readonly", }, sourceType: "script", }, plugins: { js, lodash }, extends: ["js/recommended", "lodash/v3"], rules: { curly: ["error", "all"], "lodash/prefer-lodash-method": ["error", { ignoreMethods: ["split"] }], "lodash/prefer-map": "off", "lodash/prefer-noop": "off", }, }, { files: ["eslint.config.js"], languageOptions: { ecmaVersion: "latest", sourceType: "module", }, }, // Prettier config last to disable conflicting rules prettier, ]); ``` The following is not generating an error: `if (!aiMods.length) return [];` Removing the prettier line from the config causes the error to appear as expected.
关闭于 2025-07-29 2 条评论