-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from Giveth/eslint
add eslint
- Loading branch information
Showing
52 changed files
with
8,078 additions
and
18,871 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import path from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
import _import from 'eslint-plugin-import'; | ||
import unusedImports from 'eslint-plugin-unused-imports'; | ||
import { fixupPluginRules } from '@eslint/compat'; | ||
import tsParser from '@typescript-eslint/parser'; | ||
import js from '@eslint/js'; | ||
import { FlatCompat } from '@eslint/eslintrc'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all, | ||
}); | ||
|
||
export default [ | ||
{ | ||
ignores: ['node_modules/*', 'dist/*'], | ||
}, | ||
...compat.extends( | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
), | ||
{ | ||
plugins: { | ||
import: fixupPluginRules(_import), | ||
'unused-imports': unusedImports, | ||
}, | ||
|
||
languageOptions: { | ||
parser: tsParser, | ||
}, | ||
|
||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'unused-imports/no-unused-imports': 'error', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
argsIgnorePattern: '^_', | ||
}, | ||
], | ||
|
||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
arrowParens: 'avoid', | ||
singleQuote: true, | ||
semi: true, | ||
tabWidth: 2, | ||
useTabs: false, | ||
trailingComma: 'all', | ||
'jsdoc-format': false, | ||
endOfLine: 'auto', | ||
}, | ||
], | ||
|
||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [ | ||
'builtin', | ||
'external', | ||
['internal', 'parent', 'sibling'], | ||
'index', | ||
'object', | ||
'type', | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,55 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm" | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import { NOTIFICATION_CATEGORY } from '../src/types/general'; | ||
import { NotificationType } from '../src/entities/notificationType'; | ||
import { MICRO_SERVICES } from '../src/utils/utils'; | ||
import { NOTIFICATION_CATEGORY_GROUPS } from '../src/entities/notificationSetting'; | ||
|
||
export const superFluidNotificationTypes = [ | ||
{ | ||
isGlobal: false, | ||
isGroupParent: true, | ||
showOnSettingPage: true, | ||
webDefaultValue: true, | ||
emailDefaultValue: true, | ||
isEmailEditable: true, | ||
isWebEditable: true, | ||
name: 'Stream balance warnings', | ||
description: 'Notify me when any of my Stream Balances are running low', | ||
microService: MICRO_SERVICES.givethio, | ||
category: NOTIFICATION_CATEGORY.SUPPORTED_PROJECTS, | ||
schemaValidator: null, | ||
emailNotifierService: null, | ||
emailNotificationId: null, | ||
pushNotifierService: null, | ||
categoryGroup: NOTIFICATION_CATEGORY_GROUPS.SUPERFLUID, | ||
title: 'Stream balance warnings', | ||
}, | ||
] | ||
{ | ||
isGlobal: false, | ||
isGroupParent: true, | ||
showOnSettingPage: true, | ||
webDefaultValue: true, | ||
emailDefaultValue: true, | ||
isEmailEditable: true, | ||
isWebEditable: true, | ||
name: 'Stream balance warnings', | ||
description: 'Notify me when any of my Stream Balances are running low', | ||
microService: MICRO_SERVICES.givethio, | ||
category: NOTIFICATION_CATEGORY.SUPPORTED_PROJECTS, | ||
schemaValidator: null, | ||
emailNotifierService: null, | ||
emailNotificationId: null, | ||
pushNotifierService: null, | ||
categoryGroup: NOTIFICATION_CATEGORY_GROUPS.SUPERFLUID, | ||
title: 'Stream balance warnings', | ||
}, | ||
]; | ||
|
||
export class addGroupParentSuperFluid1713834025817 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
// Fetch the notificationTypeIds for the "superfluid" categoryGroup | ||
const notificationTypeIds = (await queryRunner.query(` | ||
export class addGroupParentSuperFluid1713834025817 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
// Fetch the notificationTypeIds for the "superfluid" categoryGroup | ||
const notificationTypeIds = ( | ||
await queryRunner.query(` | ||
SELECT "id" FROM "notification_type" WHERE "categoryGroup" = 'superfluid'; | ||
`)).map((i: any) => i.id); | ||
await queryRunner.query( | ||
`UPDATE notification_type | ||
`) | ||
).map((i: any) => i.id); | ||
await queryRunner.query( | ||
`UPDATE notification_type | ||
SET "showOnSettingPage" = false, "emailDefaultValue" = true, "category" = '${NOTIFICATION_CATEGORY.SUPPORTED_PROJECTS}' | ||
WHERE id IN (${notificationTypeIds.join(", ")})` | ||
); | ||
await queryRunner.manager.save( | ||
NotificationType, | ||
superFluidNotificationTypes, | ||
); | ||
} | ||
WHERE id IN (${notificationTypeIds.join(', ')})`, | ||
); | ||
await queryRunner.manager.save( | ||
NotificationType, | ||
superFluidNotificationTypes, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`DELETE FROM notification_type WHERE "categoryGroup" = 'superfluid' AND "name" = 'Stream Balance Warnings';`, | ||
); | ||
} | ||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`DELETE FROM notification_type WHERE "categoryGroup" = 'superfluid' AND "name" = 'Stream Balance Warnings';`, | ||
); | ||
} | ||
} |
Oops, something went wrong.