-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
62 lines (59 loc) · 1.83 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { FlatCompat } from '@eslint/eslintrc';
import pluginJs from '@eslint/js';
import prettier from 'eslint-config-prettier';
import globals from 'globals';
import path from 'path';
import { fileURLToPath } from 'url';
// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
export default [
pluginJs.configs.recommended,
...compat.extends('eslint-config-airbnb-base'),
prettier,
{
languageOptions: {
globals: {
...globals.node,
// 'jest' is not defined 오류
...globals.jest,
},
ecmaVersion: 'latest',
},
rules: {
// package import를 제외한 모든 import 구문에 대해 확장자를 사용하도록 강제
'import/extensions': ['error', 'ignorePackages'],
// 기타 사소한 오류 해결
'import/prefer-default-export': 'off',
'class-methods-use-this': 'off',
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'lines-between-class-members': [
'error',
'always',
{ exceptAfterSingleLine: true },
],
},
},
{
// 프로그래밍 요구 사항 적용
files: ['music/src/**/*.js'],
rules: {
// 함수의 매개변수 개수 제한
'max-params': ['error', 3],
// 함수의 길이 제한
'max-lines-per-function': ['error', { max: 20 }],
},
},
{
files: ['eslint.config.js'],
rules: {
// eslint.config.js 파일에서만 'no-underscore-dangle' 규칙을 비활성화
'no-underscore-dangle': 'off',
// package.json 파일이 위치한 프로젝트 루트 디렉토리 경로를 명시
'import/no-extraneous-dependencies': ['error', { packageDir: __dirname }],
},
},
];