Skip to content

Commit

Permalink
add devcontainer and fix eslint build
Browse files Browse the repository at this point in the history
  • Loading branch information
iantrich committed Nov 6, 2019
1 parent 061d414 commit 9debdbd
Show file tree
Hide file tree
Showing 17 changed files with 380 additions and 271 deletions.
4 changes: 4 additions & 0 deletions .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default_config:
lovelace:
mode: yaml
demo:
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "Restriction Card Development",
"image": "ludeeus/devcontainer:monster-stable",
"context": "..",
"appPort": ["5000:5000", "9123:8123"],
"postCreateCommand": "npm install",
"runArgs": [
"-v",
"${env:HOME}${env:USERPROFILE}/.ssh:/tmp/.ssh" // This is added so you can push from inside the container
],
"extensions": [
"github.vscode-pull-request-github",
"tabnine.tabnine-vscode",
"dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode",
"bierner.lit-html",
"runem.lit-plugin",
"ms-python.python"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"terminal.integrated.shell.linux": "/bin/bash",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}
67 changes: 67 additions & 0 deletions .devcontainer/ui-lovelace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
resources:
- url: http://127.0.0.1:5000/restriction-card.js
type: module
views:
- cards:
- type: custom:restriction-card
card:
type: light
entity: light.kitchen_lights
name: Basic
- type: custom:hui-entities-card
name: Rows
entities:
- type: custom:restriction-card
row: true
card:
entity: light.kitchen_lights
name: Basic
- type: custom:restriction-card
row: true
card:
entity: light.kitchen_lights
name: Block
restrictions:
block: true
- type: custom:restriction-card
row: true
card:
entity: light.kitchen_lights
name: Confirmation
restrictions:
confirm: true
- type: custom:restriction-card
row: true
card:
entity: light.kitchen_lights
name: Pin
restrictions:
pin:
code: 1234
- type: custom:restriction-card
restrictions:
confirm:
exemptions:
- user: adminid
pin:
code: 1234
exemptions:
- user: wifeid
- user: adminid
block:
exemptions:
- user: guestid
- user: wifeid
- user: adminid
exemptions:
- user: ianid
card:
type: light
entity: light.kitchen_lights
name: Exemptions
- type: custom:restriction-card
card:
type: sensor
entity: sensor.outside_humidity
name: Throttle?
graph: line
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
experimentalDecorators: true,
},
rules: {
"@typescript-eslint/camelcase": 0
}
};
22 changes: 0 additions & 22 deletions .eslintrc.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules/
/.rpt2_cache/
package-lock.json
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
semi: true,
trailingComma: 'all',
singleQuote: true,
printWidth: 120,
tabWidth: 2,
};
52 changes: 17 additions & 35 deletions dist/restriction-card.js

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{
"name": "restriction-card",
"version": "1.0.0",
"version": "1.1.4",
"description": "Lovelace restriction-card",
"keywords": [
"home-assistant",
"homeassistant",
"hass",
"automation",
"lovelace",
"custom-cards"
"custom-cards",
"security"
],
"module": "restriction-card.js",
"repository": "[email protected]:custom_cards/restriction-card.git",
"author": "BoilerPlate <restriction@email.com>",
"repository": "[email protected]:iantrich/restriction-card.git",
"author": "Ian Richardson <iantrich@gmail.com>",
"license": "MIT",
"dependencies": {
"custom-card-helpers": "^1.3.5",
"custom-card-helpers": "^1.3.9",
"home-assistant-js-websocket": "^4.4.0",
"lit-element": "^2.2.1"
"lit-element": "^2.2.1",
"lit-html": "^1.1.2"
},
"devDependencies": {
"@babel/core": "^7.6.4",
Expand All @@ -27,18 +29,21 @@
"@typescript-eslint/parser": "^2.6.0",
"eslint": "^6.6.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-prettier": "^3.1.1",
"prettier": "^1.18.2",
"rollup": "^1.26.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^5.1.2",
"rollup-plugin-typescript2": "^0.24.3",
"rollup-plugin-uglify": "^6.0.3",
"typescript": "^3.6.4"
},
"scripts": {
"start": "rollup -c --watch",
"start": "rollup -c rollup.config.dev.js --watch",
"build": "npm run lint && npm run rollup",
"lint": "eslint src/*.ts",
"rollup": "rollup -c"
Expand Down
30 changes: 30 additions & 0 deletions rollup.config.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import babel from 'rollup-plugin-babel';
import serve from 'rollup-plugin-serve';
import { terser } from 'rollup-plugin-terser';

export default {
input: ['src/restriction-card.ts'],
output: {
dir: './dist',
format: 'es',
},
plugins: [
resolve(),
typescript(),
babel({
exclude: 'node_modules/**',
}),
terser(),
serve({
contentBase: './dist',
host: '0.0.0.0',
port: 5000,
allowCrossOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
}),
],
};
17 changes: 9 additions & 8 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import babel from 'rollup-plugin-babel';
import resolve from "rollup-plugin-node-resolve";
import typescript from "rollup-plugin-typescript2";
import babel from "rollup-plugin-babel";
import { terser } from "rollup-plugin-terser";

export default {
input: ['src/restriction-card.ts'],
input: ["src/restriction-card.ts"],
output: {
dir: './dist',
format: 'es',
dir: "./dist",
format: "es"
},
plugins: [
resolve(),
typescript(),
babel({
exclude: 'node_modules/**'
exclude: "node_modules/**"
}),
terser()]
terser(),
]
};
Loading

0 comments on commit 9debdbd

Please sign in to comment.