From 03cf334e3b8568ac1c1f8336d71fd95f899b0815 Mon Sep 17 00:00:00 2001 From: Jarrod Mosen Date: Tue, 18 Jul 2017 12:19:17 +1200 Subject: [PATCH] More housekeeping --- .gitignore | 4 ++ README.md | 25 ++++------ package-lock.json | 120 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 4 files changed, 135 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 641def5..7198199 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,7 @@ lib nbproject .idea .node_history + +# These should only be in ./src +/tsconfig.json +/preact.config.js diff --git a/README.md b/README.md index 47e650b..ac5a491 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,9 @@ # preact-cli-plugin-typescript · [![Travis Status](https://img.shields.io/travis/wub/preact-cli-plugin-typescript/master.svg?label=travis&maxAge=43200)](https://travis-ci.org/wub/preact-cli-plugin-typescript) [![npm version](https://img.shields.io/npm/v/preact-cli-plugin-typescript.svg)](https://www.npmjs.com/package/preact-cli-plugin-typescript) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) -Use TypeScript with [Preact CLI](https://github.com/developit/preact-cli). +Use TypeScript with [preact-cli](https://github.com/developit/preact-cli). -This will install: - - - [typescript](https://github.com/Microsoft/TypeScript) - - [awesome-typescript-loader](https://github.com/s-panferov/awesome-typescript-loader) - -In the future, you'll be able to choose between `awesome-typescript-loader` -and `ts-loader`. +This will install [typescript](https://github.com/Microsoft/TypeScript) +and [awesome-typescript-loader](https://github.com/s-panferov/awesome-typescript-loader). If you prefer Flow, check out [preact-cli-plugin-flow](https://github.com/SaraVieira/preact-cli-plugin-flow). @@ -23,18 +18,18 @@ npm i preact-cli-plugin-typescript --save-dev After installation, this plugin will create a `tsconfig.json` (TypeScript configuration file), and `preact.config.js`, if they don't exist already. -## Usage - In the root of your project, edit `preact.config.js` to add the plugin: ```js -import preactCliTypeScript from 'preact-cli-plugin-typescript'; +import preactCliTypeScript from 'preact-cli-plugin-typescript' -export default function (config) { - preactCliTypeScript(config); +export default function(config) { + preactCliTypeScript(config) } ``` +## Usage + If you have an existing `tsconfig.json` file, be sure to use the correct JSX factory: @@ -48,9 +43,9 @@ JSX factory: ``` Now you can simply add `.ts`/`.tsx` files to your project, and they'll -be compiled. Cool. +be compiled. Cool. Make sure you use `.tsx` if you want to use JSX. -If you want to incrementally move to TypeScript, be sure to enable `allowJs` +If you want to incrementally move to TypeScript, enable `allowJs` in your `tsconfig.json`: ```json diff --git a/package-lock.json b/package-lock.json index d7bb4e1..fb68596 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,16 @@ } } }, + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "dev": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, "ajv-keywords": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", @@ -914,6 +924,63 @@ "estraverse": "4.2.0" } }, + "eslint": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", + "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", + "dev": true, + "requires": { + "babel-code-frame": "6.22.0", + "chalk": "1.1.3", + "concat-stream": "1.6.0", + "debug": "2.6.8", + "doctrine": "2.0.0", + "escope": "3.6.0", + "espree": "3.4.3", + "esquery": "1.0.0", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "glob": "7.1.1", + "globals": "9.18.0", + "ignore": "3.3.3", + "imurmurhash": "0.1.4", + "inquirer": "0.12.0", + "is-my-json-valid": "2.16.0", + "is-resolvable": "1.0.0", + "js-yaml": "3.9.0", + "json-stable-stringify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "1.2.1", + "progress": "1.1.8", + "require-uncached": "1.0.3", + "shelljs": "0.7.8", + "strip-bom": "3.0.0", + "strip-json-comments": "2.0.1", + "table": "3.8.3", + "text-table": "0.2.0", + "user-home": "2.0.0" + }, + "dependencies": { + "pluralize": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", + "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", + "dev": true + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, "eslint-config-standard": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-10.2.1.tgz", @@ -2944,6 +3011,12 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" }, + "progress": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "dev": true + }, "promisify-event": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/promisify-event/-/promisify-event-1.0.0.tgz", @@ -3670,6 +3743,53 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "table": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", + "dev": true, + "requires": { + "ajv": "4.11.8", + "ajv-keywords": "1.5.1", + "chalk": "1.1.3", + "lodash": "4.17.4", + "slice-ansi": "0.0.4", + "string-width": "2.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.0.tgz", + "integrity": "sha1-AwZkVh/BRslCPsfZeP4kV0N/5tA=", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, "tapable": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.6.tgz", diff --git a/package.json b/package.json index 45615ae..78b9833 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "typescript": "^2.4.1" }, "devDependencies": { + "eslint": "^3.19.0", "publish-please": "^2.3.1", "standard": "^10.0.2" }