Justin Fagnani 7b6b9cf0b4 Add ESLint (#3)
2019-12-18 11:35:37 -08:00
2019-12-17 14:38:02 -08:00
2019-12-18 11:35:37 -08:00
2019-12-18 11:35:37 -08:00
2019-12-17 18:54:23 -08:00
2019-12-17 18:54:23 -08:00
2019-12-17 14:38:02 -08:00
2019-12-18 11:35:37 -08:00
2019-12-18 11:35:37 -08:00
2019-12-18 11:35:37 -08:00
2019-12-17 18:54:23 -08:00

LitElement TypeScript starter

This project includes a sample component using LitElement with TypeScript.

Setup

Install dependencies:

npm i

Build

This sample uses the TypeScript compiler to produce JavaScript that runs in modern browsers.

To build the JavaScript version of your component:

npm run build

To watch files and rebuild when the files are modified, run the following command in a separate shell:

npm run build:watch

Both the TypeScript compiler and lit-analyzer are configured to be very strict. You may want to change tsconfig.json to make them less strict.

Testing

This sample uses Karma, Chai, Mocha, and the open-wc test helpers for testing. See the open-wc testing documentation for more information.

Tests can be run with the test script:

npm test

Dev Server

This sample uses open-wc's es-dev-server for previewing the project without additional build steps. ES dev server handles resolving Node-style "bare" import specifiers, which aren't supported in browsers. It also automatically transpiles JavaScript and adds polyfills to support older browsers.

To run the dev server and open the project in a new browser tab:

npm run serve

Linting

Linting of TypeScript files is provided by ESLint and TypeScript ESLint. In addition, lit-analyzer is used to type-check and lint lit-html templates.

The rules are mostly the recommended rules from each project, but some have been turned off to make LitElement usage easier. The recommended rules are pretty strict, so you may want to relax them by editing .eslintrc.json and tsconfig.json.

To lint the project run:

npm run lint

More information

See Get started on the LitElement site for more information.

Description
No description provided
Readme BSD-3-Clause 1.7 MiB
Languages
TypeScript 91.5%
JavaScript 7.1%
CSS 1.3%
HTML 0.1%