@kitql/eslint-config 0.5.8 → 0.6.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/.prettierrc.mjs +2 -1
- package/eslint.config.js +43 -19
- package/package.json +8 -4
package/.prettierrc.mjs
CHANGED
|
@@ -24,7 +24,8 @@ const config = {
|
|
|
24
24
|
'^(\\$env)(.*)$', // special sveltekit
|
|
25
25
|
'^(\\$app)(.*)$', // special sveltekit
|
|
26
26
|
'',
|
|
27
|
-
'^(
|
|
27
|
+
'^(\\$server)(.*)$', // special firstly
|
|
28
|
+
'^(\\$modules)(.*)$', // special firstly
|
|
28
29
|
'^(\\$)(.*)$', // Aliases
|
|
29
30
|
'',
|
|
30
31
|
'^[./]', // inside
|
package/eslint.config.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { includeIgnoreFile } from '@eslint/compat'
|
|
2
2
|
import js from '@eslint/js'
|
|
3
|
-
import
|
|
3
|
+
import pluginPnpm from 'eslint-plugin-pnpm'
|
|
4
4
|
import svelte from 'eslint-plugin-svelte'
|
|
5
5
|
import unusedImports from 'eslint-plugin-unused-imports'
|
|
6
6
|
import globals from 'globals'
|
|
7
7
|
import * as jsoncParser from 'jsonc-eslint-parser'
|
|
8
8
|
import ts from 'typescript-eslint'
|
|
9
|
+
import * as yamlParser from 'yaml-eslint-parser'
|
|
9
10
|
|
|
10
11
|
import { findFileOrUp } from './helper/findFileOrUp.js'
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* @typedef {Object} PnpmCatalogsConfig
|
|
14
15
|
* @property {boolean} [enable=true] - Whether to enable pnpm catalogs rules
|
|
15
|
-
* @property {string[]} [
|
|
16
|
-
* @property {Record<string,
|
|
16
|
+
* @property {string[]} [json_files] - Files to apply the rules to
|
|
17
|
+
* @property {Record<string, any>} [json_rules] - Rules configuration
|
|
18
|
+
* @property {string[]} [yaml_files] - Files to apply the rules to
|
|
19
|
+
* @property {Record<string, any>} [yaml_rules] - Rules configuration
|
|
17
20
|
*/
|
|
18
21
|
|
|
19
22
|
const rulePrettierIgnore = ({ pnpmCatalogsEnabled = true }) => {
|
|
@@ -34,26 +37,47 @@ const rulePrettierIgnore = ({ pnpmCatalogsEnabled = true }) => {
|
|
|
34
37
|
const rulePnpmCatalogs = (options = {}) => {
|
|
35
38
|
const {
|
|
36
39
|
enable = true,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'pnpm-
|
|
40
|
-
'pnpm-
|
|
40
|
+
json_files = ['package.json', '**/package.json'],
|
|
41
|
+
json_rules = {
|
|
42
|
+
'pnpm/json-enforce-catalog': 'error',
|
|
43
|
+
'pnpm/json-valid-catalog': 'error',
|
|
44
|
+
'pnpm/json-prefer-workspace-settings': 'error',
|
|
45
|
+
...options.json_rules,
|
|
46
|
+
},
|
|
47
|
+
yaml_files = ['pnpm-workspace.yaml'],
|
|
48
|
+
yaml_rules = {
|
|
49
|
+
'pnpm/yaml-no-unused-catalog-item': 'error',
|
|
50
|
+
'pnpm/yaml-no-duplicate-catalog-item': 'off',
|
|
51
|
+
...options.yaml_rules,
|
|
41
52
|
},
|
|
42
53
|
} = options
|
|
43
54
|
|
|
44
|
-
if (!enable) return
|
|
55
|
+
if (!enable) return []
|
|
45
56
|
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
return [
|
|
58
|
+
{
|
|
59
|
+
name: 'pnpm/package.json',
|
|
60
|
+
files: json_files,
|
|
61
|
+
languageOptions: {
|
|
62
|
+
parser: jsoncParser,
|
|
63
|
+
},
|
|
64
|
+
plugins: {
|
|
65
|
+
pnpm: pluginPnpm,
|
|
66
|
+
},
|
|
67
|
+
rules: json_rules,
|
|
51
68
|
},
|
|
52
|
-
|
|
53
|
-
'pnpm-
|
|
69
|
+
{
|
|
70
|
+
name: 'pnpm/pnpm-workspace-yaml',
|
|
71
|
+
files: yaml_files,
|
|
72
|
+
languageOptions: {
|
|
73
|
+
parser: yamlParser,
|
|
74
|
+
},
|
|
75
|
+
plugins: {
|
|
76
|
+
pnpm: pluginPnpm,
|
|
77
|
+
},
|
|
78
|
+
rules: yaml_rules,
|
|
54
79
|
},
|
|
55
|
-
|
|
56
|
-
}
|
|
80
|
+
]
|
|
57
81
|
}
|
|
58
82
|
|
|
59
83
|
const othersRules = () => {
|
|
@@ -144,7 +168,7 @@ const config = [
|
|
|
144
168
|
//
|
|
145
169
|
rulePrettierIgnore({ pnpmCatalogsEnabled: true }),
|
|
146
170
|
...othersRules(),
|
|
147
|
-
rulePnpmCatalogs(),
|
|
171
|
+
...rulePnpmCatalogs(),
|
|
148
172
|
]
|
|
149
173
|
|
|
150
174
|
export default config
|
|
@@ -166,6 +190,6 @@ export const kitql = (options = {}) => {
|
|
|
166
190
|
//
|
|
167
191
|
rulePrettierIgnore({ pnpmCatalogsEnabled }),
|
|
168
192
|
...othersRules(),
|
|
169
|
-
...(pnpmCatalogsEnabled ?
|
|
193
|
+
...(pnpmCatalogsEnabled ? rulePnpmCatalogs(pnpmCatalogsConfig) : []),
|
|
170
194
|
]
|
|
171
195
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitql/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "opinionated linting and formatting for projects",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
"eslint",
|
|
28
28
|
"eslint-config"
|
|
29
29
|
],
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"prettier": "^3.5.3"
|
|
32
|
+
},
|
|
30
33
|
"dependencies": {
|
|
31
34
|
"@eslint/compat": "1.2.7",
|
|
32
35
|
"@eslint/js": "9.22.0",
|
|
@@ -35,16 +38,17 @@
|
|
|
35
38
|
"@typescript-eslint/parser": "8.26.0",
|
|
36
39
|
"commander": "13.1.0",
|
|
37
40
|
"eslint": "9.22.0",
|
|
38
|
-
"eslint-plugin-pnpm
|
|
39
|
-
"eslint-plugin-svelte": "3.0
|
|
41
|
+
"eslint-plugin-pnpm": "0.3.1",
|
|
42
|
+
"eslint-plugin-svelte": "3.3.0",
|
|
40
43
|
"eslint-plugin-unused-imports": "4.1.4",
|
|
41
44
|
"globals": "16.0.0",
|
|
42
45
|
"jsonc-eslint-parser": "2.4.0",
|
|
43
46
|
"ora": "8.2.0",
|
|
44
|
-
"prettier": "3.5.3",
|
|
47
|
+
"prettier": "^3.5.3",
|
|
45
48
|
"prettier-plugin-svelte": "3.3.2",
|
|
46
49
|
"prettier-plugin-tailwindcss": "0.6.6",
|
|
47
50
|
"typescript-eslint": "8.26.0",
|
|
51
|
+
"yaml-eslint-parser": "1.3.0",
|
|
48
52
|
"@kitql/helpers": "0.8.12"
|
|
49
53
|
},
|
|
50
54
|
"publishConfig": {
|