Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BWL eslint and prettier #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
extends: ['./node_modules/@big-whale-labs/bwl-eslint-backend'],
parserOptions: { tsconfigRootDir: __dirname },
}
53 changes: 0 additions & 53 deletions .eslintrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc.json

This file was deleted.

15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
"repository": "https://github.com/Borodutch/telegram-bot-template",
"author": "backmeupplz <[email protected]>",
"license": "MIT",
"prettier": "@big-whale-labs/prettier-config",
"scripts": {
"distribute": "yarn build-ts && node dist/app.js",
"develop": "tsc-watch --skipLibCheck --onSuccess 'node dist/app.js'",
"build-ts": "tsc --skipLibCheck",
"pretty": "prettier --check src",
"lint": "yarn pretty && eslint --max-warnings 0 --ext ts,tsx,json src"
"lint": "yarn pretty && eslint --max-warnings 0 ./src/",
"lint-fix": "yarn eslint ./src/ --fix"
},
"dependencies": {
"@grammyjs/i18n": "^0.5.0",
Expand All @@ -24,18 +26,13 @@
"mongoose": "^6.1.0"
},
"devDependencies": {
"@big-whale-labs/bwl-eslint-backend": "^1.0.3",
"@big-whale-labs/prettier-config": "^1.1.3",
"@rushstack/eslint-patch": "^1.2.0",
"@typegoose/typegoose": "^9.3.1",
"@types/js-yaml": "^4.0.5",
"@types/node": "^16.11.12",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"eslint": "^8.4.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-no-relative-import-paths": "^1.0.8",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"module-alias": "^2.2.2",
"prettier": "^2.5.1",
"source-map-support": "^0.5.21",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ dotenv.config({ path: resolve(cwd(), '.env') })

// eslint-disable-next-line node/no-process-env
export default cleanEnv(process.env, {
TOKEN: str(),
MONGO: str(),
TOKEN: str(),
})
2 changes: 1 addition & 1 deletion src/helpers/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { cwd } from 'process'
import { resolve } from 'path'

const i18n = new I18n({
defaultLanguage: 'en',
defaultLanguageOnMissing: true,
directory: resolve(cwd(), 'locales'),
defaultLanguage: 'en',
})

export default i18n
2 changes: 1 addition & 1 deletion src/helpers/sendOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Context from '@/models/Context'

export default function sendOptions(ctx: Context) {
return {
reply_to_message_id: ctx.msg?.message_id,
parse_mode: 'HTML' as const,
reply_to_message_id: ctx.msg?.message_id,
}
}
6 changes: 3 additions & 3 deletions src/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { getModelForClass, modelOptions, prop } from '@typegoose/typegoose'

@modelOptions({ schemaOptions: { timestamps: true } })
export class User {
@prop({ required: true, index: true, unique: true })
@prop({ index: true, required: true, unique: true })
id!: number
@prop({ required: true, default: 'en' })
@prop({ default: 'en', required: true })
language!: string
}

Expand All @@ -15,8 +15,8 @@ export function findOrCreateUser(id: number) {
{ id },
{},
{
upsert: true,
new: true,
upsert: true,
}
)
}
Loading