Skip to content

Commit

Permalink
Improve codebase (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylandoamaral authored Mar 26, 2021
1 parent 32176fe commit 5a5e25e
Show file tree
Hide file tree
Showing 14 changed files with 1,106 additions and 1,008 deletions.
18 changes: 11 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
module.exports = {
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: "module" // Allows for the use of imports
sourceType: 'module', // Allows for the use of imports
},
extends: [
"plugin:@typescript-eslint/recommended" // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
],
plugins: ['simple-import-sort', 'import'],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
}
};
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
},
};
3 changes: 3 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

npm run check
18 changes: 18 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Uptime card Continuous Integration

on:
push:
branches: ['*']
pull_request:
branches: ['*']

jobs:
build:
name: Check linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Check linting
run: |
npm install
npm run check
4 changes: 2 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module.exports = {
trailingComma: 'all',
singleQuote: true,
printWidth: 120,
tabWidth: 2,
};
tabWidth: 4,
};
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-simple-import-sort": "^7.0.0",
"prettier": "^1.19.1",
"rollup": "^1.32.1",
"rollup-plugin-babel": "^4.4.0",
Expand All @@ -48,8 +49,9 @@
},
"scripts": {
"start": "rollup -c rollup.config.dev.js --watch",
"build": "npm run lint && npm run rollup",
"lint": "eslint src/*.ts",
"rollup": "rollup -c"
"build": "npm run check && npm run rollup",
"check": "eslint 'src/**/*.ts' && prettier --config .prettierrc.js 'src/**/*.ts' --check",
"rollup": "rollup -c",
"format": "eslint 'src/**/*.ts' --fix && prettier --config .prettierrc.js 'src/**/*.ts' --write"
}
}
}
20 changes: 10 additions & 10 deletions src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ export const CARD_VERSION = '0.0.1';
export const DEFAULT_CONFIG = {
hours_to_show: 24,
severity: 100,
average_text: "%",
average_text: '%',
title_adaptive_color: true,
status_adaptive_color: true,
icon_adaptive_color: true,
};

export const DEFAULT_COLOR = {
ok: "#45C669",
ko: "#C66445",
half: "#C6B145",
none: "#C9C9C9",
title: "grey",
status: "gray",
ok: '#45C669',
ko: '#C66445',
half: '#C6B145',
none: '#C9C9C9',
title: 'grey',
status: 'gray',
};

export const DEFAULT_SHOW = {
Expand All @@ -25,14 +25,14 @@ export const DEFAULT_SHOW = {
status: true,
timeline: true,
footer: true,
average: true
average: true,
};

export const DEFAULT_BAR = {
height: 46,
round: 1,
spacing: 4,
amount: 36
amount: 36,
};

export const DEFAULT_ICON = "mdi:heart";
export const DEFAULT_ICON = 'mdi:heart';
Loading

0 comments on commit 5a5e25e

Please sign in to comment.