prettier-eslint
Advanced tools
Comparing version
@@ -70,3 +70,3 @@ "use strict"; | ||
} = options; | ||
const eslintConfig = (0, _lodash.default)({}, options.eslintConfig, await getESLintConfig(filePath, eslintPath)); | ||
const eslintConfig = (0, _lodash.default)({}, options.eslintConfig, await getESLintConfig(filePath, eslintPath, options.eslintConfig || {})); | ||
const prettierOptions = (0, _lodash.default)({}, filePath && { | ||
@@ -225,5 +225,20 @@ filepath: filePath | ||
async function getESLintConfig(filePath, eslintPath) { | ||
const eslintOptions = {}; | ||
function getESLintApiOptions(eslintConfig) { | ||
// https://eslint.org/docs/developer-guide/nodejs-api | ||
// these options affect what calculateConfigForFile produces | ||
return { | ||
ignore: eslintConfig.ignore || true, | ||
ignorePath: eslintConfig.ignorePath || null, | ||
allowInlineConfig: eslintConfig.allowInlineConfig || true, | ||
baseConfig: eslintConfig.baseConfig || null, | ||
overrideConfig: eslintConfig.overrideConfig || null, | ||
overrideConfigFile: eslintConfig.overrideConfigFile || null, | ||
plugins: eslintConfig.plugins || null, | ||
resolvePluginsRelativeTo: eslintConfig.resolvePluginsRelativeTo || null, | ||
rulePaths: eslintConfig.rulePaths || [], | ||
useEslintrc: eslintConfig.useEslintrc || true | ||
}; | ||
} | ||
async function getESLintConfig(filePath, eslintPath, eslintOptions) { | ||
if (filePath) { | ||
@@ -237,3 +252,3 @@ eslintOptions.cwd = _path.default.dirname(filePath); | ||
`); | ||
const eslint = (0, _utils.getESLint)(eslintPath, eslintOptions); | ||
const eslint = (0, _utils.getESLint)(eslintPath, getESLintApiOptions(eslintOptions)); | ||
@@ -240,0 +255,0 @@ try { |
@@ -109,5 +109,2 @@ "use strict"; | ||
useEslintrc: false, | ||
baseConfig: { | ||
settings: eslintConfig.settings || {} | ||
}, | ||
...eslintConfig, | ||
@@ -114,0 +111,0 @@ // overrides |
{ | ||
"name": "prettier-eslint", | ||
"version": "14.0.2", | ||
"version": "14.0.3", | ||
"description": "Formats your JavaScript using prettier followed by eslint --fix", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
48945
1.43%570
2.15%