@daopk/eslint-config 0.0.1
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/dist/index.d.ts +8620 -0
- package/dist/index.js +163 -0
- package/package.json +44 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
3
|
+
import typescript from "@typescript-eslint/eslint-plugin";
|
|
4
|
+
import tsParser from "@typescript-eslint/parser";
|
|
5
|
+
import gitignore from "eslint-config-flat-gitignore";
|
|
6
|
+
import antfu from "eslint-plugin-antfu";
|
|
7
|
+
import importX from "eslint-plugin-import-x";
|
|
8
|
+
import node from "eslint-plugin-n";
|
|
9
|
+
import perfectionist from "eslint-plugin-perfectionist";
|
|
10
|
+
import unusedImports from "eslint-plugin-unused-imports";
|
|
11
|
+
function daopk(options = {}, ...userConfigs) {
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
ignores: [
|
|
15
|
+
...gitignore().ignores,
|
|
16
|
+
...options.ignores ?? []
|
|
17
|
+
],
|
|
18
|
+
name: "daopk:ignores"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
files: ["**/*.ts"],
|
|
22
|
+
languageOptions: {
|
|
23
|
+
ecmaVersion: "latest",
|
|
24
|
+
parser: tsParser,
|
|
25
|
+
parserOptions: {
|
|
26
|
+
projectService: true,
|
|
27
|
+
tsconfigRootDir: import.meta.dirname
|
|
28
|
+
},
|
|
29
|
+
sourceType: "module"
|
|
30
|
+
},
|
|
31
|
+
name: "daopk:ts-parser"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "daopk:eslint",
|
|
35
|
+
rules: {
|
|
36
|
+
eqeqeq: "error",
|
|
37
|
+
"no-cond-assign": ["error", "always"],
|
|
38
|
+
"no-extra-boolean-cast": "error",
|
|
39
|
+
"no-regex-spaces": "error",
|
|
40
|
+
"no-unused-labels": "error",
|
|
41
|
+
"no-unused-vars": "off",
|
|
42
|
+
"object-curly-newline": "off",
|
|
43
|
+
"yoda": ["error", "never"]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "daopk:stylistic",
|
|
48
|
+
plugins: {
|
|
49
|
+
stylistic
|
|
50
|
+
},
|
|
51
|
+
rules: {
|
|
52
|
+
"stylistic/array-bracket-newline": ["error", "consistent"],
|
|
53
|
+
"stylistic/array-bracket-spacing": ["error", "never"],
|
|
54
|
+
"stylistic/array-element-newline": ["error", "consistent"],
|
|
55
|
+
"stylistic/brace-style": ["error", "1tbs", { "allowSingleLine": true }],
|
|
56
|
+
"stylistic/comma-dangle": ["error", "always-multiline"],
|
|
57
|
+
"stylistic/indent": ["error", 4],
|
|
58
|
+
"stylistic/no-multi-spaces": "error",
|
|
59
|
+
"stylistic/no-multiple-empty-lines": ["error", { "max": 1 }],
|
|
60
|
+
"stylistic/quotes": ["error", "single"],
|
|
61
|
+
"stylistic/semi": ["error", "never"]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "daopk:typescript",
|
|
66
|
+
plugins: {
|
|
67
|
+
typescript
|
|
68
|
+
},
|
|
69
|
+
rules: {
|
|
70
|
+
"typescript/consistent-type-imports": ["error", {
|
|
71
|
+
disallowTypeAnnotations: false,
|
|
72
|
+
fixStyle: "separate-type-imports",
|
|
73
|
+
prefer: "type-imports"
|
|
74
|
+
}],
|
|
75
|
+
"typescript/no-unused-vars": "off"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "daopk:imports",
|
|
80
|
+
plugins: {
|
|
81
|
+
import: importX,
|
|
82
|
+
"unused-imports": unusedImports
|
|
83
|
+
},
|
|
84
|
+
rules: {
|
|
85
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
86
|
+
"import/first": "error",
|
|
87
|
+
"import/no-duplicates": "error",
|
|
88
|
+
"import/no-mutable-exports": "error",
|
|
89
|
+
"import/no-named-default": "error",
|
|
90
|
+
"import/no-self-import": "error",
|
|
91
|
+
"import/no-webpack-loader-syntax": "error",
|
|
92
|
+
"unused-imports/no-unused-imports": "error",
|
|
93
|
+
"unused-imports/no-unused-vars": [
|
|
94
|
+
"warn",
|
|
95
|
+
{
|
|
96
|
+
"args": "after-used",
|
|
97
|
+
"argsIgnorePattern": "^_",
|
|
98
|
+
"vars": "all",
|
|
99
|
+
"varsIgnorePattern": "^_"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "antfu",
|
|
106
|
+
plugins: {
|
|
107
|
+
antfu
|
|
108
|
+
},
|
|
109
|
+
rules: {
|
|
110
|
+
"antfu/consistent-chaining": "error",
|
|
111
|
+
"antfu/consistent-list-newline": "error",
|
|
112
|
+
"antfu/import-dedupe": "error"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "daopk:node",
|
|
117
|
+
plugins: {
|
|
118
|
+
node
|
|
119
|
+
},
|
|
120
|
+
rules: {
|
|
121
|
+
"node/prefer-node-protocol": "error"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "daopk:perfectionist",
|
|
126
|
+
plugins: {
|
|
127
|
+
perfectionist
|
|
128
|
+
},
|
|
129
|
+
rules: {
|
|
130
|
+
"perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
|
|
131
|
+
"perfectionist/sort-imports": ["error", {
|
|
132
|
+
groups: [
|
|
133
|
+
"type",
|
|
134
|
+
["parent-type", "sibling-type", "index-type", "internal-type"],
|
|
135
|
+
"builtin",
|
|
136
|
+
"external",
|
|
137
|
+
"internal",
|
|
138
|
+
["parent", "sibling", "index"],
|
|
139
|
+
"side-effect",
|
|
140
|
+
"object",
|
|
141
|
+
"unknown"
|
|
142
|
+
],
|
|
143
|
+
newlinesBetween: "ignore",
|
|
144
|
+
order: "asc",
|
|
145
|
+
type: "natural"
|
|
146
|
+
}],
|
|
147
|
+
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
148
|
+
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }],
|
|
149
|
+
"perfectionist/sort-objects": "error"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "daopk:rules",
|
|
154
|
+
rules: {
|
|
155
|
+
...options.rules
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
...userConfigs
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
daopk as default
|
|
163
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@daopk/eslint-config",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@stylistic/eslint-plugin": "^3.1.0",
|
|
16
|
+
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
|
17
|
+
"@typescript-eslint/parser": "^8.23.0",
|
|
18
|
+
"eslint-config-flat-gitignore": "^2.0.0",
|
|
19
|
+
"eslint-plugin-antfu": "^3.0.0",
|
|
20
|
+
"eslint-plugin-import-x": "^4.6.1",
|
|
21
|
+
"eslint-plugin-n": "^17.15.1",
|
|
22
|
+
"eslint-plugin-perfectionist": "^4.8.0",
|
|
23
|
+
"eslint-plugin-unused-imports": "^4.1.4"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@eslint/config-inspector": "^1.0.0",
|
|
27
|
+
"@types/node": "^22.13.1",
|
|
28
|
+
"bumpp": "^10.0.2",
|
|
29
|
+
"eslint": "^9.20.0",
|
|
30
|
+
"eslint-typegen": "^1.0.0",
|
|
31
|
+
"jiti": "^2.4.2",
|
|
32
|
+
"tsup": "^8.3.6",
|
|
33
|
+
"tsx": "^4.19.2",
|
|
34
|
+
"typescript": "^5.7.3"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "pnpm typegen && tsup",
|
|
38
|
+
"typegen": "tsx scripts/typegen.ts",
|
|
39
|
+
"inspector": "eslint-config-inspector",
|
|
40
|
+
"inspector:build": "pnpm build && eslint-config-inspector build",
|
|
41
|
+
"lint": "eslint .",
|
|
42
|
+
"release": "bumpp && pnpm publish"
|
|
43
|
+
}
|
|
44
|
+
}
|