chore: Configureer linter (ESLint)
This commit is contained in:
		
							parent
							
								
									977b49f659
								
							
						
					
					
						commit
						df2f26482c
					
				
					 3 changed files with 132 additions and 30 deletions
				
			
		
							
								
								
									
										11
									
								
								backend/eslint.config.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								backend/eslint.config.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| import globals from 'globals'; | ||||
| import rootConfig from '../eslint.config'; | ||||
| 
 | ||||
| export default [ | ||||
|     ...rootConfig, | ||||
|     { | ||||
|         languageOptions: { | ||||
|             globals: globals.node, | ||||
|         }, | ||||
|     }, | ||||
| ]; | ||||
							
								
								
									
										82
									
								
								eslint.config.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								eslint.config.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,82 @@ | |||
| import pluginJs from '@eslint/js'; | ||||
| import tseslint from 'typescript-eslint'; | ||||
| import prettierConfig from 'eslint-config-prettier'; | ||||
| 
 | ||||
| import { includeIgnoreFile } from '@eslint/compat'; | ||||
| import path from 'node:path'; | ||||
| import { fileURLToPath } from 'node:url'; | ||||
| 
 | ||||
| const __filename = fileURLToPath(import.meta.url); | ||||
| const __dirname = path.dirname(__filename); | ||||
| const gitignorePath = path.resolve(__dirname, '.gitignore'); | ||||
| 
 | ||||
| export default [ | ||||
|     pluginJs.configs.recommended, | ||||
|     ...tseslint.configs.recommended, | ||||
|     prettierConfig, | ||||
|     includeIgnoreFile(gitignorePath), | ||||
|     { | ||||
|         ignores: ['**/dist/**', '**/.node_modules/**', '**/coverage/**'], | ||||
|     }, | ||||
|     { | ||||
|         languageOptions: { | ||||
|             ecmaVersion: 'latest', | ||||
|             sourceType: 'module', | ||||
|         }, | ||||
|         linterOptions: { | ||||
|             reportUnusedInlineConfigs: 'error', | ||||
|         }, | ||||
|         rules: { | ||||
|             'no-await-in-loop': 'warn', | ||||
|             'no-constructor-return': 'error', | ||||
|             'no-duplicate-imports': 'error', | ||||
|             'no-inner-declarations': 'error', | ||||
|             'no-self-compare': 'error', | ||||
|             'no-template-curly-in-string': 'error', | ||||
|             'no-unmodified-loop-condition': 'warn', | ||||
|             'no-unreachable-loop': 'warn', | ||||
|             'no-use-before-define': 'error', | ||||
|             'no-useless-assignment': 'error', | ||||
| 
 | ||||
|             'arrow-body-style': ['warn', 'always'], | ||||
|             'block-scoped-var': 'warn', | ||||
|             camelcase: 'warn', | ||||
|             'capitalized-comments': 'warn', | ||||
|             'consistent-return': 'warn', | ||||
|             'consistent-this': 'error', | ||||
|             curly: 'error', | ||||
|             'default-case': 'error', | ||||
|             'default-case-last': 'error', | ||||
|             'default-param-last': 'error', | ||||
|             'dot-notation': 'warn', | ||||
|             eqeqeq: 'error', | ||||
|             'func-names': 'warn', | ||||
|             'func-style': ['warn', 'declaration'], | ||||
|             'grouped-accessor-pairs': ['warn', 'getBeforeSet'], | ||||
|             'guard-for-in': 'warn', | ||||
|             'logical-assignment-operators': 'warn', | ||||
|             'max-classes-per-file': 'warn', | ||||
|             'no-alert': 'error', | ||||
|             'no-array-constructor': 'warn', | ||||
|             'no-bitwise': 'warn', | ||||
|             'no-console': 'warn', | ||||
|             'no-continue': 'warn', | ||||
|             'no-else-return': 'warn', | ||||
|             'no-empty-function': 'warn', | ||||
|             'no-eq-null': 'error', | ||||
|             'no-eval': 'error', | ||||
|             'no-extend-native': 'error', | ||||
|             'no-extra-label': 'error', | ||||
|             'no-implicit-coercion': 'warn', | ||||
|             'no-implied-eval': 'error', | ||||
|             'no-invalid-this': 'error', | ||||
|             'no-iterator': 'error', | ||||
|             'no-label-var': 'warn', | ||||
|             'no-labels': 'warn', | ||||
|             'no-loop-func': 'error', | ||||
|             'no-multi-assign': 'error', | ||||
|             'no-nested-ternary': 'error', | ||||
|             'no-object-constructor': 'error', | ||||
|         }, | ||||
|     }, | ||||
| ]; | ||||
|  | @ -1,15 +1,19 @@ | |||
| import pluginVue from 'eslint-plugin-vue' | ||||
| import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript' | ||||
| import pluginVitest from '@vitest/eslint-plugin' | ||||
| import pluginPlaywright from 'eslint-plugin-playwright' | ||||
| import skipFormatting from '@vue/eslint-config-prettier/skip-formatting' | ||||
| import pluginVue from 'eslint-plugin-vue'; | ||||
| import { | ||||
|     defineConfigWithVueTs, | ||||
|     vueTsConfigs, | ||||
| } from '@vue/eslint-config-typescript'; | ||||
| import pluginVitest from '@vitest/eslint-plugin'; | ||||
| import pluginPlaywright from 'eslint-plugin-playwright'; | ||||
| import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'; | ||||
| import rootConfig from '../eslint.config'; | ||||
| 
 | ||||
| // To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
 | ||||
| // import { configureVueProject } from '@vue/eslint-config-typescript'
 | ||||
| // configureVueProject({ scriptLangs: ['ts', 'tsx'] })
 | ||||
| // Import { configureVueProject } from '@vue/eslint-config-typescript'
 | ||||
| // ConfigureVueProject({ scriptLangs: ['ts', 'tsx'] })
 | ||||
| // More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
 | ||||
| 
 | ||||
| export default defineConfigWithVueTs( | ||||
| const vueConfig = defineConfigWithVueTs( | ||||
|     { | ||||
|         name: 'app/files-to-lint', | ||||
|         files: ['**/*.{ts,mts,tsx,vue}'], | ||||
|  | @ -32,5 +36,10 @@ export default defineConfigWithVueTs( | |||
|         ...pluginPlaywright.configs['flat/recommended'], | ||||
|         files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'], | ||||
|     }, | ||||
|   skipFormatting, | ||||
| ) | ||||
|     skipFormatting | ||||
| ); | ||||
| 
 | ||||
| export default [ | ||||
|     ...rootConfig, | ||||
|     ...vueConfig | ||||
| ] | ||||
|  |  | |||
		Reference in a new issue