How to use the tsconfig.json function in tsconfig

To help you get started, we’ve selected a few tsconfig examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xlayers / xlayers / src / app / editor / code / exports / stackblitz / stackblitz.stencil.service.ts View on Github external
"dist/"
  ],
  "scripts": {
    "build": "npx stencil build --docs",
    "start": "npx stencil build",
    "test": "npx stencil test --spec --e2e",
    "test.watch": "npx stencil test --spec --e2e --watchAll"
  },
  "dependencies": {},
  "devDependencies": {
    "@stencil/core": "~0.15.2"
  },
  "license": "MIT"
}`;
    // add extra files
    files['tsconfig.json'] = `\
{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "allowUnreachableCode": false,
    "declaration": false,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2017"
    ],
    "moduleResolution": "node",
    "module": "esnext",
    "target": "es2017",
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "jsx": "react",
github vuejs / vue-cli / packages / @vue / cli-plugin-typescript / __tests__ / tsGenerator.spec.js View on Github external
test('tsconfig.json should be valid json', async () => {
  const { files } = await generateWithPlugin([
    {
      id: 'ts',
      apply: require('../generator'),
      options: {}
    }
  ])
  expect(() => {
    JSON.parse(files['tsconfig.json'])
  }).not.toThrow()
  expect(files['tsconfig.json']).not.toMatch('"  ')
})
github vuejs / vue-cli / packages / @vue / cli-plugin-typescript / __tests__ / tsGenerator.spec.js View on Github external
apply: require('@vue/cli-plugin-unit-jest/generator'),
      options: {}
    },
    {
      id: '@vue/cli-plugin-typescript',
      apply: require('../generator'),
      options: {
        lint: true,
        lintOn: ['save', 'commit']
      }
    }
  ])

  expect(pkg.devDependencies).toHaveProperty('@types/jest')

  expect(files['tsconfig.json']).not.toMatch('"  ')
})
github kazupon / vue-cli-plugin-i18n / generator / index.js View on Github external
api.postProcessFiles(files => {
    debug('postProcessFiles called')
    if (!api.hasPlugin('typescript')) { return }
    const tsConfigRaw = files['tsconfig.json']
    if (!tsConfigRaw) { return }
    const tsConfig = JSON.parse(tsConfigRaw)
    tsConfig.compilerOptions.types.push('webpack')
    tsConfig.compilerOptions.types.push('webpack-env')
    files['tsconfig.json'] = JSON.stringify(tsConfig, null, 2)
  })
}
github ggoodman / plunker-run-plugin / adapters / transformers / typescript.js View on Github external
transform: function (context) {
    var options = _.defaults({}, context.compileOptions, defaultCompileOptions);
    
    var tsconfig = context.preview.files['tsconfig.json'];
    
    if (typeof tsconfig !== 'undefined') {
      try {
        tsconfig = JSON.parse(tsconfig);
        
        _.extend(options, tsconfig.compilerOptions);
      } catch (__) {}
    }
    
    context.preview.files[context.requestPath] = '';
    
    var compilerHost = {
      getSourceFile: function (filename) {
        return Typescript.createSourceFile(filename, context.preview.files[filename], options.target);
      },
      writeFile: function (filename, text) {
github vuejs / vue-cli / packages / @vue / cli-plugin-unit-jest / generator / index.js View on Github external
api.render(files => {
      const tsconfig = files['tsconfig.json']
      if (tsconfig) {
        const parsed = JSON.parse(tsconfig)
        if (
          parsed.compilerOptions.types &&
          !parsed.compilerOptions.types.includes('jest')
        ) {
          parsed.compilerOptions.types.push('jest')
        }
        files['tsconfig.json'] = JSON.stringify(parsed, null, 2)
      }
    })
  }
github kazupon / vue-cli-plugin-i18n / generator / index.js View on Github external
api.postProcessFiles(files => {
    debug('postProcessFiles called')
    if (!api.hasPlugin('typescript')) { return }
    const tsConfigRaw = files['tsconfig.json']
    if (!tsConfigRaw) { return }
    const tsConfig = JSON.parse(tsConfigRaw)
    tsConfig.compilerOptions.types.push('webpack')
    tsConfig.compilerOptions.types.push('webpack-env')
    files['tsconfig.json'] = JSON.stringify(tsConfig, null, 2)
  })
}
github vuejs / vue-cli / packages / @vue / cli-plugin-unit-mocha / generator / index.js View on Github external
api.render(files => {
      const tsconfig = files['tsconfig.json']
      if (tsconfig) {
        const parsed = JSON.parse(tsconfig)
        const types = parsed.compilerOptions.types
        if (types) {
          if (!types.includes('mocha')) {
            types.push('mocha')
          }
          if (!types.includes('chai')) {
            types.push('chai')
          }
        }
        files['tsconfig.json'] = JSON.stringify(parsed, null, 2)
      }
    })
  }
github vuejs / vue-cli / packages / @vue / cli-plugin-unit-mocha / generator / index.js View on Github external
api.render(files => {
      const tsconfig = files['tsconfig.json']
      if (tsconfig) {
        const parsed = JSON.parse(tsconfig)
        const types = parsed.compilerOptions.types
        if (types) {
          if (!types.includes('mocha')) {
            types.push('mocha')
          }
          if (!types.includes('chai')) {
            types.push('chai')
          }
        }
        files['tsconfig.json'] = JSON.stringify(parsed, null, 2)
      }
    })
  }
github vuejs / vue-cli / packages / @vue / cli-plugin-unit-jest / generator / index.js View on Github external
api.render(files => {
      const tsconfig = files['tsconfig.json']
      if (tsconfig) {
        const parsed = JSON.parse(tsconfig)
        if (
          parsed.compilerOptions.types &&
          !parsed.compilerOptions.types.includes('jest')
        ) {
          parsed.compilerOptions.types.push('jest')
        }
        files['tsconfig.json'] = JSON.stringify(parsed, null, 2)
      }
    })
  }

tsconfig

Resole and parse `tsconfig.json`, replicating to TypeScript's behaviour

MIT
Latest version published 7 years ago

Package Health Score

71 / 100
Full package analysis