@w5s/eslint-config 5.0.0 → 7.0.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 +1 -0
- package/dist/index.d.ts +1173 -363
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -8
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
- package/src/config/github-actions.ts +53 -0
- package/src/config/jsonc.ts +6 -4
- package/src/config.ts +1 -0
- package/src/defineConfig.ts +2 -0
- package/src/typegen/github-actions.d.ts +708 -0
- package/src/typegen/ts.d.ts +5 -0
- package/src/typegen/unicorn.d.ts +499 -356
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -38,24 +38,25 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@e18e/eslint-plugin": "~0.8.0",
|
|
41
|
-
"@eslint-react/eslint-plugin": "~5.
|
|
41
|
+
"@eslint-react/eslint-plugin": "~5.23.0",
|
|
42
42
|
"@eslint/js": "~10.0.0",
|
|
43
43
|
"@eslint/markdown": "~8.0.0",
|
|
44
44
|
"@next/eslint-plugin-next": "~16.3.0",
|
|
45
45
|
"@stylistic/eslint-plugin": "~5.10.0",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "~8.
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "~8.71.0",
|
|
47
47
|
"@typescript-eslint/parser": "^8.65.0",
|
|
48
48
|
"@vitest/eslint-plugin": "~1.6.20",
|
|
49
|
-
"@w5s/dev": "^
|
|
50
|
-
"@w5s/eslint-config-ignore": "^1.
|
|
51
|
-
"@w5s/prettier-config": "^3.
|
|
49
|
+
"@w5s/dev": "^7.0.0",
|
|
50
|
+
"@w5s/eslint-config-ignore": "^1.34.0",
|
|
51
|
+
"@w5s/prettier-config": "^3.29.0",
|
|
52
52
|
"eslint-merge-processors": "^2.0.0",
|
|
53
|
+
"eslint-plugin-github-actions-2": "~2.0.0",
|
|
53
54
|
"eslint-plugin-import": "~2.32.0",
|
|
54
55
|
"eslint-plugin-jsdoc": "~64.5.0",
|
|
55
56
|
"eslint-plugin-jsonc": "~3.4.0",
|
|
56
|
-
"eslint-plugin-n": "~18.
|
|
57
|
-
"eslint-plugin-perfectionist": "~5.
|
|
58
|
-
"eslint-plugin-unicorn": "~
|
|
57
|
+
"eslint-plugin-n": "~18.4.0",
|
|
58
|
+
"eslint-plugin-perfectionist": "~5.12.0",
|
|
59
|
+
"eslint-plugin-unicorn": "~76.0.0",
|
|
59
60
|
"eslint-plugin-unused-imports": "~4.4.1",
|
|
60
61
|
"eslint-plugin-yml": "~3.8.0",
|
|
61
62
|
"globals": "^17.0.0",
|
|
@@ -85,5 +86,5 @@
|
|
|
85
86
|
"publishConfig": {
|
|
86
87
|
"access": "public"
|
|
87
88
|
},
|
|
88
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "7ea7f0176cdd3156d9b24af722a38b280aa99427"
|
|
89
90
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { interopDefault } from '@w5s/dev';
|
|
2
|
+
|
|
3
|
+
import type { RuleOptions } from '../typegen/github-actions.js';
|
|
4
|
+
|
|
5
|
+
import { defaultPluginOptions } from '../internal/defaultOptions.js';
|
|
6
|
+
import { withDefaultFiles } from '../internal/withDefaultFiles.js';
|
|
7
|
+
import { type Config, type PluginOptionsBase } from '../type.js';
|
|
8
|
+
|
|
9
|
+
const fallbackFiles = [
|
|
10
|
+
'.github/workflows/*.{yml,yaml}',
|
|
11
|
+
'**/action.{yml,yaml}',
|
|
12
|
+
'.github/dependabot.{yml,yaml}',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export async function githubActions(options: githubActions.Options = {}) {
|
|
16
|
+
const [githubActionsPlugin] = await Promise.all([
|
|
17
|
+
interopDefault(import('eslint-plugin-github-actions-2')),
|
|
18
|
+
] as const);
|
|
19
|
+
const { files, namespace, recommended, rules = {}, stylistic } = defaultPluginOptions(options);
|
|
20
|
+
const recommendedConfig = githubActionsPlugin.configs.recommended;
|
|
21
|
+
const stylisticConfig = githubActionsPlugin.configs.stylistic;
|
|
22
|
+
const defaultFiles = (recommendedConfig.files ?? fallbackFiles).flat();
|
|
23
|
+
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
name: `${namespace}/github-actions/setup`,
|
|
27
|
+
plugins: {
|
|
28
|
+
'github-actions': githubActionsPlugin,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
files: withDefaultFiles(files, defaultFiles),
|
|
33
|
+
languageOptions: recommendedConfig.languageOptions,
|
|
34
|
+
name: `${namespace}/github-actions/rules`,
|
|
35
|
+
rules: {
|
|
36
|
+
...(recommended ? recommendedConfig.rules : {}),
|
|
37
|
+
...(stylistic.enabled
|
|
38
|
+
? {
|
|
39
|
+
...stylisticConfig.rules,
|
|
40
|
+
'github-actions/action-name-casing': 'off', // TODO: We use kebab-case for action names
|
|
41
|
+
}
|
|
42
|
+
: {}),
|
|
43
|
+
...rules,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
] as [Config, Config] satisfies Array<Config>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export namespace githubActions {
|
|
50
|
+
export interface Options extends PluginOptionsBase<Rules> {}
|
|
51
|
+
|
|
52
|
+
export type Rules = RuleOptions;
|
|
53
|
+
}
|
package/src/config/jsonc.ts
CHANGED
|
@@ -55,14 +55,15 @@ export async function jsonc(options: jsonc.Options = {}): Promise<ReadonlyArray<
|
|
|
55
55
|
...rules,
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
|
-
stylistic.enabled ? sortPackageJson() : {},
|
|
59
|
-
stylistic.enabled ? sortTsconfigJson() : {},
|
|
58
|
+
stylistic.enabled ? sortPackageJson(namespace) : {},
|
|
59
|
+
stylistic.enabled ? sortTsconfigJson(namespace) : {},
|
|
60
60
|
] as [Config, Config, Config, Config] satisfies Array<Config>;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
function sortPackageJson() {
|
|
63
|
+
function sortPackageJson(namespace: string) {
|
|
64
64
|
return {
|
|
65
65
|
files: ['**/package.json'],
|
|
66
|
+
name: `${namespace}/jsonc/sort-package-json`,
|
|
66
67
|
rules: {
|
|
67
68
|
'jsonc/sort-keys': [
|
|
68
69
|
'error',
|
|
@@ -219,9 +220,10 @@ function sortPackageJson() {
|
|
|
219
220
|
};
|
|
220
221
|
}
|
|
221
222
|
|
|
222
|
-
function sortTsconfigJson() {
|
|
223
|
+
function sortTsconfigJson(namespace: string) {
|
|
223
224
|
return {
|
|
224
225
|
files: ['**/tsconfig*.json'],
|
|
226
|
+
name: `${namespace}/jsonc/sort-tsconfig`,
|
|
225
227
|
rules: {
|
|
226
228
|
'jsonc/sort-keys': [
|
|
227
229
|
'error',
|
package/src/config.ts
CHANGED
package/src/defineConfig.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface DefineConfigOptions extends config.ignores.Options {
|
|
|
21
21
|
plugins?: undefined | {
|
|
22
22
|
'e18e'?: boolean | config.e18e.Options | undefined;
|
|
23
23
|
'es'?: boolean | config.es.Options | undefined;
|
|
24
|
+
'github-actions'?: boolean | config.githubActions.Options | undefined;
|
|
24
25
|
'import'?: boolean | config.imports.Options | undefined;
|
|
25
26
|
'jsdoc'?: boolean | config.jsdoc.Options | undefined;
|
|
26
27
|
'jsonc'?: boolean | config.jsonc.Options | undefined;
|
|
@@ -96,6 +97,7 @@ export async function defineConfig(options: DefineConfigOptions = {}): Promise<A
|
|
|
96
97
|
...includeEnabled(config.jsonc, toOption(plugins.jsonc)),
|
|
97
98
|
...includeEnabled(config.markdown, toOption(plugins.markdown)),
|
|
98
99
|
...includeEnabled(config.yml, toOption(plugins.yml)),
|
|
100
|
+
...includeEnabled(config.githubActions, toOption(plugins['github-actions'])),
|
|
99
101
|
...(rules ? [{ rules }] : []),
|
|
100
102
|
...todo,
|
|
101
103
|
...overrides,
|