@3o3/eslint-config 0.2.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3o3/eslint-config",
3
- "version": "0.2.0",
3
+ "version": "1.0.0",
4
4
  "description": "3o3 공유 ESLint 설정 — 사용처에 따라 레이어(base/react/docs/all)를 골라 쓴다.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
package/src/base.js CHANGED
@@ -33,7 +33,7 @@ const base = tseslint.config({
33
33
  globals: {
34
34
  ...globals.node,
35
35
  ...globals.browser,
36
- ...globals.jest,
36
+ ...globals.vitest,
37
37
  ...globals.es2021,
38
38
  },
39
39
  parserOptions: {
package/src/docs.js CHANGED
@@ -28,7 +28,6 @@ const disabledJsdocRules = {
28
28
  // ── ESLint 9에서 작동 불가: 플러그인이 직접 "이 룰 끄고 processor 쓰라"고 출력 ──
29
29
  'jsdoc/check-examples': 'off',
30
30
  'jsdoc/require-template': 'off',
31
- 'jsdoc/require-example': 'off',
32
31
  }
33
32
 
34
33
  export function docs({ files = ['**/src/**/*.{ts,tsx}'] } = {}) {
@@ -53,7 +52,16 @@ export function docs({ files = ['**/src/**/*.{ts,tsx}'] } = {}) {
53
52
  rules: {
54
53
  ...disabledJsdocRules,
55
54
  'jsdoc/informative-docs': 'off',
56
-
55
+ 'jsdoc/require-example': [
56
+ 'error',
57
+ {
58
+ enableFixer: false,
59
+ contexts: [
60
+ 'ExportNamedDeclaration > FunctionDeclaration',
61
+ 'ExportNamedDeclaration > VariableDeclaration > VariableDeclarator > ArrowFunctionExpression',
62
+ ],
63
+ },
64
+ ],
57
65
  'jsdoc/require-jsdoc': [
58
66
  'error',
59
67
  {
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import base from './base.js'
2
2
  import reactLayer from './react.js'
3
+ import testsLayer from './tests.js'
3
4
  import all from './all.js'
4
5
  import { docs } from './docs.js'
5
6
  import eslintConfigPrettier from 'eslint-config-prettier'
@@ -34,6 +35,7 @@ const plugin = {
34
35
  configs: {
35
36
  base,
36
37
  react: reactLayer,
38
+ tests: testsLayer,
37
39
  all,
38
40
  },
39
41
  docs,
@@ -45,5 +47,6 @@ export default plugin
45
47
  // 배열 스프레드용 named export (기존 방식 유지)
46
48
  export { base, all }
47
49
  export { reactLayer as react }
50
+ export { testsLayer as tests }
48
51
  export { docs }
49
52
  export { eslintConfigPrettier as prettier }
package/src/tests.js ADDED
@@ -0,0 +1,30 @@
1
+ import tseslint from 'typescript-eslint'
2
+
3
+ /**
4
+ * tests 레이어 — 테스트 파일에만 적용하는 완화 규칙.
5
+ *
6
+ * 대상: `**\/__tests__/**\/*.{ts,tsx}` 와 `**\/*.spec.{ts,tsx}` (레포 테스트 컨벤션).
7
+ *
8
+ * 테스트는 목·스텁·DOM 노드 접근 때문에 non-null 어설션(`!`)을 자연스럽게 쓰고,
9
+ * 임시 픽스처 배열 타입도 `T[]` 로 두는 편이 읽기 쉽다. 프로덕션 코드에는
10
+ * `no-non-null-assertion`(warn)·`array-type`(array-simple) 을 유지하되, 테스트
11
+ * 파일에서는 off 한다. base/react 레이어 뒤에 스프레드해야 오버라이드가 적용된다.
12
+ *
13
+ * @example
14
+ * ```js
15
+ * import { defineConfig } from 'eslint/config'
16
+ * import threeo3 from '@3o3/eslint-config'
17
+ * export default defineConfig([
18
+ * { plugins: { '@3o3': threeo3 }, extends: ['@3o3/base', '@3o3/react', '@3o3/tests'] },
19
+ * ])
20
+ * ```
21
+ */
22
+ const tests = tseslint.config({
23
+ files: ['**/__tests__/**/*.{ts,tsx}', '**/*.spec.{ts,tsx}'],
24
+ rules: {
25
+ '@typescript-eslint/no-non-null-assertion': 'off',
26
+ '@typescript-eslint/array-type': 'off',
27
+ },
28
+ })
29
+
30
+ export default tests