canonical
Version:
Canonical code style linter and formatter for JavaScript, SCSS and CSS.
34 lines (30 loc) • 989 B
JavaScript
// A second optional argument can be given to further configure
// the parser process. These options are recognized:
;
exports.__esModule = true;
exports.getOptions = getOptions;
var defaultOptions = {
// Source type ("script" or "module") for different semantics
sourceType: "script",
// When enabled, a return at the top level is not considered an
// error.
allowReturnOutsideFunction: false,
// When enabled, import/export statements are not constrained to
// appearing at the top of the program.
allowImportExportEverywhere: false,
// TODO
allowSuperOutsideMethod: false,
// An array of plugins to enable
plugins: [],
// TODO
strictMode: null
};
exports.defaultOptions = defaultOptions;
// Interpret and default an options object
function getOptions(opts /*:: ?: Object*/) /*: Object*/ {
var options = {};
for (var key in defaultOptions) {
options[key] = opts && key in opts ? opts[key] : defaultOptions[key];
}
return options;
}