feat(lint): add eslint
This commit is contained in:
parent
1595388eec
commit
a1b76fce16
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:react/recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
},
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"react"
|
||||
],
|
||||
"rules": {
|
||||
"semi": [ "error", "never" ],
|
||||
"quotes": [ "error", "double" ]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
eslint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'yarn'
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
- name: ESLint
|
||||
run: yarn run eslint .
|
|
@ -1,7 +1,7 @@
|
|||
FROM gitpod/workspace-full
|
||||
|
||||
# Install cli tools
|
||||
RUN yarn global add gatsby vercel
|
||||
RUN yarn global add gatsby vercel eslint
|
||||
|
||||
RUN echo "export PATH=\$PATH:`yarn global bin`" >> ~/.bashrc
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
"start": "gatsby develop",
|
||||
"build": "gatsby build",
|
||||
"serve": "gatsby serve",
|
||||
"clean": "gatsby clean"
|
||||
"clean": "gatsby clean",
|
||||
"lint": "eslint . --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "0.21.1",
|
||||
|
@ -29,5 +30,9 @@
|
|||
"react-helmet": "6.1.0",
|
||||
"react-notifications": "1.7.2",
|
||||
"sass": "1.37.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-react": "^7.24.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import axios from 'axios'
|
||||
import axios from "axios"
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: process.env.API_URL || 'https://backend.pingbot.cf/api',
|
||||
baseURL: process.env.API_URL || "https://backend.pingbot.cf/api",
|
||||
})
|
||||
|
||||
export default instance
|
||||
|
|
|
@ -9,7 +9,7 @@ import "../css/url.sass"
|
|||
import "../css/notifications.sass"
|
||||
|
||||
const AddURLPage = () => {
|
||||
const [url, setURL] = React.useState('')
|
||||
const [url, setURL] = React.useState("")
|
||||
|
||||
const handleKeypress = e => {
|
||||
if (e.charCode === 13 || e.keyCode === 13) {
|
||||
|
@ -23,22 +23,22 @@ const AddURLPage = () => {
|
|||
}
|
||||
|
||||
const addURL = async () => {
|
||||
setURL('')
|
||||
setURL("")
|
||||
|
||||
if (url === '') {
|
||||
return NotificationManager.error('Empty')
|
||||
if (url === "") {
|
||||
return NotificationManager.error("Empty")
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await axios.post('/url', {
|
||||
const res = await axios.post("/url", {
|
||||
url: url,
|
||||
})
|
||||
|
||||
const data = res.data
|
||||
|
||||
NotificationManager.success(data.url, 'Added')
|
||||
NotificationManager.success(data.url, "Added")
|
||||
} catch (err) {
|
||||
let e = ''
|
||||
let e = ""
|
||||
|
||||
if (err.response && err.response.data.message) {
|
||||
e = err.response.data.message
|
||||
|
|
|
@ -9,7 +9,7 @@ import "../css/url.sass"
|
|||
import "../css/notifications.sass"
|
||||
|
||||
const DeleteURLPage = () => {
|
||||
const [url, setURL] = React.useState('')
|
||||
const [url, setURL] = React.useState("")
|
||||
|
||||
const handleKeypress = e => {
|
||||
if (e.charCode === 13 || e.keyCode === 13) {
|
||||
|
@ -23,10 +23,10 @@ const DeleteURLPage = () => {
|
|||
}
|
||||
|
||||
const deleteURL = async () => {
|
||||
setURL('')
|
||||
setURL("")
|
||||
|
||||
if (url === '') {
|
||||
return NotificationManager.error('Empty')
|
||||
if (url === "") {
|
||||
return NotificationManager.error("Empty")
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -38,9 +38,9 @@ const DeleteURLPage = () => {
|
|||
|
||||
const data = res.data
|
||||
|
||||
NotificationManager.success(data.url, 'Deleted')
|
||||
NotificationManager.success(data.url, "Deleted")
|
||||
} catch (err) {
|
||||
let e = ''
|
||||
let e = ""
|
||||
|
||||
if (err.response && err.response.data.message) {
|
||||
e = err.response.data.message
|
||||
|
|
|
@ -4175,7 +4175,7 @@ eslint-plugin-react-hooks@^4.2.0:
|
|||
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz#8c229c268d468956334c943bb45fc860280f5556"
|
||||
integrity sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ==
|
||||
|
||||
eslint-plugin-react@^7.23.1:
|
||||
eslint-plugin-react@^7.23.1, eslint-plugin-react@^7.24.0:
|
||||
version "7.24.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.24.0.tgz#eadedfa351a6f36b490aa17f4fa9b14e842b9eb4"
|
||||
integrity sha512-KJJIx2SYx7PBx3ONe/mEeMz4YE0Lcr7feJTCMyyKb/341NcjuAgim3Acgan89GfPv7nxXK2+0slu0CWXYM4x+Q==
|
||||
|
@ -4237,7 +4237,7 @@ eslint-webpack-plugin@^2.5.3:
|
|||
normalize-path "^3.0.0"
|
||||
schema-utils "^3.0.0"
|
||||
|
||||
eslint@^7.20.0:
|
||||
eslint@^7.20.0, eslint@^7.32.0:
|
||||
version "7.32.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d"
|
||||
integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==
|
||||
|
|
Loading…
Reference in New Issue