跳到主要内容

ESLint

craco.config.js
module.exports = {
// ...
eslint: {
enable: true /* (default value) */,
mode: 'extends' /* (default value) */ || 'file',
configure: { /* ... */ },
configure: (eslintConfig, { env, paths }) => {
/* ... */
return eslintConfig;
},
pluginOptions: { /* ... */ },
pluginOptions: (eslintPluginOptions, { env, paths }) => {
/* ... */
return eslintPluginOptions;
},
},
};
提示

上文的大纲中两次列出的属性(例如 configure)可以分配一个对象字面量或一个函数。请参阅 配置提示 了解详细信息。

eslint.enable

布尔值 = true

是否启用了 ESLint。

eslint.mode

'extends' | 'file' = 'extends'

请参阅 覆盖模式

eslint.configure

ESLintConfig(config: ESLintConfig, { env, paths }) => ESLintConfig

任何 ESLint 配置选项:https://eslint.org.cn/docs/latest/user-guide/configuring/

eslint.pluginOptions

ESLintPluginOptions(options: ESLintPluginOptions, { env, paths }) => ESLintPluginOptions

任何 ESLint 插件配置选项:https://github.com/webpack-contrib/eslint-webpack-plugin#options