From 13b7bf465bafeb3993c0f0221e7825853739fe46 Mon Sep 17 00:00:00 2001 From: cha0s Date: Fri, 1 Dec 2023 21:41:34 -0600 Subject: [PATCH] fix: eslint --- packages/core/src/server/build/eslint.config.js | 6 +++++- packages/core/src/server/commands.js | 4 +--- packages/core/src/server/index.js | 13 +++++++------ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/core/src/server/build/eslint.config.js b/packages/core/src/server/build/eslint.config.js index a246b8f..c94eacd 100644 --- a/packages/core/src/server/build/eslint.config.js +++ b/packages/core/src/server/build/eslint.config.js @@ -9,6 +9,7 @@ const {join} = require('path'); const D = require('../../debug'); const {default: Flecks} = require('../flecks'); +const R = require('../../require'); const debug = D('@flecks/core/server/build/eslint.config.js'); @@ -24,7 +25,10 @@ if (FLECKS_CORE_SYNC_FOR_ESLINT) { debug('bootstrapping flecks...'); const flecks = Flecks.bootstrap(); debug('bootstrapped'); - const eslintConfig = flecks.buildConfig('eslint.config.js', FLECKS_CORE_BUILD_TARGET); + const eslintConfigFn = R( + flecks.buildConfig('default.eslint.config.js', FLECKS_CORE_BUILD_TARGET), + ); + const eslintConfig = eslintConfigFn(flecks); const webpackConfig = flecks.buildConfig('webpack.config.js', FLECKS_CORE_BUILD_TARGET); eslintConfig.settings['import/resolver'].webpack = { config: { diff --git a/packages/core/src/server/commands.js b/packages/core/src/server/commands.js index b259086..b3b2a4b 100644 --- a/packages/core/src/server/commands.js +++ b/packages/core/src/server/commands.js @@ -113,9 +113,7 @@ export default (program, flecks) => { process.env.FLECKS_CORE_BUILD_TARGET = target; const cmd = [ 'npx', 'eslint', - '--config', flecks.buildConfig('.eslintrc.js', target), - '--format', 'codeframe', - '--ext', 'js', + '--config', flecks.buildConfig('eslint.config.js', target), '.', ]; promises.push(new Promise((resolve, reject) => { diff --git a/packages/core/src/server/index.js b/packages/core/src/server/index.js index 181bcdd..d2bd49f 100644 --- a/packages/core/src/server/index.js +++ b/packages/core/src/server/index.js @@ -4,8 +4,8 @@ import {inspect} from 'util'; import ESLintPlugin from 'eslint-webpack-plugin'; import webpack from 'webpack'; -import eslintConfigFn from './build/default.eslint.config'; import commands from './commands'; +import R from '../require'; const { FLECKS_CORE_ROOT = process.cwd(), @@ -43,7 +43,8 @@ export const hooks = { }), ); } - if (exclude.includes(target)) { + if (!exclude.includes(target)) { + const eslintConfigFn = R(flecks.buildConfig('default.eslint.config.js', target)); const eslint = eslintConfigFn(flecks); config.plugins.push( new ESLintPlugin({ @@ -55,9 +56,9 @@ export const hooks = { overrideConfig: { ...eslint, settings: { - ...(eslint.settings || {}), + ...eslint.settings, 'import/resolver': { - ...(eslint.settings['import/resolver'] || {}), + ...eslint.settings['import/resolver'], webpack: { config: { resolve: config.resolve, @@ -76,8 +77,8 @@ export const hooks = { */ 'babel.config.js', /** - * ESLint defaults. The default `eslint.config.js` just reads from this file so that the build - * process can dynamically configure parts of ESLint. + * ESLint defaults. The generated `eslint.config.js` just reads from this file so that the + * build can dynamically configure parts of ESLint. */ 'default.eslint.config.js', /**