fix: lint path resolution

This commit is contained in:
cha0s 2020-12-07 05:48:17 -06:00
parent a434670e5e
commit 96dd0fce9c
7 changed files with 105 additions and 29 deletions

View File

@ -13,6 +13,13 @@ const config = {
'padded-blocks': ['error', {classes: 'always'}],
yoda: 'off',
},
settings: {
'import/resolver': {
webpack: {
config: `${__dirname}/webpack.config.js`,
},
},
},
};
module.exports = config;

View File

@ -1,3 +1,5 @@
const neutrino = require('neutrino');
module.exports = neutrino().eslintrc();
process.env.LATUS_LINTING = true;
module.exports = neutrino(require('./.neutrinorc')).eslintrc();

View File

@ -24,6 +24,24 @@ module.exports = {
mocha(),
node(),
(neutrino) => {
neutrino.config.resolve.modules
.add(neutrino.options.source);
neutrino.config.resolve.modules
.add(`${neutrino.options.source}/../node_modules`);
if (process.env.LATUS_LINTING) {
return;
}
neutrino.config.module
.rule('compile')
.use('babel')
.get('options').plugins.push(
[
'babel-plugin-webpack-alias',
{
config: `${__dirname}/webpack.config.js`,
},
],
);
neutrino.config
.plugin('environment')
.use(EnvironmentPlugin, [{

View File

@ -22,6 +22,7 @@
"@latus/repl": "^1.0.0",
"@latus/socket": "^1.0.0",
"@latus/user": "^1.0.0",
"@reduxjs/toolkit": "^1.5.0",
"classnames": "^2.2.6",
"dotenv": "8.2.0",
"react-hot-loader": "4.13.0",
@ -35,6 +36,7 @@
"babel-plugin-webpack-alias": "^2.1.2",
"eslint": "^6",
"eslint-import-resolver-webpack": "^0.12.1",
"eslint-plugin-babel": "5.3.1",
"js-yaml": "3.14.0",
"neutrino": "^9.1.0",
"source-map-support": "0.5.19",

View File

@ -6,7 +6,12 @@ const {join} = require('path');
const {readConfig, Latus} = require('@latus/core');
const neutrino = require('neutrino');
module.exports = new Promise(async (resolve, reject) => {
if (process.env.LATUS_LINTING) {
// eslint-disable-next-line global-require
module.exports = neutrino(require('./.neutrinorc')).webpack();
}
else {
module.exports = new Promise((resolve, reject) => {
try {
const config = readConfig();
const paths = Object.entries(config).map(([plugin]) => {
@ -20,9 +25,11 @@ module.exports = new Promise(async (resolve, reject) => {
});
const latus = new Latus({
config,
// eslint-disable-next-line global-require, import/no-dynamic-require
modules: paths.map((path) => require(path)),
});
const configs = {
// eslint-disable-next-line global-require
app: require('./.neutrinorc'),
};
latus.invokeFlat('@latus/core/build', configs);
@ -32,4 +39,5 @@ module.exports = new Promise(async (resolve, reject) => {
catch (error) {
reject(error);
}
});
});
}

View File

@ -1170,6 +1170,16 @@
babel-merge "^3.0.0"
deepmerge "^1.5.2"
"@reduxjs/toolkit@^1.5.0":
version "1.5.0"
resolved "https://npm.i12e.cha0s.io/@reduxjs%2ftoolkit/-/toolkit-1.5.0.tgz#1025c1ccb224d1fc06d8d98a61f6717d57e6d477"
integrity sha512-E/FUraRx+8guw9Hlg/Ja8jI/hwCrmIKed8Annt9YsZw3BQp+F24t5I5b2OWR6pkEHY4hn1BgP08FrTZFRKsdaQ==
dependencies:
immer "^8.0.0"
redux "^4.0.0"
redux-thunk "^2.3.0"
reselect "^4.0.0"
"@types/anymatch@*":
version "1.3.1"
resolved "https://npm.i12e.cha0s.io/@types%2fanymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a"
@ -3310,7 +3320,7 @@ eslint-module-utils@^2.6.0:
debug "^2.6.9"
pkg-dir "^2.0.0"
eslint-plugin-babel@^5.3.1:
eslint-plugin-babel@5.3.1, eslint-plugin-babel@^5.3.1:
version "5.3.1"
resolved "https://npm.i12e.cha0s.io/eslint-plugin-babel/-/eslint-plugin-babel-5.3.1.tgz#75a2413ffbf17e7be57458301c60291f2cfbf560"
integrity sha512-VsQEr6NH3dj664+EyxJwO4FCYm/00JhYb3Sk3ft8o+fpKuIfQ9TaW6uVUfvwMXHcf/lsnRIoyFPsLMyiWCSL/g==
@ -4477,6 +4487,11 @@ ignore@^4.0.6:
resolved "https://npm.i12e.cha0s.io/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==
immer@^8.0.0:
version "8.0.0"
resolved "https://npm.i12e.cha0s.io/immer/-/immer-8.0.0.tgz#08763549ba9dd7d5e2eb4bec504a8315bd9440c2"
integrity sha512-jm87NNBAIG4fHwouilCHIecFXp5rMGkiFrAuhVO685UnMAlOneEAnOyzPt8OnP47TC11q/E7vpzZe0WvwepFTg==
import-cwd@^2.0.0:
version "2.1.0"
resolved "https://npm.i12e.cha0s.io/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9"
@ -6923,6 +6938,19 @@ redis@^3.0.0, redis@^3.0.2:
redis-errors "^1.2.0"
redis-parser "^3.0.0"
redux-thunk@^2.3.0:
version "2.3.0"
resolved "https://npm.i12e.cha0s.io/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622"
integrity sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw==
redux@^4.0.0:
version "4.0.5"
resolved "https://npm.i12e.cha0s.io/redux/-/redux-4.0.5.tgz#4db5de5816e17891de8a80c424232d06f051d93f"
integrity sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w==
dependencies:
loose-envify "^1.4.0"
symbol-observable "^1.2.0"
regenerate-unicode-properties@^8.2.0:
version "8.2.0"
resolved "https://npm.i12e.cha0s.io/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz#e5de7111d655e7ba60c057dbe9ff37c87e65cdec"
@ -7076,6 +7104,11 @@ requires-port@^1.0.0:
resolved "https://npm.i12e.cha0s.io/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
reselect@^4.0.0:
version "4.0.0"
resolved "https://npm.i12e.cha0s.io/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7"
integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==
resolve-cwd@^2.0.0:
version "2.0.0"
resolved "https://npm.i12e.cha0s.io/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a"
@ -7998,6 +8031,11 @@ supports-color@^7.1.0:
dependencies:
has-flag "^4.0.0"
symbol-observable@^1.2.0:
version "1.2.0"
resolved "https://npm.i12e.cha0s.io/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==
table@^5.2.3:
version "5.4.6"
resolved "https://npm.i12e.cha0s.io/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"

View File

@ -16,6 +16,7 @@
"chai": "4.2.0",
"eslint": "^7",
"eslint-import-resolver-webpack": "0.13.0",
"eslint-plugin-babel": "^5.3.1",
"lerna": "^3.22.1",
"mocha": "^8",
"neutrino": "^9.4.0",