@deot/dev-eslint 2.8.3 → 2.9.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 (3) hide show
  1. package/dist/index.cjs +40 -10
  2. package/dist/index.js +21 -10
  3. package/package.json +12 -12
package/dist/index.cjs CHANGED
@@ -8,9 +8,28 @@ const js = require('@eslint/js');
8
8
  const globals = require('globals');
9
9
  const pluginJsdoc = require('eslint-plugin-jsdoc');
10
10
  const pluginMarkdown = require('eslint-plugin-markdown');
11
- const pluginImport = require('eslint-plugin-import');
11
+ const pluginImport = require('eslint-plugin-import-x');
12
12
  const pluginStylistic = require('@stylistic/eslint-plugin');
13
13
 
14
+ function _interopNamespaceDefault(e) {
15
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
16
+ if (e) {
17
+ for (const k in e) {
18
+ if (k !== 'default') {
19
+ const d = Object.getOwnPropertyDescriptor(e, k);
20
+ Object.defineProperty(n, k, d.get ? d : {
21
+ enumerable: true,
22
+ get: () => e[k]
23
+ });
24
+ }
25
+ }
26
+ }
27
+ n.default = e;
28
+ return Object.freeze(n);
29
+ }
30
+
31
+ const parserTs__namespace = /*#__PURE__*/_interopNamespaceDefault(parserTs);
32
+
14
33
  const pickOptions = async (key, options) => {
15
34
  const configOptions = {
16
35
  enable: typeof options?.[key] === "boolean" ? options[key] : true,
@@ -76,7 +95,6 @@ const typescript = async (options$) => {
76
95
  "@typescript-eslint/no-shadow": 2,
77
96
  // https://github.com/typescript-eslint/typescript-eslint/issues/2483
78
97
  "@typescript-eslint/no-unused-vars": 1,
79
- "@typescript-eslint/member-delimiter-style": 1,
80
98
  // ignore duplicate rules
81
99
  "no-unused-vars": 0
82
100
  };
@@ -90,7 +108,7 @@ const typescript = async (options$) => {
90
108
  {
91
109
  files: ["*.ts", "*.tsx", "*.mts", "*.cts"].map((i) => "**/" + i),
92
110
  languageOptions: {
93
- parser: parserTs,
111
+ parser: parserTs__namespace,
94
112
  parserOptions: {
95
113
  sourceType: "module"
96
114
  }
@@ -121,7 +139,14 @@ const javascript = async (options$) => {
121
139
  "no-undef": 1,
122
140
  "no-debugger": 1,
123
141
  "no-unused-vars": 1,
124
- "no-useless-escape": 0
142
+ "no-useless-escape": 0,
143
+ "prefer-const": [
144
+ 2,
145
+ {
146
+ destructuring: "all",
147
+ ignoreReadBeforeAssign: false
148
+ }
149
+ ]
125
150
  };
126
151
  return [
127
152
  {
@@ -180,7 +205,7 @@ const markdown = async (options$) => {
180
205
  if (!options.enable) {
181
206
  return [];
182
207
  }
183
- const config = pluginMarkdown.configs.recommended.overrides[1];
208
+ const config = pluginMarkdown.configs.recommended[2];
184
209
  return [
185
210
  {
186
211
  plugins: {
@@ -257,14 +282,18 @@ const imports = async (options$) => {
257
282
  const recommendedRules = pluginImport.configs.recommended.rules;
258
283
  const rules = {
259
284
  ...recommendedRules,
260
- "import/newline-after-import": 1,
261
- "import/no-unresolved": 0
285
+ "import-x/newline-after-import": 1,
286
+ "import-x/no-unresolved": 0,
287
+ "import-x/namespace": 0,
288
+ "import-x/default": 0,
289
+ "import-x/no-named-as-default": 0,
290
+ "import-x/no-named-as-default-member": 0
262
291
  };
263
292
  return [
264
293
  // 单独安装plugins,
265
294
  {
266
295
  plugins: {
267
- import: pluginImport
296
+ "import-x": pluginImport
268
297
  },
269
298
  settings: {
270
299
  "import/parsers": {
@@ -277,7 +306,7 @@ const imports = async (options$) => {
277
306
  ...cleanRules(
278
307
  "import",
279
308
  Object.keys(pluginImport.rules).reduce((pre, key) => {
280
- pre[`import/${key}`] = 2;
309
+ pre[`import-x/${key}`] = 2;
281
310
  return pre;
282
311
  }, {}),
283
312
  recommendedRules,
@@ -314,7 +343,8 @@ const stylistic = async (options$) => {
314
343
  allowSingleLine: true
315
344
  }],
316
345
  "@stylistic/member-delimiter-style": 1,
317
- "@stylistic/max-statements-per-line": ["off", { max: 1 }]
346
+ "@stylistic/max-statements-per-line": ["off", { max: 1 }],
347
+ "@stylistic/max-len": [1, { code: 150 }]
318
348
  };
319
349
  return [
320
350
  // 单独安装plugins, 方便扩展
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import pluginTs from '@typescript-eslint/eslint-plugin';
2
- import parserTs from '@typescript-eslint/parser';
2
+ import * as parserTs from '@typescript-eslint/parser';
3
3
  import js from '@eslint/js';
4
4
  import globals from 'globals';
5
5
  import pluginJsdoc from 'eslint-plugin-jsdoc';
6
6
  import pluginMarkdown from 'eslint-plugin-markdown';
7
- import pluginImport from 'eslint-plugin-import';
7
+ import pluginImport from 'eslint-plugin-import-x';
8
8
  import pluginStylistic from '@stylistic/eslint-plugin';
9
9
 
10
10
  const pickOptions = async (key, options) => {
@@ -72,7 +72,6 @@ const typescript = async (options$) => {
72
72
  "@typescript-eslint/no-shadow": 2,
73
73
  // https://github.com/typescript-eslint/typescript-eslint/issues/2483
74
74
  "@typescript-eslint/no-unused-vars": 1,
75
- "@typescript-eslint/member-delimiter-style": 1,
76
75
  // ignore duplicate rules
77
76
  "no-unused-vars": 0
78
77
  };
@@ -117,7 +116,14 @@ const javascript = async (options$) => {
117
116
  "no-undef": 1,
118
117
  "no-debugger": 1,
119
118
  "no-unused-vars": 1,
120
- "no-useless-escape": 0
119
+ "no-useless-escape": 0,
120
+ "prefer-const": [
121
+ 2,
122
+ {
123
+ destructuring: "all",
124
+ ignoreReadBeforeAssign: false
125
+ }
126
+ ]
121
127
  };
122
128
  return [
123
129
  {
@@ -176,7 +182,7 @@ const markdown = async (options$) => {
176
182
  if (!options.enable) {
177
183
  return [];
178
184
  }
179
- const config = pluginMarkdown.configs.recommended.overrides[1];
185
+ const config = pluginMarkdown.configs.recommended[2];
180
186
  return [
181
187
  {
182
188
  plugins: {
@@ -253,14 +259,18 @@ const imports = async (options$) => {
253
259
  const recommendedRules = pluginImport.configs.recommended.rules;
254
260
  const rules = {
255
261
  ...recommendedRules,
256
- "import/newline-after-import": 1,
257
- "import/no-unresolved": 0
262
+ "import-x/newline-after-import": 1,
263
+ "import-x/no-unresolved": 0,
264
+ "import-x/namespace": 0,
265
+ "import-x/default": 0,
266
+ "import-x/no-named-as-default": 0,
267
+ "import-x/no-named-as-default-member": 0
258
268
  };
259
269
  return [
260
270
  // 单独安装plugins,
261
271
  {
262
272
  plugins: {
263
- import: pluginImport
273
+ "import-x": pluginImport
264
274
  },
265
275
  settings: {
266
276
  "import/parsers": {
@@ -273,7 +283,7 @@ const imports = async (options$) => {
273
283
  ...cleanRules(
274
284
  "import",
275
285
  Object.keys(pluginImport.rules).reduce((pre, key) => {
276
- pre[`import/${key}`] = 2;
286
+ pre[`import-x/${key}`] = 2;
277
287
  return pre;
278
288
  }, {}),
279
289
  recommendedRules,
@@ -310,7 +320,8 @@ const stylistic = async (options$) => {
310
320
  allowSingleLine: true
311
321
  }],
312
322
  "@stylistic/member-delimiter-style": 1,
313
- "@stylistic/max-statements-per-line": ["off", { max: 1 }]
323
+ "@stylistic/max-statements-per-line": ["off", { max: 1 }],
324
+ "@stylistic/max-len": [1, { code: 150 }]
314
325
  };
315
326
  return [
316
327
  // 单独安装plugins, 方便扩展
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@deot/dev-eslint",
3
- "version": "2.8.3",
3
+ "version": "2.9.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
+ "types": "./dist/index.d.ts",
9
10
  "import": "./dist/index.js",
10
- "require": "./dist/index.cjs",
11
- "types": "./dist/index.d.ts"
11
+ "require": "./dist/index.cjs"
12
12
  }
13
13
  },
14
14
  "files": [
@@ -19,16 +19,16 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@stylistic/eslint-plugin": "^1.5.1",
23
- "@typescript-eslint/eslint-plugin": "^6.14.0",
24
- "@typescript-eslint/parser": "^6.14.0",
25
- "eslint-plugin-import": "^2.29.0",
26
- "eslint-plugin-jsdoc": "^46.9.1",
27
- "eslint-plugin-markdown": "^3.0.1",
28
- "globals": "^13.24.0"
22
+ "@stylistic/eslint-plugin": "^3.1.0",
23
+ "@typescript-eslint/eslint-plugin": "^8.24.0",
24
+ "@typescript-eslint/parser": "^8.24.0",
25
+ "eslint-plugin-import-x": "^4.6.1",
26
+ "eslint-plugin-jsdoc": "^50.6.3",
27
+ "eslint-plugin-markdown": "^5.1.0",
28
+ "globals": "^15.15.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/eslint": "^8.44.9",
32
- "eslint": "^8.55.0"
31
+ "@types/eslint": "^9.6.1",
32
+ "eslint": "^9.20.1"
33
33
  }
34
34
  }