From a9fc76a7a3f50902969181de8b53efbcdeec4c31 Mon Sep 17 00:00:00 2001 From: Manjil Tamang Date: Sat, 31 Jul 2021 15:37:50 +0545 Subject: [PATCH] fix eslint and prettier config --- .eslintrc.js | 58 ++++++++++++++++++++++++++++++++++++++++++---------- .prettierrc | 5 +++-- src/index.ts | 6 +----- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7dab98c..4547170 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,21 +1,57 @@ module.exports = { - parser: '@typescript-eslint/parser', // Specifies the ESLint parser - parserOptions: { - ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features - sourceType: 'module', // Allows for the use of imports + env: { + es6: true, + node: true, + 'jest/globals': true, }, extends: [ - 'plugin:@typescript-eslint/recommended', // Uses the recommended rules - 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier - 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. + 'airbnb-base', + 'plugin:@typescript-eslint/recommended', + 'plugin:jest/recommended', + 'plugin:prettier/recommended', ], - plugins: ['@typescript-eslint'], + globals: { + Atomics: 'readonly', + SharedArrayBuffer: 'readonly', + }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 11, + sourceType: 'module', + }, + plugins: ['@typescript-eslint', 'jest'], + ignorePatterns: ['**/dist/**'], + settings: { + 'import/resolver': { + node: { + extensions: ['.js', '.jsx', '.ts', '.tsx'], + }, + }, + }, rules: { - 'no-console': 'warn', + 'import/prefer-default-export': 'off', + 'func-names': 'off', + 'lines-between-class-members': 'off', + 'no-return-await': 'off', + 'consistent-return': 'off', + 'no-unused-vars': ['error', { argsIgnorePattern: 'error|req|res|val' }], + 'no-underscore-dangle': 'off', + 'prefer-destructuring': 'off', + 'class-methods-use-this': 'off', + camelcase: 'off', '@typescript-eslint/no-unused-vars': [ 'error', - { argsIgnorePattern: 'req|res|next|val' }, + { argsIgnorePattern: 'error|req|res|val' }, + ], + 'import/extensions': [ + 'error', + 'ignorePackages', + { + js: 'never', + jsx: 'never', + ts: 'never', + tsx: 'never', + }, ], - '@typescript-eslint/ban-types': 'off', }, }; diff --git a/.prettierrc b/.prettierrc index 4000947..2580248 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,6 +1,7 @@ { "semi": true, - "trailingComma": "all", + "tabWidth": 2, + "printWidth": 120, "singleQuote": true, - "tabWidth": 2 + "trailingComma": "none" } diff --git a/src/index.ts b/src/index.ts index 072099c..71f7a24 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,9 +5,5 @@ const PORT = process.env.PORT || 5000; app.listen(PORT, () => { logger.info(`✅ Server listening on port ${PORT}`); - logger.info( - `🚀 Deploy stage: ${process.env.NODE_ENV}${ - process.env.STAGING ? ' staging' : '' - }`, - ); + logger.info(`🚀 Deploy stage: ${process.env.NODE_ENV}${process.env.STAGING ? ' staging' : ''}`); });