Reformat code doesn't enforce ESLint rules
Is there a way when I use Reformat Code
shortcut it will also follow ESLint rules I set in my eslint.config.mjs
? Is there a setting I need to turned on? I know there's similar question in here but nothing helps me. The rule object-curly-spacing
is the one that doesn't enforced when I use Reformat Code
, the other one is enforced since it's applied on default to my code style settings in my IDE
// ...
const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
{
rules: {
quotes: ["warn", "double", { avoidEscape: true }],
"no-console": ["warn", { allow: ["warn", "error"] }],
"object-curly-spacing": ["error", "always"],
semi: ["error", "always"],
}
}
];
请先登录再写评论。
There is no way to set up the IDE to run eslint on Reformat Code action. There is a request for this feature, please feel free to vote for it: WEB-39373.
You can import ESLint code style preferences from
.eslintrc
, see Help for instructions. But note that only core ESLint rules (indent
,semi
,quotes
, etc) are applied, rules defined in various plugins won't be mapped.