Skip to content

Commit

Permalink
Merge pull request #259 from systemli/add-prettier-config
Browse files Browse the repository at this point in the history
🎨 Apply prettier config
  • Loading branch information
0x46616c6b authored Jun 4, 2022
2 parents 9747cdf + 994c3d2 commit d961924
Show file tree
Hide file tree
Showing 47 changed files with 3,350 additions and 2,884 deletions.
9 changes: 2 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"plugins": [
"@babel/plugin-proposal-object-rest-spread"
],
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
"plugins": ["@babel/plugin-proposal-object-rest-spread"],
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
9 changes: 2 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
"es6": true,
"node": true
},
"plugins": [
"react"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended"
]
"plugins": ["react"],
"extends": ["eslint:recommended", "plugin:react/recommended"]
}
24 changes: 12 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "weekly"
day: "friday"
time: "09:00"
timezone: "Europe/Berlin"
interval: 'weekly'
day: 'friday'
time: '09:00'
timezone: 'Europe/Berlin'

- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "weekly"
day: "friday"
time: "09:00"
timezone: "Europe/Berlin"
interval: 'weekly'
day: 'friday'
time: '09:00'
timezone: 'Europe/Berlin'
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [ '14', '16' ]
node-version: ['14', '16']

steps:
- name: Checkout
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Quality

on:
push:
branches:
- main
pull_request:

jobs:
prettier:
name: Prettier
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Run Prettier
uses: wearerequired/lint-action@v1
with:
check_name: Prettier Results
prettier: true
prettier_dir: src
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"arrowParens": "avoid",
"semi": false,
"singleQuote": true,
"tabWidth": 2
}
22 changes: 11 additions & 11 deletions leaflet.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import L from 'leaflet';
import L from 'leaflet'

import 'leaflet/dist/leaflet.css';
import 'leaflet-draw/dist/leaflet.draw.css';
import 'leaflet/dist/leaflet.css'
import 'leaflet-draw/dist/leaflet.draw.css'

// stupid hack so that leaflet's images work after going through webpack
import marker from 'leaflet/dist/images/marker-icon.png';
import marker2x from 'leaflet/dist/images/marker-icon-2x.png';
import markerShadow from 'leaflet/dist/images/marker-shadow.png';
import marker from 'leaflet/dist/images/marker-icon.png'
import marker2x from 'leaflet/dist/images/marker-icon-2x.png'
import markerShadow from 'leaflet/dist/images/marker-shadow.png'

delete L.Icon.Default.prototype._getIconUrl;
delete L.Icon.Default.prototype._getIconUrl

L.Icon.Default.mergeOptions({
iconRetinaUrl: marker2x,
iconUrl: marker,
shadowUrl: markerShadow
});
iconRetinaUrl: marker2x,
iconUrl: marker,
shadowUrl: markerShadow,
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"postcss": "^7.0.27",
"postcss-loader": "^3.0.0",
"postcss-remove-google-fonts": "^1.1.2",
"prettier": "^2.6.2",
"promise": "^8.1.0",
"prop-types": "^15.7.2",
"react": "^16.13.1",
Expand Down
21 changes: 12 additions & 9 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
module.exports = {
plugins: {
'cssnano': {
preset: ['default', {
discardComments: {
removeAll: true,
},
}]
plugins: {
cssnano: {
preset: [
'default',
{
discardComments: {
removeAll: true,
},
},
'postcss-remove-google-fonts': {},
],
},
};
'postcss-remove-google-fonts': {},
},
}
11 changes: 7 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="shortcut icon" href="favicon.ico">
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="shortcut icon" href="favicon.ico" />
<title>Ticker Admin</title>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion src/api/Api.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export let ApiUrl = process.env.REACT_APP_API_URL || 'http://localhost:8080/v1';
export let ApiUrl = process.env.REACT_APP_API_URL || 'http://localhost:8080/v1'
30 changes: 15 additions & 15 deletions src/api/Message.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {ApiUrl} from "./Api";
import AuthSingleton from "../components/AuthService";
import { ApiUrl } from './Api'
import AuthSingleton from '../components/AuthService'

const Auth = AuthSingleton.getInstance();
const Auth = AuthSingleton.getInstance()

/**
* @param {string} ticker
* @returns {Promise<Response>}
*/
export function getMessages(ticker) {
return Auth.fetch(`${ApiUrl}/admin/tickers/${ticker}/messages`);
return Auth.fetch(`${ApiUrl}/admin/tickers/${ticker}/messages`)
}

/**
Expand All @@ -20,14 +20,14 @@ export function getMessages(ticker) {
* @returns {Promise<Response>}
*/
export function postMessage(ticker, text, geoInformation, attachments) {
return Auth.fetch(`${ApiUrl}/admin/tickers/${ticker}/messages`, {
body: JSON.stringify({
text: text,
geo_information: geoInformation,
attachments: attachments,
}),
method: 'POST'
});
return Auth.fetch(`${ApiUrl}/admin/tickers/${ticker}/messages`, {
body: JSON.stringify({
text: text,
geo_information: geoInformation,
attachments: attachments,
}),
method: 'POST',
})
}

/**
Expand All @@ -37,7 +37,7 @@ export function postMessage(ticker, text, geoInformation, attachments) {
* @returns {Promise<any>}
*/
export function deleteMessage(ticker, message) {
return Auth.fetch(`${ApiUrl}/admin/tickers/${ticker}/messages/${message}`, {
method: 'DELETE'
});
return Auth.fetch(`${ApiUrl}/admin/tickers/${ticker}/messages/${message}`, {
method: 'DELETE',
})
}
26 changes: 13 additions & 13 deletions src/api/Settings.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import {ApiUrl} from "./Api";
import AuthSingleton from "../components/AuthService";
import { ApiUrl } from './Api'
import AuthSingleton from '../components/AuthService'

const Auth = AuthSingleton.getInstance();
const Auth = AuthSingleton.getInstance()

/**
* @returns {Promise<Response>}
*/
export function getInactiveSettings() {
return Auth.fetch(`${ApiUrl}/admin/settings/inactive_settings`);
return Auth.fetch(`${ApiUrl}/admin/settings/inactive_settings`)
}

/**
* @returns {Promise<Response>}
*/
export function getRefreshInterval() {
return Auth.fetch(`${ApiUrl}/admin/settings/refresh_interval`);
return Auth.fetch(`${ApiUrl}/admin/settings/refresh_interval`)
}

/**
* @param {object} data
* @returns {Promise<Response>}
*/
export function putInactiveSettings(data) {
return Auth.fetch(`${ApiUrl}/admin/settings/inactive_settings`, {
body: JSON.stringify(data),
method: 'PUT'
});
return Auth.fetch(`${ApiUrl}/admin/settings/inactive_settings`, {
body: JSON.stringify(data),
method: 'PUT',
})
}

/**
* @param {object} data
* @returns {Promise<Response>}
*/
export function putRefreshInterval(data) {
return Auth.fetch(`${ApiUrl}/admin/settings/refresh_interval`, {
body: JSON.stringify(data),
method: 'PUT'
});
return Auth.fetch(`${ApiUrl}/admin/settings/refresh_interval`, {
body: JSON.stringify(data),
method: 'PUT',
})
}
Loading

0 comments on commit d961924

Please sign in to comment.