chore: add code formatting and linting (#952)
This commit is contained in:
@ -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,
|
||||
},
|
||||
],
|
||||
];
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user