Skip to content

Commit

Permalink
Add main files
Browse files Browse the repository at this point in the history
  • Loading branch information
DEVTomatoCake committed Oct 31, 2023
1 parent b70e845 commit bf853bc
Show file tree
Hide file tree
Showing 6 changed files with 2,958 additions and 0 deletions.
177 changes: 177 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
{
"env": {
"node": true,
"es2022": true
},
"plugins": ["unicorn", "sonarjs"],
"ignorePatterns": ["util/temp.js", "public/toasts/toastNotification.js"],
"rules": {
"array-bracket-spacing": 2,
"array-callback-return": 2,
"arrow-parens": [2, "as-needed"],
"arrow-spacing": 2,
"block-scoped-var": 2,
"brace-style": 2,
"comma-dangle": 2,
"comma-style": 2,
"computed-property-spacing": 2,
"default-case-last": 2,
"default-param-last": 2,
"dot-notation": 2,
"dot-location": [2, "property"],
"func-call-spacing": 2,
"func-name-matching": 2,
"key-spacing": 2,
"keyword-spacing": 2,
"max-statements-per-line": 2,
"max-len": [2, { "code": 280 }],
"new-parens": 2,
"no-array-constructor": 2,
"no-compare-neg-zero": 2,
"no-const-assign": 2,
"no-constructor-return": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-div-regex": 2,
"no-floating-decimal": 2,
"no-eq-null": 2,
"no-extra-bind": 2,
"no-extra-semi": 2,
"no-extend-native": 2,
"no-empty-pattern": 2,
"no-duplicate-imports": 2,
"no-fallthrough": 2,
"no-func-assign": 2,
"no-import-assign": 2,
"no-invalid-regexp": 2,
"no-invalid-this": 2,
"no-implicit-coercion": [2, { "string": false }],
"no-implied-eval": 2,
"no-loss-of-precision": 2,
"no-multi-spaces": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multi-assign": 2,
"no-multiple-empty-lines": 2,
"no-negated-condition": 2,
"no-new-native-nonconstructor": 2,
"no-new-object": 2,
"no-obj-calls": 2,
"no-self-assign": 2,
"no-unreachable": 1,
"no-unreachable-loop": 2,
"no-unsafe-finally": 2,
"no-unused-vars": [2, { "argsIgnorePattern": "args|next", "varsIgnorePattern": "_|updateSlashcommands|updateLinkedroles" }],
"no-useless-computed-key": 2,
"no-useless-rename": 2,
"no-useless-escape": 2,
"no-unused-expressions": 2,
"no-useless-return": 2,
"no-useless-call": 2,
"no-use-before-define": [2, { "functions": false }],
"no-useless-concat": 2,
"no-useless-backreference": 2,
"no-useless-catch": 2,
"no-unneeded-ternary": 2,
"no-undef": [2, { "typeof": true }],
"no-undef-init": 2,
"no-useless-constructor": 2,
"no-redeclare": 2,
"no-shadow-restricted-names": 2,
"no-trailing-spaces": 2,
"no-empty-static-block": 2,
"no-throw-literal": 2,
"no-template-curly-in-string": 2,
"no-unsafe-optional-chaining": 2,
"no-unmodified-loop-condition": 2,
"no-promise-executor-return": 2,
"no-warning-comments": 2,
"no-var": 2,
"no-new-func": 2,
"no-new-wrappers": 2,
"no-multi-str": 2,
"no-shadow": [2, { "builtinGlobals": false }],
"no-self-compare": 2,
"no-regex-spaces": 2,
"no-constant-binary-expression": 2,
"no-sequences": 2,
"no-irregular-whitespace": [2, { "skipRegExps": true }],
"no-constant-condition": 2,
"no-undefined": 2,
"no-lone-blocks": 2,
"no-whitespace-before-property": 2,
"object-shorthand": 2,
"prefer-arrow-callback": 2,
"prefer-const": 2,
"quotes": [2, "double", { "allowTemplateLiterals": false, "avoidEscape": true }],
"use-isnan": 2,
"valid-typeof": 2,

"unicorn/empty-brace-spaces": 2,
"unicorn/error-message": 2,
"unicorn/new-for-builtins": 2,
"unicorn/consistent-destructuring": 2,
"unicorn/consistent-function-scoping": 2,
"unicorn/no-array-method-this-argument": 2,
"unicorn/no-lonely-if": 2,
"unicorn/no-instanceof-array": 2,
"unicorn/no-nested-ternary": 2,
"unicorn/no-new-buffer": 2,
"unicorn/no-console-spaces": 2,
"unicorn/no-for-loop": 2,
"unicorn/no-useless-undefined": 2,
"unicorn/no-zero-fractions": 2,
"unicorn/no-unreadable-iife": 2,
"unicorn/no-unnecessary-await": 2,
"unicorn/no-unreadable-array-destructuring": 2,
"unicorn/no-useless-switch-case": 2,
"unicorn/no-typeof-undefined": 2,
"unicorn/no-useless-fallback-in-spread": 2,
"unicorn/no-useless-length-check": 2,
"unicorn/no-useless-spread": 2,
"unicorn/no-useless-promise-resolve-reject": 2,
"unicorn/prefer-array-find": 2,
"unicorn/prefer-array-index-of": 2,
"unicorn/prefer-includes": 2,
"unicorn/prefer-logical-operator-over-ternary": 2,
"unicorn/prefer-date-now": 2,
"unicorn/prefer-default-parameters": 2,
"unicorn/prefer-array-some": 2,
"unicorn/prefer-blob-reading-methods": 2,
"unicorn/prefer-at": 2,
"unicorn/prefer-optional-catch-binding": 2,
"unicorn/prefer-regexp-test": 2,
"unicorn/prefer-set-has": 2,
"unicorn/prefer-set-size": 2,
"unicorn/prefer-negative-index": 2,
"unicorn/prefer-node-protocol": 2,
"unicorn/prefer-prototype-methods": 2,
"unicorn/prefer-string-trim-start-end": 2,
"unicorn/prefer-string-starts-ends-with": 2,
"unicorn/require-array-join-separator": 2,
"unicorn/require-number-to-fixed-digits-argument": 2,
"unicorn/switch-case-braces": [2, "avoid"],
"unicorn/text-encoding-identifier-case": 2,

"sonarjs/no-extra-arguments": 2,
"sonarjs/no-empty-collection": 2,
"sonarjs/no-element-overwrite": 2,
"sonarjs/no-use-of-empty-return-value": 2,
"sonarjs/no-all-duplicated-branches": 2,
"sonarjs/no-ignored-return": 2,
"sonarjs/no-identical-expressions": 2,
"sonarjs/no-one-iteration-loop": 2,
"sonarjs/non-existent-operator": 2,
"sonarjs/no-redundant-boolean": 2,
"sonarjs/no-unused-collection": 2,
"sonarjs/prefer-immediate-return": 2,
"sonarjs/no-inverted-boolean-check": 2,
"sonarjs/no-redundant-jump": 2,
"sonarjs/no-same-line-conditional": 2,
"sonarjs/prefer-object-literal": 2,
"sonarjs/no-collection-size-mischeck": 2,
"sonarjs/prefer-while": 2,
"sonarjs/no-gratuitous-expressions": 2,
"sonarjs/no-duplicated-branches": 2
}
}
25 changes: 25 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: ESLint

on:
push:
branches: [ main ]

jobs:
lint:
name: Codestandards
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v4

- name: "🔧 setup node"
uses: actions/setup-node@v3
with:
node-version: 20
cache: "npm"

- name: "⏬ install packages"
run: npm i --omit=optional --include=dev --no-fund --progress=false

- name: "🔍 lint code"
run: npx eslint . --report-unused-disable-directives
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
18 changes: 18 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const express = require("express")
const app = express()

// - Dashboard -

app.get("/", (req, res) => {
res.send({ hello: "world" })

Check failure on line 7 in index.js

View workflow job for this annotation

GitHub Actions / Codestandards

Mixed spaces and tabs
})

// - Hooks -

const hookFunc = async (req, res) => {
res.send({ hello: "world" })
}
app.get("/hook/:id/:secret", hookFunc)
app.post("/hook/:id/:secret", hookFunc)

app.listen(25527)
Loading

0 comments on commit bf853bc

Please sign in to comment.