@lvce-editor/eslint-config 1.11.0 → 1.12.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 +50 -51
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -7,6 +7,7 @@ import { mkdirSync } from 'node:fs'
7
7
  import { join } from 'node:path'
8
8
  import process from 'node:process'
9
9
  import tseslint from 'typescript-eslint'
10
+ import packageJson from 'eslint-plugin-package-json/configs/recommended'
10
11
 
11
12
  const root = process.cwd()
12
13
 
@@ -49,24 +50,66 @@ const fileCompositionConfig = createFileComposition({
49
50
  * @type {any}
50
51
  */
51
52
  const defaultConfig = tseslint.config(
52
- eslint.configs.recommended,
53
- ...tseslint.configs.recommendedTypeChecked,
54
53
  {
55
- languageOptions: {
56
- parserOptions: {
57
- projectService: true,
58
- tsconfigRootDir: root,
54
+ files: ['**/*.ts'],
55
+ extends: [
56
+ eslint.configs.recommended,
57
+ ...tseslint.configs.recommendedTypeChecked,
58
+ {
59
+ languageOptions: {
60
+ parserOptions: {
61
+ projectService: true,
62
+ tsconfigRootDir: root,
63
+ },
64
+ },
59
65
  },
66
+ ],
67
+ plugins: {
68
+ perfectionist,
69
+ },
70
+ rules: {
71
+ 'perfectionist/sort-imports': [
72
+ 'error',
73
+ {
74
+ type: 'natural',
75
+ order: 'asc',
76
+ newlinesBetween: 'never',
77
+ },
78
+ ],
79
+ '@typescript-eslint/consistent-type-exports': 'error',
80
+ '@typescript-eslint/consistent-type-imports': 'error',
81
+ '@typescript-eslint/explicit-function-return-type': 'error',
82
+ '@typescript-eslint/prefer-readonly-parameter-types': 'error',
83
+ 'no-console': ['error', { allow: ['warn', 'error'] }],
84
+ 'prefer-destructuring': ['error', { object: true, array: false }],
85
+
86
+ // off
87
+ '@typescript-eslint/no-explicit-any': 'off',
88
+ '@typescript-eslint/ban-ts-comment': 'off',
89
+ '@typescript-eslint/no-unsafe-member-access': 'off',
90
+ '@typescript-eslint/no-unsafe-assignment': 'off',
91
+ '@typescript-eslint/no-unsafe-call': 'off',
92
+ '@typescript-eslint/no-unsafe-return': 'off',
93
+ 'no-case-declarations': 'off',
94
+ '@typescript-eslint/no-unsafe-argument': 'off',
95
+ '@typescript-eslint/restrict-template-expressions': 'off',
96
+ '@typescript-eslint/require-await': 'off',
97
+ '@typescript-eslint/no-unused-vars': 'off', // handled by typescript
60
98
  },
61
99
  },
62
- pluginJest.configs['flat/recommended'],
63
100
  {
101
+ files: ['**/*.test.ts'],
102
+ extends: [pluginJest.configs['flat/recommended']],
64
103
  settings: {
65
104
  jest: {
66
105
  version: 29,
67
106
  },
68
107
  },
69
108
  },
109
+ {
110
+ files: ['**/package.json'],
111
+ extends: [packageJson],
112
+ },
70
113
  {
71
114
  ignores: [
72
115
  'dist',
@@ -84,50 +127,6 @@ const defaultConfig = tseslint.config(
84
127
  'packages/text-search-worker/src/textSearchWorkerMain.ts',
85
128
  ],
86
129
  },
87
- {
88
- rules: {
89
- '@typescript-eslint/consistent-type-exports': 'error',
90
- '@typescript-eslint/consistent-type-imports': 'error',
91
- '@typescript-eslint/explicit-function-return-type': 'error',
92
- '@typescript-eslint/prefer-readonly-parameter-types': 'error',
93
- 'no-console': ['error', { allow: ['warn', 'error'] }],
94
- },
95
- },
96
- {
97
- rules: {
98
- 'prefer-destructuring': ['error', { object: true, array: false }],
99
- },
100
- },
101
- {
102
- rules: {
103
- '@typescript-eslint/no-explicit-any': 'off',
104
- '@typescript-eslint/ban-ts-comment': 'off',
105
- '@typescript-eslint/no-unsafe-member-access': 'off',
106
- '@typescript-eslint/no-unsafe-assignment': 'off',
107
- '@typescript-eslint/no-unsafe-call': 'off',
108
- '@typescript-eslint/no-unsafe-return': 'off',
109
- 'no-case-declarations': 'off',
110
- '@typescript-eslint/no-unsafe-argument': 'off',
111
- '@typescript-eslint/restrict-template-expressions': 'off',
112
- '@typescript-eslint/require-await': 'off',
113
- '@typescript-eslint/no-unused-vars': 'off', // handled by typescript
114
- },
115
- },
116
- {
117
- plugins: {
118
- perfectionist,
119
- },
120
- rules: {
121
- 'perfectionist/sort-imports': [
122
- 'error',
123
- {
124
- type: 'natural',
125
- order: 'asc',
126
- newlinesBetween: 'never',
127
- },
128
- ],
129
- },
130
- },
131
130
  )
132
131
 
133
132
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/eslint-config",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "types": "index.d.ts",
@@ -24,7 +24,8 @@
24
24
  "eslint-plugin-n": "^17.15.1",
25
25
  "eslint-plugin-perfectionist": "^4.6.0",
26
26
  "eslint-plugin-project-structure": "^3.13.1",
27
- "typescript-eslint": "^8.20.0"
27
+ "typescript-eslint": "^8.20.0",
28
+ "eslint-plugin-package-json": "^0.19.0"
28
29
  },
29
30
  "peerDependencies": {
30
31
  "eslint": ">= 9"