@zilero/eslint 1.0.1 → 1.2.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/README.md +2 -2
- package/eslint.config.js +1 -0
- package/index.d.ts +6 -2
- package/package.json +15 -12
- package/utils/transformRules.js +20 -0
package/README.md
CHANGED
package/eslint.config.js
CHANGED
@@ -2,6 +2,7 @@ import antfu from '@antfu/eslint-config';
|
|
2
2
|
import pluginNext from '@next/eslint-plugin-next';
|
3
3
|
import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
|
4
4
|
import pluginReact from 'eslint-plugin-react';
|
5
|
+
|
5
6
|
import { transformRules } from './utils/transformRules';
|
6
7
|
|
7
8
|
/** @type {import('@zilero/eslint').Eslint} */
|
package/index.d.ts
CHANGED
@@ -8,8 +8,10 @@ import type { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
8
8
|
interface ConfigOptions extends OptionsConfig, TypedFlatConfigItem {
|
9
9
|
/** Enables accessibility rules for JSX */
|
10
10
|
jsxA11y?: boolean;
|
11
|
+
|
11
12
|
/** Adds support for Next.js */
|
12
13
|
next?: boolean;
|
14
|
+
|
13
15
|
/** Sorts rules alphabetically */
|
14
16
|
sort?: boolean;
|
15
17
|
}
|
@@ -22,11 +24,13 @@ type UserConfig = Awaitable<FlatConfigComposer<any, any> | TypedFlatConfigItem |
|
|
22
24
|
/**
|
23
25
|
* Main configuration function for ESLint.
|
24
26
|
*/
|
25
|
-
type ConfigFunction = (options?: ConfigOptions, ...userConfigs: UserConfig[]) => FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
27
|
+
declare type ConfigFunction = (options?: ConfigOptions, ...userConfigs: UserConfig[]) => FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
26
28
|
|
27
29
|
/**
|
28
30
|
* Exported module.
|
29
31
|
*/
|
30
32
|
declare module '@zilero/eslint' {
|
31
|
-
|
33
|
+
type Eslint = ConfigFunction;
|
34
|
+
|
35
|
+
export const eslint: Eslint;
|
32
36
|
}
|
package/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"displayName": "✨ Zilero ESLint Config",
|
5
5
|
"description": "🎯 Comprehensive ESLint configuration for React and Node.js projects",
|
6
6
|
"license": "MIT",
|
7
|
-
"version": "1.0
|
7
|
+
"version": "1.2.0",
|
8
8
|
"keywords": [
|
9
9
|
"eslint",
|
10
10
|
"eslint-config",
|
@@ -27,17 +27,19 @@
|
|
27
27
|
},
|
28
28
|
"homepage": "https://github.com/Zilero232/dev-config-hub",
|
29
29
|
"repository": {
|
30
|
-
"url": "
|
30
|
+
"url": "https://github.com/Zilero232/dev-config-hub"
|
31
31
|
},
|
32
32
|
"publishConfig": {
|
33
33
|
"access": "public"
|
34
34
|
},
|
35
|
+
"main": "index.js",
|
36
|
+
"types": "index.d.ts",
|
35
37
|
"files": [
|
38
|
+
"utils",
|
39
|
+
"index.js",
|
36
40
|
"index.d.ts",
|
37
|
-
"eslint.config.js"
|
38
|
-
"index.js"
|
41
|
+
"eslint.config.js"
|
39
42
|
],
|
40
|
-
"main": "index.js",
|
41
43
|
"peerDependencies": {
|
42
44
|
"eslint": "^9.0.0"
|
43
45
|
},
|
@@ -60,14 +62,15 @@
|
|
60
62
|
}
|
61
63
|
],
|
62
64
|
"dependencies": {
|
63
|
-
"@antfu/eslint-config": "
|
64
|
-
"@eslint-react/eslint-plugin": "1.
|
65
|
-
"@next/eslint-plugin-next": "15.1
|
65
|
+
"@antfu/eslint-config": "4.6.0",
|
66
|
+
"@eslint-react/eslint-plugin": "1.30.2",
|
67
|
+
"@next/eslint-plugin-next": "15.2.1",
|
66
68
|
"@vue/compiler-sfc": "3.5.13",
|
67
|
-
"eslint": "9.
|
69
|
+
"eslint": "9.21.0",
|
70
|
+
"eslint-flat-config-utils": "^2.0.1",
|
68
71
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
69
|
-
"eslint-plugin-react": "7.37.
|
70
|
-
"eslint-plugin-react-hooks": "5.
|
71
|
-
"eslint-plugin-react-refresh": "0.4.
|
72
|
+
"eslint-plugin-react": "7.37.4",
|
73
|
+
"eslint-plugin-react-hooks": "5.2.0",
|
74
|
+
"eslint-plugin-react-refresh": "0.4.19"
|
72
75
|
}
|
73
76
|
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* Transforms ESLint rules, replacing the prefix.
|
3
|
+
*
|
4
|
+
* @param {Object} rules - Object with rules.
|
5
|
+
* @param {string} fromPrefix - Original prefix.
|
6
|
+
* @param {string} toPrefix - New prefix.
|
7
|
+
*
|
8
|
+
* @returns {Object} Transformed rules.
|
9
|
+
*/
|
10
|
+
export const transformRules = (rules, fromPrefix, toPrefix) => {
|
11
|
+
if (!rules) {
|
12
|
+
return {};
|
13
|
+
}
|
14
|
+
|
15
|
+
return Object.entries(rules).reduce((acc, [key, value]) => {
|
16
|
+
acc[key.replace(fromPrefix, toPrefix)] = value;
|
17
|
+
|
18
|
+
return acc;
|
19
|
+
}, {});
|
20
|
+
};
|