UNPKG

putout

Version:

🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json

37 lines (32 loc) 878 B
import {mergeOptions} from './merge-options.js'; const {assign} = Object; export default ({type}, options) => { const config = type === 'module' ? esm() : commonjs(); assign(options, mergeOptions(options, config)); }; const commonjs = () => ({ match: { '*.js': { 'nodejs/convert-esm-to-commonjs': 'on', }, '.eslintrc.json': { 'eslint': 'on', 'eslint/convert-require-to-import': 'off', }, }, }); const esm = () => ({ match: { '*.js': { 'nodejs/convert-commonjs-to-esm': 'on', 'nodejs/add-strict-mode': 'off', }, '{test,*.spec.js}': { 'tape/convert-mock-require-to-mock-import': 'on', }, '.eslintrc.json': { 'eslint': 'on', 'eslint/convert-require-to-import': 'on', }, }, });