Skip to content

Commit

Permalink
fix: Add ignores param to config
Browse files Browse the repository at this point in the history
  • Loading branch information
burtek committed Sep 6, 2024
1 parent 19ed815 commit 4470238
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion configs/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const allImportExtensions = ['.js', '.cjs', '.mjs', '.jsx', '.ts', '.cts', '.mts
export function prepareConfig() {
return tseslint.config(
{ plugins: { '@stylistic': /** @type {Pick<typeof stylisticPlugin, 'rules'>} */(stylisticPlugin) } },
{ ignores: ['node_modules/', 'dist/', 'coverage/', '.vercel/'] },
{
name: 'dtrw:base:base',
files: allFiles,
Expand Down
6 changes: 4 additions & 2 deletions configs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ export const configs = {
/**
* Creates eslint flat config based on provided configuration object.
*
* @param {{ [K in Exclude<keyof typeof configs, 'base'>]?: Config<K> | true }} [providedConfigs]
* @param {{ [K in Exclude<keyof typeof configs, 'base'>]?: Config<K> | true }} [providedConfigs] configs to enable with optional parameters
* @param {string[]} [ignores] ignores config pattern, defaults to `['node_modules/', 'dist/', 'coverage/', '.vercel/']`
* @returns
*/
export async function prepareConfig(providedConfigs = {}) {
export async function prepareConfig(providedConfigs = {}, ignores = ['node_modules/', 'dist/', 'coverage/', '.vercel/']) {
/** @type {{ [K in keyof typeof configs]?: Config<K> | true }} */
const config = { ...providedConfigs, base: true };
const configKeys = /** @type {Array<keyof typeof configs>} */(Object.keys(configs));
Expand All @@ -56,6 +57,7 @@ export async function prepareConfig(providedConfigs = {}) {
}

return tseslint.config(
{ ignores },
...base(),
...(await Promise.all(configKeys.map(mapConfig))).flatMap(x => x)
);
Expand Down

0 comments on commit 4470238

Please sign in to comment.