* .prettierrc: full configuration for Prettier This way, contributors using different-from-default settings will still use the correct prettier settings * Makefile: also lint .babelrc.js * Makefile: also prettify .json files * Exclude package.json files and correct build dir * Add more default options to prettierrc and load it in cli This avoids prettier looking up the config for each file * Format json * Update prettier and eslint and reformat codebase * Remove obsolete file * Add comment
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
"use strict";
|
|
|
|
const env = process.env.BABEL_ENV || process.env.NODE_ENV;
|
|
const envOpts = {
|
|
loose: true,
|
|
};
|
|
|
|
switch (env) {
|
|
case "development":
|
|
envOpts.debug = true;
|
|
// fall-through
|
|
case "test":
|
|
case "cov":
|
|
envOpts.targets = {
|
|
node: "current",
|
|
};
|
|
}
|
|
|
|
const config = {
|
|
comments: false,
|
|
presets: [["@babel/env", envOpts]],
|
|
plugins: [
|
|
// TODO: Use @babel/preset-flow when
|
|
// https://github.com/babel/babel/issues/7233 is fixed
|
|
"@babel/plugin-transform-flow-strip-types",
|
|
["@babel/proposal-class-properties", { loose: true }],
|
|
"@babel/proposal-export-namespace-from",
|
|
"@babel/proposal-numeric-separator",
|
|
["@babel/proposal-object-rest-spread", { useBuiltIns: true }],
|
|
],
|
|
overrides: [
|
|
{
|
|
test: "packages/babylon",
|
|
plugins: [
|
|
"babel-plugin-transform-charcodes",
|
|
["@babel/transform-for-of", { assumeArray: true }],
|
|
],
|
|
},
|
|
],
|
|
};
|
|
|
|
// we need to do this as long as we do not test everything from source
|
|
if (env === "cov") {
|
|
config.auxiliaryCommentBefore = "istanbul ignore next";
|
|
config.plugins.push("babel-plugin-istanbul");
|
|
}
|
|
|
|
module.exports = config;
|