Skip to content

Commit

Permalink
Add more strict ESLint rules, resolve linting errors and cleanup (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulyadav-57 authored Jul 12, 2024
1 parent 622d09d commit 9109cf8
Show file tree
Hide file tree
Showing 62 changed files with 4,089 additions and 2,712 deletions.
9 changes: 1 addition & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
ACCESS_TOKEN_DURATION=
JWT_SECRET_KEY=
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32

TON_API_KEY=
# @tonapi_bot

MONGODB_URI=
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false
NEXT_PUBLIC_DISABLE_WEBCONTAINER=false
99 changes: 99 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/* eslint-env node */
module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"next/core-web-vitals",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
project: "./tsconfig.json",
},
ignorePatterns: ["*.cjs"],
plugins: ["@typescript-eslint"],
root: true,
env: {
node: true,
es2021: true,
},
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-var-requires": [
"error",
{
allow: ["/package\\.json$"],
},
],
"@typescript-eslint/no-duplicate-type-constituents": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/no-base-to-string": "error",
"@typescript-eslint/restrict-template-expressions": "error",
"@typescript-eslint/no-useless-template-literals": "error",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/consistent-generic-constructors": [
"error",
"type-annotation",
],
"@typescript-eslint/consistent-indexed-object-style": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/no-array-delete": "error",
"@typescript-eslint/no-confusing-non-null-assertion": "error",
"@typescript-eslint/no-confusing-void-expression": "error",
"@typescript-eslint/no-duplicate-enum-values": "error",
"@typescript-eslint/no-duplicate-type-constituents": "error",
"@typescript-eslint/no-dynamic-delete": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-for-in-array": "error",
"no-implied-eval": "off",
"@typescript-eslint/no-implied-eval": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/no-invalid-void-type": "error",
"no-loss-of-precision": "off",
"@typescript-eslint/no-loss-of-precision": "error",
"@typescript-eslint/no-meaningless-void-operator": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-mixed-enums": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-redundant-type-constituents": "error",
"@typescript-eslint/no-this-alias": "error",
"no-throw-literal": "off",
"@typescript-eslint/only-throw-error": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unsafe-unary-minus": "error",
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-literal-enum-member": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"require-await": "off",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/unified-signatures": "error",
"react-hooks/exhaustive-deps": "off",
},
};
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ jobs:
- name: Install dependencies
run: npm install

- name: Run Prettier check
- name: "Prettier: Validate code formatting"
run: npm run format:check
- name: "ESLint: Validate code for errors"
run: npm run lint

deploy:
runs-on: ubuntu-latest
Expand Down
Loading

0 comments on commit 9109cf8

Please sign in to comment.