Skip to content

Commit

Permalink
feat(create-config-mdx): add files prop on createConfigMdx
Browse files Browse the repository at this point in the history
  • Loading branch information
andrefelipeschulle committed Nov 27, 2024
1 parent 326d0f0 commit ae70dc2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-eyes-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@brainylab/eslint-config-mdx': patch
---

add files prop on createConfigMdx
42 changes: 25 additions & 17 deletions packages/mdx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,31 @@ import * as mdxEslint from 'eslint-plugin-mdx';

import type { FlatESLintConfig } from 'eslint-define-config';

export const mdxConfig = [
{
files: ['**/*.mdx'],
...mdxEslint.flat,
processor: mdxEslint.createRemarkProcessor({
lintCodeBlocks: true,
languageMapper: {},
}),
},
{
...mdxEslint.flatCodeBlocks,
rules: {
...mdxEslint.flatCodeBlocks.rules,
'no-var': 'error',
'prefer-const': 'error',
type MDXConfig = {
files?: string[];
};

export const createMdxConfig = (props?: MDXConfig) => {
return [
{
...props?.files,
...mdxEslint.flat,
processor: mdxEslint.createRemarkProcessor({
lintCodeBlocks: true,
languageMapper: {},
}),
},
{
...mdxEslint.flatCodeBlocks,
rules: {
...mdxEslint.flatCodeBlocks.rules,
'no-var': 'error',
'prefer-const': 'error',
},
},
},
] as FlatESLintConfig[];
] as FlatESLintConfig[];
};

export const mdxConfig = createMdxConfig();

export default mdxConfig;
2 changes: 1 addition & 1 deletion packages/mdx/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['src/index.ts'],
clean: true,
target: 'es2019',
target: 'es2020',
format: ['esm'],
});

0 comments on commit ae70dc2

Please sign in to comment.