Skip to content

Commit

Permalink
feat(ts): can change tsconfig by env
Browse files Browse the repository at this point in the history
  • Loading branch information
zanminkian committed Dec 2, 2022
1 parent fce5e8d commit c8a9c5e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const fs = require('fs')
const { join } = require('path')
const basic = require('@antfu/eslint-config-basic')

const tsconfig = process.env['ESLINT_TSCONFIG'] || 'tsconfig.eslint.json'

module.exports = {
extends: [
'@antfu/eslint-config-basic',
Expand All @@ -14,12 +16,12 @@ module.exports = {
},
},
overrides: basic.overrides.concat(
!fs.existsSync(join(process.cwd(), 'tsconfig.eslint.json'))
!fs.existsSync(join(process.cwd(), tsconfig))
? []
: [{
parserOptions: {
tsconfigRootDir: process.cwd(),
project: ['tsconfig.eslint.json'],
project: [tsconfig],
},
parser: '@typescript-eslint/parser',
excludedFiles: ['**/*.md/*.*'],
Expand Down

0 comments on commit c8a9c5e

Please sign in to comment.