feat: server lint import & order (#750)

This commit is contained in:
Jérémy M
2023-07-19 14:01:32 +02:00
committed by GitHub
parent 8af88d1ab3
commit ce3e023a00
155 changed files with 1165 additions and 304 deletions

View File

@ -5,7 +5,7 @@ module.exports = {
tsconfigRootDir : __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
plugins: ['@typescript-eslint/eslint-plugin', 'import'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
@ -22,5 +22,57 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'func-style':['error', 'declaration', { 'allowArrowFunctions': true }],
'no-restricted-imports': [
'error',
{
'patterns': [
{
'group': ['**../'],
'message': 'Relative imports are not allowed.',
},
],
},
],
'import/order': [
'error',
{
'newlines-between': 'always',
groups: [
'builtin',
'external',
'internal',
'type',
'parent',
'sibling',
'object',
'index',
],
pathGroups: [
{
pattern: '@nestjs/**',
group: 'builtin',
position: 'before',
},
{
pattern: '**/interfaces/**',
group: 'type',
position: 'before',
},
{
pattern: 'src/**',
group: 'parent',
position: 'before',
},
{
pattern: './*',
group: 'sibling',
position: 'before',
},
],
distinctGroup: true,
warnOnUnassignedImports: true,
pathGroupsExcludedImportTypes: ['@nestjs/**'],
},
],
},
};