commit 36f546aefae3297ee5bba327339b164c82e9a252 Author: David Wheatley Date: Wed May 12 00:28:24 2021 +0100 Initial commit diff --git a/js-packages/tsconfig/.gitattributes b/js-packages/tsconfig/.gitattributes new file mode 100644 index 000000000..2828cc899 --- /dev/null +++ b/js-packages/tsconfig/.gitattributes @@ -0,0 +1,16 @@ +.gitattributes export-ignore +.gitignore export-ignore +.gitmodules export-ignore +.github export-ignore +.travis export-ignore +.travis.yml export-ignore +.editorconfig export-ignore +.styleci.yml export-ignore + +phpunit.xml export-ignore +tests export-ignore + +js/dist/* -diff +js/dist/* linguist-generated + +* text=auto eol=lf diff --git a/js-packages/tsconfig/.gitignore b/js-packages/tsconfig/.gitignore new file mode 100644 index 000000000..274ea7ac1 --- /dev/null +++ b/js-packages/tsconfig/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +Thumbs.db +.idea/* +.vscode diff --git a/js-packages/tsconfig/README.md b/js-packages/tsconfig/README.md new file mode 100644 index 000000000..72ccd7927 --- /dev/null +++ b/js-packages/tsconfig/README.md @@ -0,0 +1,29 @@ +# Flarum Typescript Config + +A standardised `tsconfig.json` for use in Typescript Flarum extensions. + +## Usage + +You'll need to configure a `tsconfig.json` file to ensure your IDE sets up Typescript support correctly. + +You need to install this package as a dev dependency: + +```properties +npm install --save-dev flarum-tsconfig +yarn add --dev flarum-tsconfig +``` + +A baseline `tsconfig.json` is provided below that you can modify as needed. This file needs to be copied into your extension's `js` folder for your IDE to apply the correct settings. + +```jsonc +{ + // Use Flarum's tsconfig as a starting point + "extends": "flarum-tsconfig", + // This will match all .ts, .tsx, .d.ts, .js, .jsx files + "includes": ["src/**/*"], + "compilerOptions": { + // This will output typings to `dist-typings` + "declarationDir": "./dist-typings" + } +} +``` diff --git a/js-packages/tsconfig/package.json b/js-packages/tsconfig/package.json new file mode 100644 index 000000000..fadaff723 --- /dev/null +++ b/js-packages/tsconfig/package.json @@ -0,0 +1,9 @@ +{ + "name": "flarum-tsconfig", + "version": "0.1.0-beta.16", + "description": "Flarum's official Typescript config file", + "main": "tsconfig.json", + "repository": "https://github.com/flarum/flarum-tsconfig", + "author": "Flarum Team", + "license": "MIT" +} diff --git a/js-packages/tsconfig/tsconfig.json b/js-packages/tsconfig/tsconfig.json new file mode 100644 index 000000000..97d92a54e --- /dev/null +++ b/js-packages/tsconfig/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "allowUmdGlobalAccess": true, + "sourceMap": true, + "strict": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "declaration": true, + "emitDeclarationOnly": true, + "module": "es2015", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "esModuleInterop": true, + "moduleResolution": "Node", + "target": "es6", + "jsx": "preserve", + "allowJs": true, + "lib": ["es2015", "es2017", "dom"], + "allowSyntheticDefaultImports": true + } +}