Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
feat(eslint)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Jul 28, 2024
1 parent b49ffef commit adf75ad
Show file tree
Hide file tree
Showing 23 changed files with 1,291 additions and 105 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,26 @@ jobs:

- name: Check prettier
run: pnpm prettier:check

eslint:
name: check linting (eslint)
needs: [pnpm]
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'

- name: Install node dependencies
run: pnpm i

- name: Check eslint
run: pnpm lint:check
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
oldreborn/
.env
build/
build/
.eslintcache
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules/
.git
oldreborn/
.github/
.eslintcache
67 changes: 67 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import prettier from 'eslint-config-prettier';
import ts from 'typescript-eslint';
import globals from 'globals';

export default [
...ts.configs.recommended,
prettier,
{
ignores: ['**/node_modules/', '**/build/', '**/pnpm-lock.yaml'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.es2022,
...globals.node
}
},
rules: {
'max-len': ['error', { code: 120, ignoreUrls: true, ignoreComments: true }],
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
'no-constant-condition': ['error', { checkLoops: false }],
'prefer-const': ['warn', { destructuring: 'all' }],
curly: ['warn', 'multi-line', 'consistent'],
'@typescript-eslint/no-explicit-any': 'off',
'logical-assignment-operators': 'warn',
'no-template-curly-in-string': 'error',
'quote-props': ['error', 'as-needed'],
'comma-dangle': ['error', 'never'],
'no-useless-constructor': 'error',
'no-useless-assignment': 'error',
'no-inner-declarations': 'error',
'no-implicit-coercion': 'error',
'no-use-before-define': 'warn',
'no-underscore-dangle': 'warn',
'no-unneeded-ternary': 'error',
'default-param-last': 'error',
'one-var': ['warn', 'never'],
'no-inline-comments': 'warn',
'no-empty-function': 'error',
'no-useless-return': 'error',
'no-useless-rename': 'warn',
'no-useless-concat': 'warn',
'no-throw-literal': 'error',
'no-extend-native': 'error',
'default-case-last': 'warn',
'no-self-compare': 'error',
'no-new-wrappers': 'error',
'no-lone-blocks': 'error',
'no-undef-init': 'error',
'no-else-return': 'warn',
'no-extra-semi': 'error',
'require-await': 'warn',
yoda: ['error', 'always'],
'default-case': 'error',
'dot-notation': 'error',
'no-sequences': 'warn',
'no-multi-str': 'warn',
'no-lonely-if': 'warn',
'no-new-func': 'error',
'no-console': 'error',
camelcase: 'warn',
'no-var': 'warn',
eqeqeq: 'warn',
semi: 'error'
}
}
];
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"url": "https://github.com/Hypixel-API-Reborn/hypixel-api-reborn/issues"
},
"scripts": {
"lint": "npx eslint --cache src/",
"lint:fix": "npx eslint --cache src/ --fix",
"prettier": "npx prettier --cache --write src/",
"prettier:check": "npx prettier --cache --check src/"
"lint:check": "npx eslint --cache src/",
"lint": "npx eslint --cache src/ --fix",
"prettier:check": "npx prettier --cache --check src/",
"prettier": "npx prettier --cache --write src/"
},
"engines": {
"node": ">=20.16.0",
Expand All @@ -28,6 +28,7 @@
"yarn": "forbidden, use pnpm instead",
"bun": "forbidden, use pnpm instead"
},
"type": "module",
"packageManager": "[email protected]",
"author": "Kathund",
"dependencies": {
Expand All @@ -43,8 +44,14 @@
},
"publisher": "Kathund",
"devDependencies": {
"@eslint/js": "^9.8.0",
"@types/eslint": "^9.6.0",
"@types/node": "^20.14.12",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.8.0",
"prettier": "^3.3.3",
"typescript": "^5.5.4"
"typescript": "^5.5.4",
"typescript-eslint": "^7.17.0"
}
}
Loading

0 comments on commit adf75ad

Please sign in to comment.