Skip to content

Commit 6fb9125

Browse files
authored
feat: Allow additional rules to be provided to the eslint config generator (#48)
1 parent 18b6391 commit 6fb9125

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

eslint/config.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ function compactObj(obj) {
2222
}
2323

2424
/***
25-
* @param {{ enableJest?: boolean, enableTypescript?: boolean, ignores?: string[] }} [options={}] - Options to customize the config
25+
* @param {{
26+
* enableJest?: boolean,
27+
* enableTypescript?: boolean,
28+
* ignores?: string[],
29+
* commonRules?: Readonly<import('eslint').Linter.RulesRecord>,
30+
* typescriptRules?: Readonly<import('eslint').Linter.RulesRecord>,
31+
* }} [options={}] - Options to customize the config
2632
* @returns {Promise<import('eslint').Linter.Config[]>}
2733
*/
2834
export async function generateEslintConfig(options = {}) {
@@ -46,6 +52,8 @@ export async function generateEslintConfig(options = {}) {
4652
'no-use-before-define': 'off',
4753
'no-warning-comments': ['error', { terms: ['nocommit', '@nocommit', '@no-commit'] }],
4854
// 'jest/no-mocks-import': 'off',
55+
56+
...(options.commonRules || {}),
4957
},
5058
}
5159

@@ -101,6 +109,8 @@ export async function generateEslintConfig(options = {}) {
101109
'@typescript-eslint/restrict-plus-operands': 0,
102110
'@typescript-eslint/no-redundant-type-constituents': 0,
103111
/** End 'recommended-requiring-type-checking' overrides */
112+
113+
...(options.typescriptRules || {}),
104114
},
105115
}
106116
: null,

0 commit comments

Comments
 (0)