Skip to content

Commit

Permalink
Update eslint rules to match Simulator repo
Browse files Browse the repository at this point in the history
  • Loading branch information
navzam committed Aug 17, 2024
1 parent be0a44c commit 2a7d66b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
44 changes: 38 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ module.exports = {
},
extends: [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
parser: "@typescript-eslint/parser",
parserOptions: {
Expand All @@ -24,8 +22,42 @@ module.exports = {
"import",
],
rules: {
"import/no-unresolved": 0,
"indent": ["error", 2],
"object-curly-spacing": ["error", "always"],
// Project-specific ESLint rules
'array-bracket-spacing': 'error',
'arrow-spacing': 'error',
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
'comma-style': 'error',
'eqeqeq': 'error',
'indent': ['error', 2, { 'SwitchCase': 1 }],
'keyword-spacing': 'error',
'newline-per-chained-call': 'error',
'no-confusing-arrow': 'error',
'no-duplicate-imports': 'error',
'no-else-return': 'error',
'no-new-wrappers': 'error',
'no-param-reassign': 'error',
'no-useless-constructor': 'error',
'no-whitespace-before-property': 'error',
'nonblock-statement-body-position': 'error',
'object-curly-spacing': ['error', 'always'],
'operator-linebreak': 'error',
'prefer-arrow-callback': 'error',
'prefer-const': 'error',
'prefer-template': 'error',
'semi': 'error',
'space-before-blocks': 'error',
'space-before-function-paren': ['error', { 'named': 'never' }],
'space-in-parens': 'error',
'space-infix-ops': 'error',
'spaced-comment': 'error',
'template-curly-spacing': 'error',

// Project-specific ESLint rules for TypeScript
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/explicit-module-boundary-types' : 'off',
'@typescript-eslint/no-floating-promises': ['error', { ignoreIIFE: true }],
'@typescript-eslint/no-unused-vars': ['off'],
},
};
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const unconsentedUserCleanup = onSchedule("every 5 mins", async (event) =
logger.info('Processing user', { userId: userId });

// Parse the "sent at" field
const sentAtString = doc.get('legalAcceptance.sentAt');
const sentAtString: unknown = doc.get('legalAcceptance.sentAt');
if (!sentAtString || typeof sentAtString !== 'string') {
logger.error(`'sentAt' string field does not exist in user doc. Skipping user`, { userId: userId });
continue;
Expand Down Expand Up @@ -69,7 +69,7 @@ export const unconsentedUserCleanup = onSchedule("every 5 mins", async (event) =
// if (e && typeof e === 'object' && 'code' in e && e.code === 'auth/user-not-found') {
// logger.warn('Failed to delete user because user was not found. Proceeding anyway', { userId: userId });
// } else {
// logger.error(`Failed to delete user: ${e}`, { userId: userId });
// logger.error(`Failed to delete user: ${JSON.stringify(e)}`, { userId: userId });
// continue;
// }
// }
Expand All @@ -79,7 +79,7 @@ export const unconsentedUserCleanup = onSchedule("every 5 mins", async (event) =
// await doc.ref.delete();
// logger.info('Successfully deleted doc for user', { userId: userId });
// } catch (e) {
// logger.error(`Failed to delete doc: ${e}`, { userId: userId });
// logger.error(`Failed to delete doc: ${JSON.stringify(e)}`, { userId: userId });
// continue;
// }

Expand Down

0 comments on commit 2a7d66b

Please sign in to comment.