@dubium/eslint-config 1.0.13 → 1.0.15

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/README.md +95 -25
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -14,9 +14,9 @@ Install the config and the required peer dependencies according to your needs.
14
14
  ### 🔹 Base configuration (`base`)
15
15
 
16
16
  ```bash
17
- npm install -D eslint @dubium/eslint-config
17
+ npm install -D eslint @eslint/js globals @dubium/eslint-config
18
18
  # or
19
- yarn add -D eslint @dubium/eslint-config
19
+ yarn add -D eslint @eslint/js globals @dubium/eslint-config
20
20
  ```
21
21
 
22
22
  <sub>It is also recommended to install `globals` if you use global variables in your ESLint config.</sub>
@@ -26,9 +26,9 @@ yarn add -D eslint @dubium/eslint-config
26
26
  ### 🔹 TypeScript (`typescript`)
27
27
 
28
28
  ```bash
29
- npm install -D @typescript-eslint/parser @typescript-eslint/eslint-plugin
29
+ npm install -D typescript-eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
30
30
  # or
31
- yarn add -D @typescript-eslint/parser @typescript-eslint/eslint-plugin
31
+ yarn add -D typescript-eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
32
32
  ```
33
33
 
34
34
  ---
@@ -53,28 +53,19 @@ yarn add -D eslint-plugin-jsx-a11y
53
53
 
54
54
  ---
55
55
 
56
- ## ⚙️ Usage
56
+ ### 🔹 Prettier
57
57
 
58
- Create an `eslint.config.js` file:
58
+ ```bash
59
+ npm install -D prettier eslint-config-prettier eslint-plugin-prettier
60
+ # or
61
+ yarn add -D prettier eslint-config-prettier eslint-plugin-prettier
62
+ ```
59
63
 
60
- ```js
61
- import { defineConfig } from "eslint/config";
62
- import {
63
- base,
64
- typescript,
65
- react,
66
- jsxA11y,
67
- } from "@dubium/eslint-config";
64
+ ###
68
65
 
69
- export default defineConfig([
70
- base,
71
- typescript,
72
- react,
73
- jsxA11y,
74
- ]);
75
- ```
66
+ ## ⚙️ Usage
76
67
 
77
- Or
68
+ Create an `eslint.config.cjs` file:
78
69
 
79
70
  ```js
80
71
  import { defineConfig } from "eslint/config"
@@ -82,7 +73,10 @@ import { base } from "@dubium/eslint-config/base"
82
73
  import { typescript } from "@dubium/eslint-config/typescript"
83
74
  import { react } from "@dubium/eslint-config/react"
84
75
  import globals from "globals"
76
+ import prettier from "eslint-config-prettier"
77
+ import eslintPluginPrettier from "eslint-plugin-prettier"
85
78
 
79
+ // Модифицируем typescript конфиг для поддержки type-aware правил
86
80
  const enhancedTypescript = {
87
81
  ...typescript,
88
82
  languageOptions: {
@@ -91,17 +85,23 @@ const enhancedTypescript = {
91
85
  ...( typescript.languageOptions?.parserOptions || {} ),
92
86
  project: "./tsconfig.json",
93
87
  tsconfigRootDir: process.cwd(),
94
- // Support path aliases (@/*)
88
+ // Для поддержки path aliases (@/*)
95
89
  EXPERIMENTAL_useProjectService: true,
96
90
  },
97
91
  },
98
92
  }
99
93
 
100
- export default defineConfig([
94
+ export default defineConfig( [
101
95
  base,
102
96
  enhancedTypescript,
103
97
  react,
104
98
  {
99
+ plugins: {
100
+ prettier: eslintPluginPrettier,
101
+ },
102
+ rules: {
103
+ "prettier/prettier": "error",
104
+ },
105
105
  languageOptions: {
106
106
  globals: {
107
107
  ...globals.node,
@@ -109,8 +109,78 @@ export default defineConfig([
109
109
  },
110
110
  },
111
111
  },
112
- ])
112
+ prettier,
113
+ {
114
+ files: [ "**/*.schema.ts" ],
115
+ rules: {
116
+ "@typescript-eslint/no-unsafe-call": "off",
117
+ "@typescript-eslint/no-unsafe-assignment": "off"
118
+ }
119
+ }
120
+ ] )
121
+
122
+
123
+ ```
113
124
 
125
+ ### Or Example for Nestjs
126
+
127
+ ```js
128
+ import { defineConfig } from "eslint/config"
129
+ import { base } from "@dubium/eslint-config/base"
130
+ import { typescript } from "@dubium/eslint-config/typescript"
131
+ import globals from "globals"
132
+ import prettier from "eslint-config-prettier"
133
+ import eslintPluginPrettier from "eslint-plugin-prettier"
134
+
135
+ // Модифицируем typescript конфиг для поддержки type-aware правил
136
+ const enhancedTypescript = {
137
+ ...typescript,
138
+ languageOptions: {
139
+ ...typescript.languageOptions,
140
+ parserOptions: {
141
+ ...(typescript.languageOptions?.parserOptions || {}),
142
+ project: "./tsconfig.json",
143
+ tsconfigRootDir: process.cwd(),
144
+ // Для поддержки path aliases (@/*)
145
+ EXPERIMENTAL_useProjectService: true,
146
+ },
147
+ },
148
+ }
149
+
150
+ export default defineConfig([
151
+ base,
152
+ enhancedTypescript,
153
+ {
154
+ plugins: {
155
+ prettier: eslintPluginPrettier,
156
+ },
157
+ rules: {
158
+ "prettier/prettier": "error",
159
+ },
160
+ languageOptions: {
161
+ globals: {
162
+ ...globals.node,
163
+ ...globals.jest,
164
+ },
165
+ },
166
+ },
167
+ prettier,
168
+ {
169
+ rules: {
170
+ "@typescript-eslint/no-unsafe-call": "off",
171
+ "@typescript-eslint/no-unsafe-assignment": "off",
172
+ "new-cap": [
173
+ "error",
174
+ {
175
+ capIsNew: false,
176
+ newIsCap: false,
177
+ properties: true,
178
+ },
179
+ ],
180
+ "class-methods-use-this": "off",
181
+ },
182
+ },
183
+ ])
114
184
  ```
115
185
 
116
186
  You can also use only the configs you need:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dubium/eslint-config",
3
3
  "private": false,
4
- "version": "1.0.13",
4
+ "version": "1.0.15",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -36,7 +36,7 @@
36
36
  "author": "https://github.com/DubiumEkb",
37
37
  "license": "MIT",
38
38
  "scripts": {
39
- "version:push": "yarn publish --access=public",
39
+ "version:push": "npm publish --access=public",
40
40
  "lint:inspect": "npx eslint --inspect-config"
41
41
  },
42
42
  "peerDependenciesMeta": {