Add Prettier for formatting (#5)
This commit is contained in:
7
.prettierrc.json
Normal file
7
.prettierrc.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"trailingComma": "es5",
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "always"
|
||||
}
|
||||
@@ -72,6 +72,12 @@ To lint the project run:
|
||||
npm run lint
|
||||
```
|
||||
|
||||
## Formatting
|
||||
|
||||
[Prettier](https://prettier.io/) is used for code formatting. It has been pre-configured according to the Polymer Project's style. You can change this in `.prettierrc.json`.
|
||||
|
||||
Prettier has not been configured to run when commiting files, but this can be added with Husky and and `pretty-quick`. See the [prettier.io](https://prettier.io/) site for instructions.
|
||||
|
||||
## More information
|
||||
|
||||
See [Get started](https://lit-element.polymer-project.org/guide/start) on the LitElement site for more information.
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -5462,6 +5462,12 @@
|
||||
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
|
||||
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
|
||||
"dev": true
|
||||
},
|
||||
"private": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"build": "tsc",
|
||||
"build:watch": "tsc --watch",
|
||||
"lint": "lit-analyzer && eslint 'src/**/*.ts'",
|
||||
"format": "prettier src/* --write",
|
||||
"serve": "es-dev-server --app-index demo/index.html --node-resolve --watch --open",
|
||||
"test": "karma start karma.conf.cjs",
|
||||
"test:watch": "karma start karma.conf.cjs --auto-watch=true --single-run=false",
|
||||
@@ -41,6 +42,7 @@
|
||||
"karma-mocha": "^1.3.0",
|
||||
"lit-analyzer": "^1.1.9",
|
||||
"mocha": "^6.2.2",
|
||||
"prettier": "^1.19.1",
|
||||
"typescript": "^3.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,10 @@
|
||||
* http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
|
||||
import { LitElement, html, customElement, property, css } from 'lit-element';
|
||||
import {LitElement, html, customElement, property, css} from 'lit-element';
|
||||
|
||||
@customElement('my-element')
|
||||
export class MyElement extends LitElement {
|
||||
|
||||
static styles = css`
|
||||
:host {
|
||||
display: block;
|
||||
|
||||
Reference in New Issue
Block a user