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

Fix/eslint rules #1553

Merged
merged 8 commits into from
Feb 3, 2024
Merged
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
26 changes: 0 additions & 26 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ module.exports = {
},
],
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/member-delimiter-style': [
'off',
{
multiline: {
delimiter: 'none',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/naming-convention': [
'error',
{
Expand All @@ -45,7 +31,6 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
Expand All @@ -57,7 +42,6 @@ module.exports = {
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/triple-slash-reference': [
'error',
{
Expand All @@ -68,12 +52,6 @@ module.exports = {
],
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
eqeqeq: ['error', 'smart'],
'no-shadow': [
'off',
{
hoist: 'all',
},
],
},
overrides: [
{
Expand All @@ -88,12 +66,8 @@ module.exports = {
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/restrict-template-expressions': 'warn',
// for expectations
'@typescript-eslint/no-unused-expressions': 'off',
// Crashes also fail the test
'no-unsafe-optional-chaining': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
"dependencies": {
"@tsoa/runtime": "^6.0.0",
"@types/multer": "^1.4.11",
"deepmerge": "^4.3.1",
"fs-extra": "^11.2.0",
"glob": "^10.3.10",
"handlebars": "^4.7.8",
"merge-anything": "^5.1.4",
"minimatch": "^9.0.1",
"ts-deepmerge": "^7.0.0",
"typescript": "^5.3.3",
"validator": "^13.11.0",
"yamljs": "^0.3.0",
Expand Down
15 changes: 9 additions & 6 deletions packages/cli/src/swagger/specGenerator2.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { ExtendedSpecConfig } from '../cli';
import { merge as mergeAnything } from 'merge-anything'
import { merge as deepMerge } from 'ts-deepmerge';
import { Tsoa, assertNever, Swagger } from '@tsoa/runtime';
import { isVoidType } from '../utils/isVoidType';
import { convertColonPathParams, normalisePath } from './../utils/pathUtils';
import { DEFAULT_REQUEST_MEDIA_TYPE, DEFAULT_RESPONSE_MEDIA_TYPE, getValue } from './../utils/swaggerUtils';

import { SpecGenerator } from './specGenerator';
import { ExtendedSpecConfig } from '../cli';
import { isVoidType } from '../utils/isVoidType';
import { convertColonPathParams, normalisePath } from '../utils/pathUtils';
import { DEFAULT_REQUEST_MEDIA_TYPE, DEFAULT_RESPONSE_MEDIA_TYPE, getValue } from '../utils/swaggerUtils';
import { UnspecifiedObject } from '../utils/unspecifiedObject';
import { shouldIncludeValidatorInSchema } from '../utils/validatorUtils';

Expand Down Expand Up @@ -64,8 +67,8 @@ export class SpecGenerator2 extends SpecGenerator {
this.config.specMerging = this.config.specMerging || 'immediate';
const mergeFuncs: { [key: string]: any } = {
immediate: Object.assign,
recursive: require('merge-anything').merge,
deepmerge: (spec: UnspecifiedObject, merge: UnspecifiedObject): UnspecifiedObject => require('deepmerge').all([spec, merge]),
recursive: mergeAnything,
deepmerge: (spec: UnspecifiedObject, merge: UnspecifiedObject): UnspecifiedObject => deepMerge(spec, merge),
};

spec = mergeFuncs[this.config.specMerging](spec, this.config.spec);
Expand Down
9 changes: 6 additions & 3 deletions packages/cli/src/swagger/specGenerator3.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ExtendedSpecConfig } from '../cli';
import { merge as mergeAnything } from 'merge-anything'
import { merge as deepMerge } from 'ts-deepmerge';
import { Tsoa, assertNever, Swagger } from '@tsoa/runtime';

import { ExtendedSpecConfig } from '../cli';
import { isVoidType } from '../utils/isVoidType';
import { convertColonPathParams, normalisePath } from './../utils/pathUtils';
import { DEFAULT_REQUEST_MEDIA_TYPE, DEFAULT_RESPONSE_MEDIA_TYPE, getValue } from './../utils/swaggerUtils';
Expand Down Expand Up @@ -35,8 +38,8 @@ export class SpecGenerator3 extends SpecGenerator {
this.config.specMerging = this.config.specMerging || 'immediate';
const mergeFuncs: { [key: string]: any } = {
immediate: Object.assign,
recursive: require('merge-anything').merge,
deepmerge: (spec: UnspecifiedObject, merge: UnspecifiedObject): UnspecifiedObject => require('deepmerge').all([spec, merge]),
recursive: mergeAnything,
deepmerge: (spec: UnspecifiedObject, merge: UnspecifiedObject): UnspecifiedObject => deepMerge(spec, merge),
};

spec = mergeFuncs[this.config.specMerging](spec, this.config.spec);
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export interface SpecConfig {
* Possible values:
* - 'immediate' is overriding top level elements only thus you can not append a new path or alter an existing value without erasing same level elements.
* - 'recursive' proceed to a deep merge and will concat every branches or override or create new values if needed. @see https://www.npmjs.com/package/merge
* - 'deepmerge' uses `deepmerge` to merge, which will concat object branches and concat arrays as well @see https://www.npmjs.com/package/deepmerge
* - 'deepmerge' uses `ts-deepmerge` to merge, which will concat object branches and concat arrays as well @see https://www.npmjs.com/package/deepmerge @see https://github.com/voodoocreation/ts-deepmerge
* The default is set to immediate so it is not breaking previous versions.
* @default 'immediate'
*/
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2619,11 +2619,6 @@ deep-is@^0.1.3:
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831"
integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==

deepmerge@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a"
integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==

defaults@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.4.tgz#b0b02062c1e2aa62ff5d9528f0f98baa90978d7a"
Expand Down Expand Up @@ -6610,6 +6605,11 @@ ts-api-utils@^1.0.1:
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331"
integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==

ts-deepmerge@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/ts-deepmerge/-/ts-deepmerge-7.0.0.tgz#ee824dc177d452603348c7e6f3b90223434a6b44"
integrity sha512-WZ/iAJrKDhdINv1WG6KZIGHrZDar6VfhftG1QJFpVbOYZMYJLJOvZOo1amictRXVdBXZIgBHKswMTXzElngprA==

ts-node@^10.9.2:
version "10.9.2"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f"
Expand Down Expand Up @@ -6728,7 +6728,7 @@ typedarray@^0.0.6:

"typescript@>=3 < 6", typescript@^5.3.3:
version "5.3.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"
resolved "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"
integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==

uglify-js@^3.1.4:
Expand Down
Loading