Skip to content

Commit

Permalink
[migrate] upgrade to ESLint 9 & other latest Upstream packages
Browse files Browse the repository at this point in the history
[optimize] some detail configuration
  • Loading branch information
TechQuery committed Oct 19, 2024
1 parent bdc14b6 commit 8501c85
Show file tree
Hide file tree
Showing 10 changed files with 995 additions and 718 deletions.
10 changes: 0 additions & 10 deletions .eslintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Pick Docker Compose
run: |
mkdir ./build
mv ${{ env.ARTIFACT_PATH }} ./docker-compose.yml ./start.sh ./build
mv ${{ env.ARTIFACT_PATH }} ./.env ./docker-compose.yml ./start.sh ./build
- name: Transport Image
uses: appleboy/[email protected]
Expand All @@ -65,9 +65,9 @@ jobs:
username: ${{ secrets.USER }}
password: ${{ secrets.SSH_KEY }}
command: |
mkdir -p ~/${{ env.BOX_NAME }}
cd /tmp/${{ env.BOX_NAME }}
mv docker-compose.yml start.sh ~/${{ env.BOX_NAME }}
mkdir -p ~/${{ env.BOX_NAME }}
mv .env docker-compose.yml start.sh ~/${{ env.BOX_NAME }}
cd ~/${{ env.BOX_NAME }}
chmod +x start.sh
echo '${{ secrets.SSH_KEY }}' | sudo -S ./start.sh /tmp/${{ env.BOX_NAME }}/${{ env.ARTIFACT_PATH }}
56 changes: 56 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// @ts-check
import eslint from '@eslint/js';
import { currentModulePath } from '@tech_query/node-toolkit';
import eslintConfigPrettier from 'eslint-config-prettier';
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tsEslint from 'typescript-eslint';

const tsconfigRootDir = currentModulePath();

export default tsEslint.config(
// register all of the plugins up-front
{
plugins: {
'@typescript-eslint': tsEslint.plugin,
'simple-import-sort': simpleImportSortPlugin
}
},
// config with just ignores is the replacement for `.eslintignore`
{ ignores: ['**/node_modules/**', '**/dist/**', 'type/**', '*.mjs'] },

// extends ...
eslint.configs.recommended,
...tsEslint.configs.recommended,

// base config
{
languageOptions: {
globals: { ...globals.es2022, ...globals.node },
parserOptions: {
projectService: true,
tsconfigRootDir,
warnOnUnsupportedTypeScriptVersion: false
}
},
rules: {
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unsafe-declaration-merging': 'warn'
}
},
{
files: ['**/*.js'],
extends: [tsEslint.configs.disableTypeChecked],
rules: {
// turn off other type-aware rules
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',

// turn off rules that don't apply to JS code
'@typescript-eslint/explicit-function-return-type': 'off'
}
},
eslintConfigPrettier
);
34 changes: 20 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@koa/cors": "^5.0.0",
"@koa/multer": "^3.0.2",
"@koa/router": "^13.0.1",
"@koa/router": "^13.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"cross-env": "^7.0.3",
Expand All @@ -36,38 +36,43 @@
"marked": "^14.1.2",
"mobx-github": "^0.3.4",
"mobx-restful": "^1.0.1",
"pg": "^8.12.0",
"pg-connection-string": "^2.6.4",
"pg": "^8.13.0",
"pg-connection-string": "^2.7.0",
"reflect-metadata": "^0.2.2",
"routing-controllers": "^0.10.4",
"routing-controllers-openapi": "^4.0.0",
"tslib": "^2.7.0",
"typeorm": "npm:@helveg/typeorm@^0.3.20",
"undici": "^6.19.8",
"web-utility": "^4.4.0"
"typeorm": "npm:@helveg/typeorm@^0.3.21",
"undici": "^6.20.1",
"web-utility": "^4.4.1"
},
"devDependencies": {
"@eslint/js": "^9.12.0",
"@octokit/openapi-types": "^22.2.0",
"@tech_query/node-toolkit": "^2.0.0-alpha.0",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__js": "^8.42.3",
"@types/jest": "^29.5.13",
"@types/jsonwebtoken": "^9.0.6",
"@types/jsonwebtoken": "^9.0.7",
"@types/koa": "^2.15.0",
"@types/koa-logger": "^3.1.5",
"@types/node": "^20.16.5",
"@typescript-eslint/eslint-plugin": "^8.5.0",
"@typescript-eslint/parser": "^8.5.0",
"eslint": "^8.57.0",
"@types/node": "^20.16.11",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"globals": "^15.11.0",
"husky": "^9.1.6",
"jest": "^29.7.0",
"koajax": "^3.0.2",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"sqlite3": "^5.1.7",
"start-server-and-test": "^2.0.7",
"start-server-and-test": "^2.0.8",
"swagger-typescript-api": "^13.0.22",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "~5.6.2"
"typescript": "~5.6.3",
"typescript-eslint": "^8.9.0"
},
"resolutions": {
"native-file-system-adapter": "npm:@tech_query/native-file-system-adapter@^3.0.1"
Expand All @@ -79,7 +84,8 @@
"tabWidth": 4
},
"lint-staged": {
"*.{md,json,yml,ts}": "prettier --write"
"*.{md,json,yml,mjs,ts}": "prettier --write",
"*.ts": "eslint --fix"
},
"jest": {
"preset": "ts-jest"
Expand Down
Loading

0 comments on commit 8501c85

Please sign in to comment.