Added linting so everything gets absolutly imported

This commit is contained in:
Mutzi 2022-08-25 19:59:53 +02:00
parent 6113478acd
commit c83319c300
13 changed files with 32 additions and 26 deletions

View File

@ -5,7 +5,7 @@ module.exports = {
tsconfigRootDir: __dirname, tsconfigRootDir: __dirname,
sourceType: 'module', sourceType: 'module',
}, },
plugins: ['@typescript-eslint/eslint-plugin'], plugins: ['@typescript-eslint/eslint-plugin', 'no-relative-import-paths'],
extends: [ extends: [
'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended', 'plugin:prettier/recommended',
@ -21,5 +21,9 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-explicit-any': 'off',
'no-relative-import-paths/no-relative-import-paths': [
'error',
{ 'allowSameFolder': true, 'rootDir': 'src' }
]
}, },
}; };

View File

@ -81,6 +81,7 @@
"copy-webpack-plugin": "^11.0.0", "copy-webpack-plugin": "^11.0.0",
"eslint": "^8.21.0", "eslint": "^8.21.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-no-relative-import-paths": "^1.4.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"jest": "^28.1.3", "jest": "^28.1.3",
"prettier": "^2.7.1", "prettier": "^2.7.1",

View File

@ -12,11 +12,11 @@ import {
UseGuards, UseGuards,
ValidationPipe ValidationPipe
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthService } from '../services/auth'; import { AuthService } from 'services/auth';
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { Public } from '../authguards'; import { Public } from 'authguards';
import { Requests, Responses } from 'dto'; import { Requests, Responses } from 'dto';
import { tfaTypes } from '../entities'; import { tfaTypes } from 'entities';
import { toDataURL } from 'qrcode'; import { toDataURL } from 'qrcode';
import * as base32 from 'thirty-two'; import * as base32 from 'thirty-two';

View File

@ -10,9 +10,9 @@ import {
ValidationPipe ValidationPipe
} from '@nestjs/common'; } from '@nestjs/common';
import { Responses, Requests, validateAsyncInline } from 'dto'; import { Responses, Requests, validateAsyncInline } from 'dto';
import FileSystemService from '../services/filesystem'; import FileSystemService from 'services/filesystem';
import { UserRole } from '../entities'; import { UserRole } from 'entities';
import { Role } from '../authguards'; import { Role } from 'authguards';
@Controller('api/fs') @Controller('api/fs')
export default class FileSystemController { export default class FileSystemController {

View File

@ -1,5 +1,5 @@
import { Controller, Get, Post, Request } from '@nestjs/common'; import { Controller, Get, Post, Request } from '@nestjs/common';
import { AuthService } from '../services/auth'; import { AuthService } from 'services/auth';
import { Responses } from 'dto'; import { Responses } from 'dto';
@Controller('api/user') @Controller('api/user')

View File

@ -1,14 +1,10 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm'; import { TypeOrmModule } from '@nestjs/typeorm';
import { INode, JWTToken, User } from '../entities'; import { INode, JWTToken, User } from 'entities';
import { import { AuthService, AuthLocalService, AuthJwtService } from 'services/auth';
AuthService, import FileSystemService from 'services/filesystem';
AuthLocalService, import AuthController from 'controller/auth';
AuthJwtService import UserController from 'controller/user';
} from '../services/auth';
import FileSystemService from '../services/filesystem';
import AuthController from '../controller/auth';
import UserController from '../controller/user';
@Module({ @Module({
imports: [TypeOrmModule.forFeature([User, INode, JWTToken])], imports: [TypeOrmModule.forFeature([User, INode, JWTToken])],

View File

@ -1,8 +1,8 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm'; import { TypeOrmModule } from '@nestjs/typeorm';
import { INode } from '../entities'; import { INode } from 'entities';
import FileSystemService from '../services/filesystem'; import FileSystemService from 'services/filesystem';
import FileSystemController from '../controller/filesystem'; import FileSystemController from 'controller/filesystem';
@Module({ @Module({
imports: [TypeOrmModule.forFeature([INode])], imports: [TypeOrmModule.forFeature([INode])],

View File

@ -4,10 +4,10 @@ import {
UnauthorizedException UnauthorizedException
} from '@nestjs/common'; } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { JWTToken, User, UserRole } from '../../entities'; import { JWTToken, User, UserRole } from 'entities';
import { LessThanOrEqual, Repository } from 'typeorm'; import { LessThanOrEqual, Repository } from 'typeorm';
import * as argon2 from 'argon2'; import * as argon2 from 'argon2';
import FileSystemService from '../filesystem'; import FileSystemService from 'services/filesystem';
import * as jwt from 'jsonwebtoken'; import * as jwt from 'jsonwebtoken';
export const jwtSecret = 'CUM'; export const jwtSecret = 'CUM';

View File

@ -1,4 +1,4 @@
import { User, UserRole } from '../../entities'; import { User, UserRole } from 'entities';
import { FastifyRequest } from 'fastify'; import { FastifyRequest } from 'fastify';
import axios from 'axios'; import axios from 'axios';
import * as argon2 from 'argon2'; import * as argon2 from 'argon2';

View File

@ -1,4 +1,4 @@
import { tfaTypes, User } from '../../entities'; import { tfaTypes, User } from 'entities';
import { BadRequestException } from '@nestjs/common'; import { BadRequestException } from '@nestjs/common';
import BaseAuthService from './base'; import BaseAuthService from './base';
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';

View File

@ -6,7 +6,7 @@ import {
UnauthorizedException UnauthorizedException
} from '@nestjs/common'; } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { INode, User } from '../entities'; import { INode, User } from 'entities';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { Multipart } from '@fastify/multipart'; import { Multipart } from '@fastify/multipart';
import { pipeline } from 'stream/promises'; import { pipeline } from 'stream/promises';

View File

@ -9,7 +9,7 @@
"target": "es2017", "target": "es2017",
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",
"baseUrl": "./", "baseUrl": "./src",
"incremental": true, "incremental": true,
"skipLibCheck": true, "skipLibCheck": true,
"resolveJsonModule": true, "resolveJsonModule": true,

View File

@ -2465,6 +2465,11 @@ eslint-config-prettier@^8.5.0:
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz#5a81680ec934beca02c7b1a61cf8ca34b66feab1" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz#5a81680ec934beca02c7b1a61cf8ca34b66feab1"
integrity sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q== integrity sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==
eslint-plugin-no-relative-import-paths@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-no-relative-import-paths/-/eslint-plugin-no-relative-import-paths-1.4.0.tgz#59489ebc19688d1398bfe53d3ad320b3ed42ca17"
integrity sha512-J/ok26KqJM+20VsxNEcHc9kyW0dcFHBlihOO5FFv/GQqwcW+G1UngbHLpnPAdOQ1dJg5Ljk/40csqfZ3mnneUw==
eslint-plugin-prettier@^4.2.1: eslint-plugin-prettier@^4.2.1:
version "4.2.1" version "4.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"