@daopk/eslint-config 0.0.2 → 0.0.4

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 CHANGED
@@ -1,3 +1,4 @@
1
+ import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
1
2
  import { Linter } from 'eslint';
2
3
 
3
4
  /* eslint-disable */
@@ -8608,7 +8609,8 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
8608
8609
  onlyEquality?: boolean
8609
8610
  }]
8610
8611
 
8611
- interface Options {
8612
+ type StylisticOptions = Omit<StylisticCustomizeOptions, 'flat' | 'pluginName'>;
8613
+ interface Options extends StylisticOptions {
8612
8614
  ignores?: string[];
8613
8615
  rules?: RuleOptions;
8614
8616
  }
package/dist/index.js CHANGED
@@ -9,31 +9,31 @@ 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 stylisticConfig = stylistic.configs.customize({
13
+ arrowParens: options.arrowParens ?? true,
14
+ blockSpacing: options.blockSpacing,
15
+ braceStyle: options.braceStyle,
16
+ commaDangle: options.commaDangle,
17
+ flat: true,
18
+ indent: options.indent ?? 4,
19
+ jsx: options.jsx,
20
+ pluginName: "stylistic",
21
+ quoteProps: options.quoteProps,
22
+ quotes: options.quotes ?? "single",
23
+ semi: options.semi ?? false
24
+ });
25
+ const configs = [
13
26
  {
14
27
  ignores: [
15
28
  ...gitignore().ignores,
16
29
  ...options.ignores ?? []
17
30
  ],
18
- name: "daopk:ignores"
31
+ name: "daopk/ignores"
19
32
  },
20
33
  {
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",
34
+ name: "daopk/eslint",
35
35
  rules: {
36
- eqeqeq: "error",
36
+ "eqeqeq": "error",
37
37
  "no-cond-assign": ["error", "always"],
38
38
  "no-extra-boolean-cast": "error",
39
39
  "no-regex-spaces": "error",
@@ -44,25 +44,24 @@ function daopk(options = {}, ...userConfigs) {
44
44
  }
45
45
  },
46
46
  {
47
- name: "daopk:stylistic",
47
+ name: "daopk/stylistic",
48
48
  plugins: {
49
49
  stylistic
50
50
  },
51
51
  rules: {
52
+ ...stylisticConfig.rules,
52
53
  "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"]
54
+ "stylistic/array-element-newline": ["error", "consistent"]
62
55
  }
63
56
  },
64
57
  {
65
- name: "daopk:typescript",
58
+ files: ["**/*.ts"],
59
+ languageOptions: {
60
+ ecmaVersion: "latest",
61
+ parser: tsParser,
62
+ sourceType: "module"
63
+ },
64
+ name: "daopk/typescript",
66
65
  plugins: {
67
66
  typescript
68
67
  },
@@ -76,9 +75,9 @@ function daopk(options = {}, ...userConfigs) {
76
75
  }
77
76
  },
78
77
  {
79
- name: "daopk:imports",
78
+ name: "daopk/imports",
80
79
  plugins: {
81
- import: importX,
80
+ "import": importX,
82
81
  "unused-imports": unusedImports
83
82
  },
84
83
  rules: {
@@ -93,16 +92,16 @@ function daopk(options = {}, ...userConfigs) {
93
92
  "unused-imports/no-unused-vars": [
94
93
  "warn",
95
94
  {
96
- "args": "after-used",
97
- "argsIgnorePattern": "^_",
98
- "vars": "all",
99
- "varsIgnorePattern": "^_"
95
+ args: "after-used",
96
+ argsIgnorePattern: "^_",
97
+ vars: "all",
98
+ varsIgnorePattern: "^_"
100
99
  }
101
100
  ]
102
101
  }
103
102
  },
104
103
  {
105
- name: "antfu",
104
+ name: "daopk/antfu",
106
105
  plugins: {
107
106
  antfu
108
107
  },
@@ -113,7 +112,7 @@ function daopk(options = {}, ...userConfigs) {
113
112
  }
114
113
  },
115
114
  {
116
- name: "daopk:node",
115
+ name: "daopk/node",
117
116
  plugins: {
118
117
  node
119
118
  },
@@ -122,7 +121,7 @@ function daopk(options = {}, ...userConfigs) {
122
121
  }
123
122
  },
124
123
  {
125
- name: "daopk:perfectionist",
124
+ name: "daopk/perfectionist",
126
125
  plugins: {
127
126
  perfectionist
128
127
  },
@@ -145,18 +144,22 @@ function daopk(options = {}, ...userConfigs) {
145
144
  type: "natural"
146
145
  }],
147
146
  "perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
148
- "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }],
149
- "perfectionist/sort-objects": "error"
147
+ "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
150
148
  }
151
- },
152
- {
153
- name: "daopk:rules",
149
+ }
150
+ ];
151
+ if (options.rules) {
152
+ configs.push({
153
+ name: "daopk/rules",
154
154
  rules: {
155
155
  ...options.rules
156
156
  }
157
- },
158
- ...userConfigs
159
- ];
157
+ });
158
+ }
159
+ if (userConfigs.length > 0) {
160
+ configs.push(...userConfigs);
161
+ }
162
+ return configs;
160
163
  }
161
164
  export {
162
165
  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.4",
5
5
  "license": "ISC",
6
6
  "repository": "github:daopk/eslint-config",
7
7
  "exports": {
@@ -35,10 +35,10 @@
35
35
  "typescript": "^5.7.3"
36
36
  },
37
37
  "scripts": {
38
- "build": "pnpm typegen && tsup",
38
+ "dev": "eslint-config-inspector",
39
39
  "typegen": "tsx scripts/typegen.ts",
40
- "inspector": "eslint-config-inspector",
41
- "inspector:build": "pnpm build && eslint-config-inspector build",
40
+ "build": "pnpm typegen && tsup",
41
+ "build:inspector": "pnpm build && eslint-config-inspector build",
42
42
  "lint": "eslint .",
43
43
  "release": "bumpp && pnpm publish"
44
44
  }