Skip to content

JsonConfigParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/config-docs/json-config.parser.ts

JSON Config Parser implementation

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(_config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • JsonConfigParser stops the work with an early return when fileName === 'package.json'.
  • JsonConfigParser stops the work with an early return when fileName.startsWith('tsconfig') || parsed['compilerOptions'].
  • JsonConfigParser stops the work with an early return when fileName.includes('eslint') || parsed['rules'] || parsed['extends'].
  • JsonConfigParser stops the work with an early return when fileName.includes('prettier').
  • JsonConfigParser stops the work with an early return when fileName.includes('jest') || parsed['testEnvironment'] || parsed['testMatch'].
  • JsonConfigParser stops the work with an early return when fileName.includes('babel') || parsed['presets'] || parsed['plugins'].

When something fails

  • JsonConfigParser handles failure in 1 place: it turns it into a return value in all 1.

Was this page helpful?

Download as PDF