axios 拦截器和 eslint

axios interceptors and eslint

axios.interceptors.request.use((config) => {
  config.headers = { ...config.headers, customHeader: 'ABC' };
  return config;
});

ESLINT 错误:

error Assignment to property of function parameter 'config' no-param-reassign

如何将我的 customHeader 正确分配给配置?

尝试

axios.interceptors.request.use((config) => {
  return {
    ...config, 
    headers: {...config.headers, customHeader: 'ABC" }
  };
});