UNPKG

sharyn

Version:

Combines all the other packages under one.

178 lines (142 loc) 5.53 kB
"use strict"; var _checkSetup = require("@sharyn/check-setup"); // flow-disable-next-line var config = { extends: [], plugins: [], env: { browser: true }, globals: {}, rules: { 'no-unused-expressions': 0, 'no-underscore-dangle': 0, 'func-names': 0, 'no-unexpected-multiline': 2, 'prefer-destructuring': [2, { VariableDeclarator: { object: true, array: true }, AssignmentExpression: { object: false, array: false } }], semi: [2, 'never'] }, settings: {} }; if ((0, _checkSetup.hasPackage)('eslint-config-airbnb') && (0, _checkSetup.hasPackage)('eslint-config-airbnb-base')) { throw Error('Your package.json should either have eslint-config-airbnb or eslint-config-airbnb-base as a dependency but not both'); } if ((0, _checkSetup.hasPackage)('eslint-config-airbnb')) { config.extends.push('airbnb'); if (!(0, _checkSetup.hasPackage)('eslint-plugin-import')) { throw Error('eslint-config-airbnb requires having eslint-plugin-import installed'); } if (!(0, _checkSetup.hasPackage)('eslint-plugin-react')) { throw Error('eslint-config-airbnb requires having eslint-plugin-react installed'); } if (!(0, _checkSetup.hasPackage)('eslint-plugin-jsx-a11y')) { throw Error('eslint-config-airbnb requires having eslint-plugin-jsx-a11y installed'); } } if ((0, _checkSetup.hasPackage)('eslint-config-airbnb-base')) { config.extends.push('airbnb-base'); if (!(0, _checkSetup.hasPackage)('eslint-plugin-import')) { throw Error('eslint-config-airbnb-base requires having eslint-plugin-import installed'); } } if ((0, _checkSetup.hasPackage)('jest-puppeteer')) { config.globals.page = true; config.globals.browser = true; config.globals.jestPuppeteer = true; } if ((0, _checkSetup.hasPackage)('jest')) { config.env.jest = true; } if ((0, _checkSetup.hasPackage)('eslint-plugin-flowtype')) { config.extends.push('plugin:flowtype/recommended'); config.plugins.push('flowtype'); if (!(0, _checkSetup.hasPackage)('flow-bin')) { throw Error('eslint-plugin-flowtype requires having flow-bin installed'); } if (!(0, _checkSetup.hasPackage)('babel-eslint')) { throw Error('eslint-plugin-flowtype requires having babel-eslint installed'); } } if ((0, _checkSetup.hasPackage)('eslint-plugin-prettier')) { config.plugins.push('prettier'); config.rules['prettier/prettier'] = 2; if (!(0, _checkSetup.hasPackage)('prettier')) { throw Error('eslint-plugin-prettier requires having prettier installed'); } } if ((0, _checkSetup.hasPackage)('eslint-config-prettier')) { config.extends.push('prettier'); if ((0, _checkSetup.hasPackage)('react')) { config.extends.push('prettier/react'); } if ((0, _checkSetup.hasPackage)('flow-bin')) { config.extends.push('prettier/flowtype'); } if (!(0, _checkSetup.hasPackage)('prettier')) { throw Error('eslint-config-prettier requires having prettier installed'); } } if ((0, _checkSetup.hasPackage)('eslint-plugin-react')) { config.rules['react/require-default-props'] = 0; config.rules['react/jsx-filename-extension'] = [2, { extensions: ['.js'] }]; if (!(0, _checkSetup.hasPackage)('eslint-config-airbnb')) { config.extends.push('plugin:react/recommended'); } if (!(0, _checkSetup.hasPackage)('react')) { throw Error('eslint-plugin-react requires having react installed'); } } if ((0, _checkSetup.hasPackage)('eslint-plugin-import')) { config.rules['import/prefer-default-export'] = 0; } if ((0, _checkSetup.hasPackage)('eslint-import-resolver-babel-module')) { config.settings['import/resolver'] = { 'babel-module': {} }; if (!(0, _checkSetup.hasPackage)('@babel/core')) { throw Error('eslint-import-resolver-babel-module requires having @babel/core installed'); } if (!(0, _checkSetup.hasPackage)('babel-plugin-module-resolver')) { throw Error('eslint-import-resolver-babel-module requires having babel-plugin-module-resolver installed'); } if (!(0, _checkSetup.hasPackage)('eslint-plugin-import')) { throw Error('eslint-import-resolver-babel-module requires having eslint-plugin-import installed'); } } if ((0, _checkSetup.hasPackage)('@babel/plugin-proposal-do-expressions') && !(0, _checkSetup.hasPackage)('babel-eslint')) { throw Error('@babel/plugin-proposal-do-expressions requires having babel-eslint installed'); } if ((0, _checkSetup.hasPackage)('@babel/plugin-proposal-nullish-coalescing-operator') && !(0, _checkSetup.hasPackage)('babel-eslint')) { throw Error('@babel/plugin-proposal-nullish-coalescing-operator requires having babel-eslint installed'); } if ((0, _checkSetup.hasPackage)('@babel/plugin-proposal-optional-chaining') && !(0, _checkSetup.hasPackage)('babel-eslint')) { throw Error('@babel/plugin-proposal-optional-chaining requires having babel-eslint installed'); } if ((0, _checkSetup.hasPackage)('@babel/plugin-proposal-pipeline-operator') && !(0, _checkSetup.hasPackage)('babel-eslint')) { throw Error('@babel/plugin-proposal-pipeline-operator requires having babel-eslint installed'); } if ((0, _checkSetup.hasPackage)('flow-bin') && !(0, _checkSetup.hasPackage)('babel-eslint')) { throw Error('flow-bin requires having babel-eslint installed'); } if ((0, _checkSetup.hasPackage)('babel-eslint')) { config.parser = 'babel-eslint'; } if ((0, _checkSetup.hasPackage)('react')) { config.parserOptions = { ecmaFeatures: { jsx: true } }; } module.exports = config;