node/tools/node_modules/@babel/eslint-parser/lib/configuration.cjs
Antoine du Hamel 7b2bebba7a
tools: add support for import assertions in linter
PR-URL: https://github.com/nodejs/node/pull/39924
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-09-04 10:10:39 +02:00

24 lines
No EOL
940 B
JavaScript

const _excluded = ["babelOptions", "ecmaVersion", "sourceType", "allowImportExportEverywhere", "requireConfigFile"];
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
exports.normalizeESLintConfig = function (options) {
const {
babelOptions = {},
ecmaVersion = 2020,
sourceType = "module",
allowImportExportEverywhere = false,
requireConfigFile = true
} = options,
otherOptions = _objectWithoutPropertiesLoose(options, _excluded);
return Object.assign({
babelOptions: Object.assign({
cwd: process.cwd()
}, babelOptions),
ecmaVersion,
sourceType,
allowImportExportEverywhere,
requireConfigFile
}, otherOptions);
};