chore: add code formatting and linting (#952)

This commit is contained in:
Caleb
2018-08-07 14:46:54 -06:00
committed by Shawn Erquhart
parent 32e0a9b2b5
commit f801b19221
265 changed files with 5988 additions and 4481 deletions

View File

@ -3,25 +3,28 @@ const isTest = process.env.NODE_ENV === 'test';
const presets = () => {
if (isTest) {
return [
'@babel/preset-react',
'@babel/preset-env',
];
return ['@babel/preset-react', '@babel/preset-env'];
}
return [
'@babel/preset-react',
['@babel/preset-env', {
modules: false,
}],
[
'@babel/preset-env',
{
modules: false,
},
],
];
};
const plugins = () => {
const defaultPlugins = [
'lodash',
['babel-plugin-transform-builtin-extend', {
globals: ['Error']
}],
[
'babel-plugin-transform-builtin-extend',
{
globals: ['Error'],
},
],
'transform-export-extensions',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
@ -29,35 +32,39 @@ const plugins = () => {
];
if (isProduction) {
return [
...defaultPlugins,
['emotion', { hoist: true }],
];
return [...defaultPlugins, ['emotion', { hoist: true }]];
}
if (isTest) {
return [
...defaultPlugins,
['inline-svg', {
svgo: {
plugins: [
{removeViewBox: false},
],
[
'inline-svg',
{
svgo: {
plugins: [{ removeViewBox: false }],
},
},
}],
['emotion', {
sourceMap: true,
autoLabel: true,
}],
],
[
'emotion',
{
sourceMap: true,
autoLabel: true,
},
],
];
}
return [
...defaultPlugins,
['emotion', {
sourceMap: true,
autoLabel: true,
}],
[
'emotion',
{
sourceMap: true,
autoLabel: true,
},
],
];
};