Skip to content

Commit 77bb2d0

Browse files
committed
feat: expose 'builders' and tsProjects option from ESLint config
1 parent fd0b49f commit 77bb2d0

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

Diff for: src/config/eslintrc-react.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
const {buildConfig} = require('./helpers/eslint')
22

3-
module.exports = buildConfig({withReact: true})
3+
const defaultOptions = {withReact: true}
4+
5+
const defaultExport = buildConfig(defaultOptions)
6+
7+
defaultExport.buildConfig = options =>
8+
buildConfig({...defaultOptions, ...options})
9+
10+
module.exports = defaultExport

Diff for: src/config/eslintrc.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
const {buildConfig} = require('./helpers/eslint')
22

3-
module.exports = buildConfig()
3+
const defaultExport = buildConfig()
4+
5+
defaultExport.buildConfig = buildConfig
6+
7+
module.exports = defaultExport

Diff for: src/config/helpers/eslint.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ const parserRules = (typescript = false) => {
2222
}
2323
}
2424

25-
const buildConfig = ({withReact = false} = {}) => {
25+
const buildConfig = ({
26+
withReact = false,
27+
tsProjects = './**/*/tsconfig.json',
28+
} = {}) => {
2629
const ifReact = (t, f) => (withReact || hasReact ? t : f)
2730

2831
return {
@@ -56,7 +59,7 @@ const buildConfig = ({withReact = false} = {}) => {
5659
{
5760
files: ['**/*.ts?(x)'],
5861
parserOptions: {
59-
project: './**/*/tsconfig.json',
62+
project: tsProjects,
6063
},
6164
extends: [
6265
'plugin:@typescript-eslint/recommended-requiring-type-checking',

0 commit comments

Comments
 (0)