Skip to content

Commit

Permalink
feat(): migrate from tslint to eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Feb 21, 2020
1 parent dbd924c commit f3c2557
Show file tree
Hide file tree
Showing 11 changed files with 793 additions and 44 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/**
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint'
],
root: true,
env: {
node: true,
jest: true
},
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-unused-vars': 'off'
}
};
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ jest.json
index.ts
plugin.ts
package-lock.json
tslint.json
.eslintignore
.eslintrc.js
tsconfig.json
.prettierrc
.circleci
Expand Down
3 changes: 2 additions & 1 deletion lib/decorators/api-hide-property.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-empty-function */
export function ApiHideProperty(): PropertyDecorator {
return (target: Object, propertyKey: string | symbol) => {};
return (target: Record<string, any>, propertyKey: string | symbol) => {};
}
2 changes: 1 addition & 1 deletion lib/document-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class DocumentBuilder {

public addTag(
name: string,
description: string = '',
description = '',
externalDocs?: ExternalDocumentationObject
): this {
this.document.tags = this.document.tags.concat(
Expand Down
2 changes: 1 addition & 1 deletion lib/interfaces/open-api-spec.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export interface LinkObject {
}

export type LinkParametersObject = Record<string, any>;
export interface HeaderObject extends BaseParameterObject {}
export type HeaderObject = BaseParameterObject;
export interface TagObject {
name: string;
description?: string;
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/visitors/model-class.visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class ModelClassVisitor extends AbstractFileVisitor {
ts.PropertyAssignment
> = ts.createNodeArray(),
options: PluginOptions = {},
hostFilename: string = ''
hostFilename = ''
): ts.ObjectLiteralExpression {
const isRequired = !node.questionToken;

Expand Down
3 changes: 2 additions & 1 deletion lib/swagger-explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export class SwaggerExplorer {
path = validatePath(globalPrefix) + path;
}

// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
const globalMetadata = this.exploreGlobalMetadata(metatype);
const ctrlExtraModels = exploreGlobalApiExtraModelsMetadata(metatype);
Expand Down Expand Up @@ -257,7 +258,7 @@ export class SwaggerExplorer {
globalValue: Record<string, any> | Array<any>,
methodValue: Record<string, any> | Array<any>,
maxDepth: number,
currentDepthLevel: number = 0
currentDepthLevel = 0
) {
if (currentDepthLevel === maxDepth) {
return this.mergeValues(globalValue, methodValue);
Expand Down
Loading

0 comments on commit f3c2557

Please sign in to comment.