Skip to content

Commit

Permalink
feat(utils): COMPILER_OPTIONS
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Feb 6, 2023
1 parent 64cfb1a commit def90ca
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@
],
"vsicons.associations.folders": [
{
"extensions": ["__fixtures__"],
"extensions": ["__fixtures__", "__tests__/baselines"],
"format": "svg",
"icon": "data"
"icon": "db"
},
{
"extensions": ["__snapshots__"],
Expand Down
121 changes: 121 additions & 0 deletions __tests__/baselines/compiler-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/**
* @file Test Baselines - COMPILER_OPTIONS
* @module tests/baselines/COMPILER_OPTIONS
*/

export default [
'allowArbitraryExtensions',
'allowImportingTsExtensions',
'allowJs',
'allowSyntheticDefaultImports',
'allowUmdGlobalAccess',
'allowUnreachableCode',
'allowUnusedLabels',
'alwaysStrict',
'assumeChangesOnlyAffectDirectDependencies',
'baseUrl',
'charset',
'checkJs',
'composite',
'customConditions',
'declaration',
'declarationDir',
'declarationMap',
'diagnostics',
'disableReferencedProjectLoad',
'disableSizeLimit',
'disableSolutionSearching',
'disableSourceOfProjectReferenceRedirect',
'downlevelIteration',
'emitBOM',
'emitDeclarationOnly',
'emitDecoratorMetadata',
'esModuleInterop',
'exactOptionalPropertyTypes',
'experimentalDecorators',
'explainFiles',
'extendedDiagnostics',
'fallbackPolling',
'forceConsistentCasingInFileNames',
'generateCpuProfile',
'ignoreDeprecations',
'importHelpers',
'importsNotUsedAsValues',
'incremental',
'inlineSourceMap',
'inlineSources',
'isolatedModules',
'jsx',
'jsxFactory',
'jsxFragmentFactory',
'jsxImportSource',
'keyofStringsOnly',
'lib',
'listEmittedFiles',
'listFiles',
'listFilesOnly',
'mapRoot',
'maxNodeModuleJsDepth',
'module',
'moduleDetection',
'moduleResolution',
'moduleSuffixes',
'newLine',
'noEmit',
'noEmitHelpers',
'noEmitOnError',
'noErrorTruncation',
'noFallthroughCasesInSwitch',
'noImplicitAny',
'noImplicitOverride',
'noImplicitReturns',
'noImplicitThis',
'noImplicitUseStrict',
'noLib',
'noPropertyAccessFromIndexSignature',
'noResolve',
'noStrictGenericChecks',
'noUncheckedIndexedAccess',
'noUnusedLocals',
'noUnusedParameters',
'out',
'outDir',
'outFile',
'paths',
'plugins',
'preserveConstEnums',
'preserveSymlinks',
'preserveValueImports',
'preserveWatchOutput',
'pretty',
'reactNamespace',
'removeComments',
'resolveJsonModule',
'resolvePackageJsonExports',
'resolvePackageJsonImports',
'rootDir',
'rootDirs',
'skipDefaultLibCheck',
'skipLibCheck',
'sourceMap',
'sourceRoot',
'strict',
'strictBindCallApply',
'strictFunctionTypes',
'strictNullChecks',
'strictPropertyInitialization',
'stripInternal',
'suppressExcessPropertyErrors',
'suppressImplicitAnyIndexErrors',
'target',
'traceResolution',
'tsBuildInfoFile',
'typeRoots',
'types',
'useDefineForClassFields',
'useUnknownInCatchVariables',
'verbatimModuleSyntax',
'watch',
'watchDirectory',
'watchFile'
] as const
13 changes: 13 additions & 0 deletions src/utils/__tests__/compiler-options.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @file Type Tests - COMPILER_OPTIONS
* @module tsconfig-utils/utils/tests/unit-d/COMPILER_OPTIONS
*/

import type { CompilerOption } from '@flex-development/tsconfig-types'
import type TEST_SUBJECT from '../compiler-options'

describe('unit-d:utils/COMPILER_OPTIONS', () => {
it('should equal type of Set<CompilerOption>', () => {
expectTypeOf<typeof TEST_SUBJECT>().toEqualTypeOf<Set<CompilerOption>>()
})
})
17 changes: 17 additions & 0 deletions src/utils/__tests__/compiler-options.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @file Unit Tests - COMPILER_OPTIONS
* @module tsconfig-utils/utils/tests/unit/COMPILER_OPTIONS
*/

import BASELINE from '#tests/baselines/compiler-options'
import TEST_SUBJECT from '../compiler-options'

describe('unit:utils/COMPILER_OPTIONS', () => {
it('should be instance of Set', () => {
expect(TEST_SUBJECT).to.be.instanceof(Set)
})

it('should contain compiler option names', () => {
expect([...TEST_SUBJECT]).to.deep.equal(BASELINE)
})
})
130 changes: 130 additions & 0 deletions src/utils/compiler-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/**
* @file Utilities - COMPILER_OPTIONS
* @module tsconfig-utils/utils/COMPILER_OPTIONS
*/

import type { CompilerOption } from '@flex-development/tsconfig-types'

/**
* Compiler option names.
*
* @const {Set<CompilerOption>} COMPILER_OPTIONS
*/
const COMPILER_OPTIONS: Set<CompilerOption> = new Set<CompilerOption>([
'allowArbitraryExtensions',
'allowImportingTsExtensions',
'allowJs',
'allowSyntheticDefaultImports',
'allowUmdGlobalAccess',
'allowUnreachableCode',
'allowUnusedLabels',
'alwaysStrict',
'assumeChangesOnlyAffectDirectDependencies',
'baseUrl',
'charset',
'checkJs',
'composite',
'customConditions',
'declaration',
'declarationDir',
'declarationMap',
'diagnostics',
'disableReferencedProjectLoad',
'disableSizeLimit',
'disableSolutionSearching',
'disableSourceOfProjectReferenceRedirect',
'downlevelIteration',
'emitBOM',
'emitDeclarationOnly',
'emitDecoratorMetadata',
'esModuleInterop',
'exactOptionalPropertyTypes',
'experimentalDecorators',
'explainFiles',
'extendedDiagnostics',
'fallbackPolling',
'forceConsistentCasingInFileNames',
'generateCpuProfile',
'ignoreDeprecations',
'importHelpers',
'importsNotUsedAsValues',
'incremental',
'inlineSourceMap',
'inlineSources',
'isolatedModules',
'jsx',
'jsxFactory',
'jsxFragmentFactory',
'jsxImportSource',
'keyofStringsOnly',
'lib',
'listEmittedFiles',
'listFiles',
'listFilesOnly',
'mapRoot',
'maxNodeModuleJsDepth',
'module',
'moduleDetection',
'moduleResolution',
'moduleSuffixes',
'newLine',
'noEmit',
'noEmitHelpers',
'noEmitOnError',
'noErrorTruncation',
'noFallthroughCasesInSwitch',
'noImplicitAny',
'noImplicitOverride',
'noImplicitReturns',
'noImplicitThis',
'noImplicitUseStrict',
'noLib',
'noPropertyAccessFromIndexSignature',
'noResolve',
'noStrictGenericChecks',
'noUncheckedIndexedAccess',
'noUnusedLocals',
'noUnusedParameters',
'out',
'outDir',
'outFile',
'paths',
'plugins',
'preserveConstEnums',
'preserveSymlinks',
'preserveValueImports',
'preserveWatchOutput',
'pretty',
'reactNamespace',
'removeComments',
'resolveJsonModule',
'resolvePackageJsonExports',
'resolvePackageJsonImports',
'rootDir',
'rootDirs',
'skipDefaultLibCheck',
'skipLibCheck',
'sourceMap',
'sourceRoot',
'strict',
'strictBindCallApply',
'strictFunctionTypes',
'strictNullChecks',
'strictPropertyInitialization',
'stripInternal',
'suppressExcessPropertyErrors',
'suppressImplicitAnyIndexErrors',
'target',
'traceResolution',
'tsBuildInfoFile',
'typeRoots',
'types',
'useDefineForClassFields',
'useUnknownInCatchVariables',
'verbatimModuleSyntax',
'watch',
'watchDirectory',
'watchFile'
])

export default COMPILER_OPTIONS
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @module tsconfig-utils/utils
*/

export { default as COMPILER_OPTIONS } from './compiler-options'
export { default as loadCompilerOptions } from './load-compiler-options'
export { default as loadLibConfig } from './load-lib-config'
export { default as loadPathAliases } from './load-path-aliases'
Expand Down

0 comments on commit def90ca

Please sign in to comment.