-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Support #90
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well on my sample Typescript project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this and after fighting with the example site a little seems to be working great compiling TS no problem :D
@jrmd have there been any issues around the example site that need looking into? |
@ampersarnie the |
That's being tracked in #92 |
Description
Resolves #78 - As Big Bite begin moving towards utilising TypeScript further across the board, we need a TS solution that works with our existing build system. This introduces a number of challenges around creating an accessible and common setup amongs all users of the build-tools that works seemlessly not only with the existing setup, but also the existing workflow across local development, CI/CD and other processes. This PR aims to achieve this by providing a default and bundled TypeScript configuration that acts as a common default amongs any TypeScript code that is written within Big Bite that belongs to a WordPress project.
TypeScript Default Config and Rules
The aim for bundling the config was to provide a sane setup for each developer that is working within TypeScript that will also provide consistency across all projects that utilise it.
The configuration for TypeScript can be found in the
configs/tsconfig.json
file.There are also some image definition types that can be found in the
configs/tsconfig/images.d.ts
file.An addition of TypeScript ESLint has also been included to ensure that we've support for ESLint within our builds.
Project
tsconfig.json
As part of the aim is to provide a bundled configuration file, the
tsconfig.json
is defined within the project and can be found amongs other related configuration files within the/configs
directory. The config file aims to provide a sane standard as recommended in the issue comment here.To ensure the config file is visible by IDEs and any other related software for error and syntax highlighting, you need to define and extend the
tsconfig.json
within the root of your project.Customising
tsconfig.json
There are a number of situations where you may need to customise or extend the
tsconfig.json
. This can be easily achieved by utilising theextends
property and pointing to the build-tools config to use as the base.Please note that extending has additional effects when implementing
include
andexclude
. Read the documentation forextends
here.Alternatively, if you need an entirely different
tsconfig.json
than the one that is provided, atsconfig.json
that is placed in the root of the project will be picket up by the build-tools, whether it is extended or not.Installing from branch
If you want to test this branch, you can install to your plugin with the following:
npm i "https://github.com/bigbite/build-tools#feature/typescript-support"
Change Log
ts-loader
anddts-loader
to webpack rules..ts
and.tsx
file extensions to all issuers and required extension references.test-plugin
example to include some types.@typescript-eslint
parser, plugin and recommended rules.tsconfig.json