@lvce-editor/eslint-config 1.6.0 → 1.8.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.
Files changed (2) hide show
  1. package/index.js +67 -2
  2. package/package.json +2 -1
package/index.js CHANGED
@@ -1,11 +1,60 @@
1
- import perfectionist from 'eslint-plugin-perfectionist'
2
1
  import eslint from '@eslint/js'
3
- import tseslint from 'typescript-eslint'
4
2
  import nodePlugin from 'eslint-plugin-n'
3
+ import perfectionist from 'eslint-plugin-perfectionist'
4
+ import { createFileComposition, createFolderStructure, projectStructurePlugin } from 'eslint-plugin-project-structure'
5
+ import tseslint from 'typescript-eslint'
6
+ import process from 'node:process'
7
+ import { join } from 'node:path'
8
+ import { mkdirSync } from 'node:fs'
9
+
10
+ const root = process.cwd()
11
+
12
+ mkdirSync(join(root, '.tmp'), { recursive: true })
13
+
14
+ const folderStructureConfig = createFolderStructure({
15
+ projectRoot: root,
16
+ structure: [
17
+ {
18
+ name: 'src',
19
+ children: [
20
+ {
21
+ name: '{camelCase}.ts',
22
+ },
23
+ {
24
+ name: 'parts',
25
+ children: [
26
+ {
27
+ name: '{PascalCase}',
28
+ children: [{ name: '{FolderName}.ts' }],
29
+ },
30
+ ],
31
+ },
32
+ ],
33
+ },
34
+ ],
35
+ })
36
+
37
+ const fileCompositionConfig = createFileComposition({
38
+ filesRules: [
39
+ {
40
+ filePattern: '**/*.ts',
41
+ rootSelectorsLimits: [{ selector: ['interface', 'type', 'function', 'arrowFunction', 'class'], limit: 1 }],
42
+ rules: [],
43
+ },
44
+ ],
45
+ })
5
46
 
6
47
  export default tseslint.config(
7
48
  eslint.configs.recommended,
8
49
  ...tseslint.configs.recommendedTypeChecked,
50
+ {
51
+ languageOptions: {
52
+ parserOptions: {
53
+ projectService: true,
54
+ tsconfigRootDir: root,
55
+ },
56
+ },
57
+ },
9
58
  nodePlugin.configs['flat/recommended'],
10
59
  {
11
60
  ignores: [
@@ -76,4 +125,20 @@ export default tseslint.config(
76
125
  ],
77
126
  },
78
127
  },
128
+ {
129
+ files: ['src/**/*.ts'],
130
+ plugins: {
131
+ 'project-structure': projectStructurePlugin,
132
+ },
133
+ rules: {
134
+ // If you have many rules in a separate file.
135
+ 'project-structure/file-composition': ['error', fileCompositionConfig],
136
+ 'project-structure/folder-structure': ['error', folderStructureConfig],
137
+ },
138
+ },
139
+ {
140
+ settings: {
141
+ 'project-structure/cache-location': join(root, '.tmp'),
142
+ },
143
+ },
79
144
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/eslint-config",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "types": "index.d.ts",
@@ -22,6 +22,7 @@
22
22
  "@eslint/js": "^9.18.0",
23
23
  "eslint-plugin-n": "^17.15.1",
24
24
  "eslint-plugin-perfectionist": "^4.6.0",
25
+ "eslint-plugin-project-structure": "^3.13.1",
25
26
  "typescript-eslint": "^8.20.0"
26
27
  },
27
28
  "peerDependencies": {