@daopk/eslint-config 0.0.2 → 0.0.3

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/dist/index.js +26 -28
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,29 +9,16 @@ import node from "eslint-plugin-n";
9
9
  import perfectionist from "eslint-plugin-perfectionist";
10
10
  import unusedImports from "eslint-plugin-unused-imports";
11
11
  function daopk(options = {}, ...userConfigs) {
12
- return [
12
+ const configs = [
13
13
  {
14
14
  ignores: [
15
15
  ...gitignore().ignores,
16
16
  ...options.ignores ?? []
17
17
  ],
18
- name: "daopk:ignores"
18
+ name: "daopk/ignores"
19
19
  },
20
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",
21
+ name: "daopk/eslint",
35
22
  rules: {
36
23
  eqeqeq: "error",
37
24
  "no-cond-assign": ["error", "always"],
@@ -44,7 +31,7 @@ function daopk(options = {}, ...userConfigs) {
44
31
  }
45
32
  },
46
33
  {
47
- name: "daopk:stylistic",
34
+ name: "daopk/stylistic",
48
35
  plugins: {
49
36
  stylistic
50
37
  },
@@ -62,7 +49,13 @@ function daopk(options = {}, ...userConfigs) {
62
49
  }
63
50
  },
64
51
  {
65
- name: "daopk:typescript",
52
+ files: ["**/*.ts"],
53
+ languageOptions: {
54
+ ecmaVersion: "latest",
55
+ parser: tsParser,
56
+ sourceType: "module"
57
+ },
58
+ name: "daopk/typescript",
66
59
  plugins: {
67
60
  typescript
68
61
  },
@@ -76,7 +69,7 @@ function daopk(options = {}, ...userConfigs) {
76
69
  }
77
70
  },
78
71
  {
79
- name: "daopk:imports",
72
+ name: "daopk/imports",
80
73
  plugins: {
81
74
  import: importX,
82
75
  "unused-imports": unusedImports
@@ -102,7 +95,7 @@ function daopk(options = {}, ...userConfigs) {
102
95
  }
103
96
  },
104
97
  {
105
- name: "antfu",
98
+ name: "daopk/antfu",
106
99
  plugins: {
107
100
  antfu
108
101
  },
@@ -113,7 +106,7 @@ function daopk(options = {}, ...userConfigs) {
113
106
  }
114
107
  },
115
108
  {
116
- name: "daopk:node",
109
+ name: "daopk/node",
117
110
  plugins: {
118
111
  node
119
112
  },
@@ -122,7 +115,7 @@ function daopk(options = {}, ...userConfigs) {
122
115
  }
123
116
  },
124
117
  {
125
- name: "daopk:perfectionist",
118
+ name: "daopk/perfectionist",
126
119
  plugins: {
127
120
  perfectionist
128
121
  },
@@ -148,15 +141,20 @@ function daopk(options = {}, ...userConfigs) {
148
141
  "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }],
149
142
  "perfectionist/sort-objects": "error"
150
143
  }
151
- },
152
- {
153
- name: "daopk:rules",
144
+ }
145
+ ];
146
+ if (options.rules) {
147
+ configs.push({
148
+ name: "daopk/rules",
154
149
  rules: {
155
150
  ...options.rules
156
151
  }
157
- },
158
- ...userConfigs
159
- ];
152
+ });
153
+ }
154
+ if (userConfigs.length > 0) {
155
+ configs.push(...userConfigs);
156
+ }
157
+ return configs;
160
158
  }
161
159
  export {
162
160
  daopk as default
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@daopk/eslint-config",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "license": "ISC",
6
6
  "repository": "github:daopk/eslint-config",
7
7
  "exports": {