Skip to content

Commit

Permalink
fix: fix eslint run command, make eslint rules stricter, do not prett…
Browse files Browse the repository at this point in the history
…ier the dist folder

Signed-off-by: Ute Weiss <[email protected]>
  • Loading branch information
weissu42 committed Aug 27, 2021
1 parent 2f42159 commit 4c8d7a2
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 6 deletions.
171 changes: 168 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,181 @@ module.exports = {
project: 'tsconfig.eslint.json',
sourceType: 'module',
},
plugins: ['eslint-plugin-import', 'eslint-plugin-jsdoc', 'eslint-plugin-prefer-arrow', '@typescript-eslint'],
rules: {
'comma-dangle': ['error', 'always-multiline'],
'jest/expect-expect': [
'error',
{
assertFunctionNames: ['expect*', 'verify'],
assertFunctionNames: ['expect*', 'verify*'],
},
],
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': [
'error',
{
default: 'array',
},
],
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'forbid',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'forbid',
},
{
selector: 'enumMember',
format: ['camelCase', 'UPPER_CASE'],
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
],
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/quotes': 'off',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/semi': ['off', null],
'@typescript-eslint/strict-boolean-expressions': [
'error',
{
allowNullableObject: true,
allowNullableBoolean: false,
allowNullableString: false,
},
],
'@typescript-eslint/triple-slash-reference': [
'error',
{
path: 'always',
types: 'prefer-import',
lib: 'always',
},
],
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unified-signatures': 'error',
'arrow-parens': ['error', 'always'],
'brace-style': ['off', 'off'],
'comma-dangle': 'off',
complexity: 'off',
'constructor-super': 'error',
'eol-last': 'off',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'error',
'id-blacklist': [
'error',
'any',
'Number',
'number',
'String',
'string',
'Boolean',
'boolean',
'Undefined',
'undefined',
],
'id-match': 'error',
'import/no-deprecated': 'error',
'import/no-extraneous-dependencies': 'off',
'import/no-internal-modules': 'off',
'import/order': 'off',
'jsdoc/check-alignment': 'error',
'jsdoc/check-indentation': 'error',
'jsdoc/newline-after-description': 'error',
'linebreak-style': 'off',
'max-classes-per-file': 'off',
'max-len': 'off',
'new-parens': 'off',
'newline-per-chained-call': 'off',
'no-bitwise': 'error',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-empty': 'error',
'no-eval': 'error',
'no-extra-bind': 'error',
'no-extra-semi': 'off',
'no-fallthrough': 'off',
'no-invalid-this': 'off',
'no-irregular-whitespace': 'off',
'no-multiple-empty-lines': 'off',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-redeclare': 'error',
'no-return-await': 'error',
'no-sequences': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-trailing-spaces': 'off',
'no-undef-init': 'error',
'no-unsafe-finally': 'error',
'no-unused-labels': 'error',
'no-var': 'error',
'no-void': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'prefer-const': 'error',
'@typescript-eslint/strict-boolean-expressions': 'off',
'quote-props': 'off',
radix: 'error',
'react/jsx-curly-spacing': 'off',
'react/jsx-equals-spacing': 'off',
'react/jsx-wrap-multilines': 'off',
'space-before-function-paren': 'off',
'space-in-parens': ['off', 'never'],
'spaced-comment': [
'error',
'always',
{
markers: ['/'],
},
],
'use-isnan': 'error',
'valid-typeof': 'off',
},
ignorePatterns: ['dist', 'tsconfig.json', 'tsconfig.eslint.json'],
};
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"test": "jest --detectOpenHandles --forceExit",
"test:unit": "npm run test \"^((?!\\.integration\\.).)*$\"",
"test:integration": "npm run test integration",
"lint": "prettier --check \"**/*.{ts,tsx}\" --ignore-path \".gitignore\" && eslint .",
"format": "prettier --write \"**/*.{ts,tsx}\" --ignore-path \".gitignore\" && eslint . --fix"
"lint": "prettier --check \"**/*.ts\" && eslint \"**/*.{ts,js,json}\"",
"format": "prettier --write \"**/*.ts\" && eslint \"**/*.{ts,js,json}\""
},
"dependencies": {
"human-interval": "2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion test/connect.integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('connect', () => {
url = await mongo.getUri();
});

afterAll(async () => await mongo.stop());
afterAll(async () => mongo.stop());

it('connects mongo', async () => {
await connect({ url });
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "dist",
Expand Down

0 comments on commit 4c8d7a2

Please sign in to comment.