Skip to content

Commit

Permalink
fix(markdown): override default rules
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 3, 2024
1 parent 98d7b04 commit 4765dd5
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions src/eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ export default function unjsPreset(
...(tseslint.configs.recommended as Linter.FlatConfig[]),
// https://github.com/sindresorhus/eslint-plugin-unicorn
eslintPluginUnicorn.configs["flat/recommended"] as Linter.FlatConfig,

// Preset overrides
{ rules: rules as Linter.RulesRecord },
{
languageOptions: {
globals: Object.fromEntries(
Object.keys(globals).flatMap((group) =>
Object.keys(globals[group as keyof typeof globals]).map((k) => [
k,
true,
]),
),
),
},
},
{ ignores: ["dist", "coverage", ...(config.ignores || [])] },

// Markdown
// https://www.npmjs.com/package/eslint-plugin-markdown
config.markdown !== false && { plugins: { markdown } },
config.markdown !== false && {
Expand All @@ -68,24 +86,12 @@ export default function unjsPreset(
"padded-blocks": 0,
"@typescript-eslint/no-unused-vars": 0,
"no-empty-pattern": 0,
"no-redeclare": 0,
"no-import-assign": 0,
...config.markdown?.rules,
}) as any,
},
// Preset overrides
{ rules: rules as Linter.RulesRecord },
{
languageOptions: {
globals: Object.fromEntries(
Object.keys(globals).flatMap((group) =>
Object.keys(globals[group as keyof typeof globals]).map((k) => [
k,
true,
]),
),
),
},
},
{ ignores: ["dist", "coverage", ...(config.ignores || [])] },

// User overrides
...(userConfigs as Linter.FlatConfig[]),
].filter(Boolean) as Linter.FlatConfig[];
Expand Down

0 comments on commit 4765dd5

Please sign in to comment.