@@ -57,7 +57,7 @@ async function format(options) {
57
57
const eslintConfig = merge (
58
58
{ } ,
59
59
options . eslintConfig ,
60
- await getESLintConfig ( filePath , eslintPath )
60
+ await getESLintConfig ( filePath , eslintPath , options . eslintConfig || { } )
61
61
) ;
62
62
63
63
const prettierOptions = merge (
@@ -248,8 +248,24 @@ function getTextFromFilePath(filePath) {
248
248
}
249
249
}
250
250
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 ) {
253
269
if ( filePath ) {
254
270
eslintOptions . cwd = path . dirname ( filePath ) ;
255
271
}
@@ -259,7 +275,8 @@ async function getESLintConfig(filePath, eslintPath) {
259
275
"${ filePath || process . cwd ( ) } "
260
276
`
261
277
) ;
262
- const eslint = getESLint ( eslintPath , eslintOptions ) ;
278
+ const eslint = getESLint ( eslintPath , getESLintApiOptions ( eslintOptions ) ) ;
279
+
263
280
try {
264
281
logger . debug ( `getting eslint config for file at "${ filePath } "` ) ;
265
282
const config = await eslint . calculateConfigForFile ( filePath ) ;
0 commit comments