@@ -57,7 +57,7 @@ async function format(options) {
5757 const eslintConfig = merge (
5858 { } ,
5959 options . eslintConfig ,
60- await getESLintConfig ( filePath , eslintPath )
60+ await getESLintConfig ( filePath , eslintPath , options . eslintConfig || { } )
6161 ) ;
6262
6363 const prettierOptions = merge (
@@ -248,8 +248,24 @@ function getTextFromFilePath(filePath) {
248248 }
249249}
250250
251- async function getESLintConfig ( filePath , eslintPath ) {
252- const eslintOptions = { } ;
251+ function getESLintApiOptions ( eslintConfig ) {
252+ // https://eslint.org/docs/developer-guide/nodejs-api
253+ // these options affect what calculateConfigForFile produces
254+ return {
255+ ignore : eslintConfig . ignore || true ,
256+ ignorePath : eslintConfig . ignorePath || null ,
257+ allowInlineConfig : eslintConfig . allowInlineConfig || true ,
258+ baseConfig : eslintConfig . baseConfig || null ,
259+ overrideConfig : eslintConfig . overrideConfig || null ,
260+ overrideConfigFile : eslintConfig . overrideConfigFile || null ,
261+ plugins : eslintConfig . plugins || null ,
262+ resolvePluginsRelativeTo : eslintConfig . resolvePluginsRelativeTo || null ,
263+ rulePaths : eslintConfig . rulePaths || [ ] ,
264+ useEslintrc : eslintConfig . useEslintrc || true
265+ } ;
266+ }
267+
268+ async function getESLintConfig ( filePath , eslintPath , eslintOptions ) {
253269 if ( filePath ) {
254270 eslintOptions . cwd = path . dirname ( filePath ) ;
255271 }
@@ -259,7 +275,8 @@ async function getESLintConfig(filePath, eslintPath) {
259275 "${ filePath || process . cwd ( ) } "
260276 `
261277 ) ;
262- const eslint = getESLint ( eslintPath , eslintOptions ) ;
278+ const eslint = getESLint ( eslintPath , getESLintApiOptions ( eslintOptions ) ) ;
279+
263280 try {
264281 logger . debug ( `getting eslint config for file at "${ filePath } "` ) ;
265282 const config = await eslint . calculateConfigForFile ( filePath ) ;
0 commit comments