From 97d90ee809d364ab25b13702a082dede75fb3ae3 Mon Sep 17 00:00:00 2001 From: cha0s Date: Wed, 31 Mar 2021 10:35:43 -0500 Subject: [PATCH] fix: work around ljharb's ignorance --- packages/build/package.json | 1 + packages/build/src/build/.eslint.defaults.js | 3 +++ packages/build/src/build/.neutrinorc.js | 20 ++++++++++++++------ packages/core/src/build.js | 8 +++++++- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/packages/build/package.json b/packages/build/package.json index f394335..109163f 100644 --- a/packages/build/package.json +++ b/packages/build/package.json @@ -25,6 +25,7 @@ ], "dependencies": { "@babel/eslint-parser": "^7.13.10", + "@babel/eslint-plugin": "^7.13.10", "@babel/parser": "^7.13.12", "@babel/plugin-proposal-class-properties": "^7.12.13", "@babel/plugin-proposal-optional-chaining": "^7.12.16", diff --git a/packages/build/src/build/.eslint.defaults.js b/packages/build/src/build/.eslint.defaults.js index cc759ee..5216ef8 100644 --- a/packages/build/src/build/.eslint.defaults.js +++ b/packages/build/src/build/.eslint.defaults.js @@ -20,6 +20,9 @@ const config = { configFile: LATUS_BABEL_CONFIG, }, }, + plugins: [ + '@babel', + ], rules: { 'babel/object-curly-spacing': 'off', 'brace-style': ['error', 'stroustrup'], diff --git a/packages/build/src/build/.neutrinorc.js b/packages/build/src/build/.neutrinorc.js index 3457ea5..04b0c3e 100644 --- a/packages/build/src/build/.neutrinorc.js +++ b/packages/build/src/build/.neutrinorc.js @@ -11,12 +11,20 @@ const { module.exports = { options: {}, use: [ - airbnb({ - eslint: { - cache: false, - baseConfig: require(LATUS_ESLINT_DEFAULTS), - }, - }), + (neutrino) => { + const baseConfig = require(LATUS_ESLINT_DEFAULTS); + const {peerDependencies = {}} = neutrino.options.packageJson; + const peerPaths = Object.keys(peerDependencies); + if (peerPaths.length > 0) { + baseConfig.rules['import/no-unresolved'] = ['error', {ignore: peerPaths}]; + } + airbnb({ + eslint: { + cache: false, + baseConfig, + }, + })(neutrino); + }, react(), library(), mocha(), diff --git a/packages/core/src/build.js b/packages/core/src/build.js index a0527f4..4179e79 100644 --- a/packages/core/src/build.js +++ b/packages/core/src/build.js @@ -18,10 +18,16 @@ const { export default (latus) => (neutrino) => { const airbnb = R('@neutrinojs/airbnb'); + const baseConfig = R(LATUS_ESLINT_DEFAULTS); + const {peerDependencies = {}} = neutrino.options.packageJson; + const peerPaths = Object.keys(peerDependencies); + if (peerPaths.length > 0) { + baseConfig.rules['import/no-unresolved'] = ['error', {ignore: peerPaths}]; + } airbnb({ eslint: { cache: false, - baseConfig: R(LATUS_ESLINT_DEFAULTS), + baseConfig, }, })(neutrino); const clean = R('@neutrinojs/clean');