@w5s/eslint-config 3.7.3 → 3.10.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/dist/index.d.ts +1193 -196
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -15
- package/dist/index.js.map +1 -1
- package/package.json +12 -16
- package/src/config/react.ts +43 -0
- package/src/config.ts +1 -0
- package/src/defineConfig.ts +19 -1
- package/src/typegen/e18e.d.ts +8 -0
- package/src/typegen/react.d.ts +768 -0
- package/src/typegen/unicorn.d.ts +423 -172
- package/src/typegen/yml.d.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/eslint-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -13,27 +13,22 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "git+
|
|
16
|
+
"url": "git+https://github.com/w5s/project-config.git",
|
|
17
17
|
"directory": "packages/eslint-config"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"author": "Julien Polo <julien.polo@gmail.com>",
|
|
21
21
|
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
|
-
".":
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"default": "./dist/index.js"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"./dist/*": "./dist/*"
|
|
23
|
+
"./package.json": "./package.json",
|
|
24
|
+
".": "./dist/index.js",
|
|
25
|
+
"./internal/*": null
|
|
30
26
|
},
|
|
31
27
|
"files": [
|
|
32
28
|
"dist/",
|
|
33
29
|
"src/",
|
|
34
30
|
"index.js",
|
|
35
31
|
"index.d.ts",
|
|
36
|
-
"!*.d.ts.map",
|
|
37
32
|
"!**/*.spec.*",
|
|
38
33
|
"!**/__tests__/**"
|
|
39
34
|
],
|
|
@@ -42,6 +37,7 @@
|
|
|
42
37
|
},
|
|
43
38
|
"dependencies": {
|
|
44
39
|
"@e18e/eslint-plugin": "^0.5.0",
|
|
40
|
+
"@eslint-react/eslint-plugin": "5.9.2",
|
|
45
41
|
"@eslint/js": "^10.0.0",
|
|
46
42
|
"@eslint/markdown": "^8.0.0",
|
|
47
43
|
"@next/eslint-plugin-next": "^16.0.0",
|
|
@@ -49,16 +45,16 @@
|
|
|
49
45
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
50
46
|
"@typescript-eslint/parser": "^8.0.0",
|
|
51
47
|
"@vitest/eslint-plugin": "^1.0.0",
|
|
52
|
-
"@w5s/dev": "^3.4.
|
|
53
|
-
"@w5s/eslint-config-ignore": "^1.2.
|
|
54
|
-
"@w5s/prettier-config": "^3.1.
|
|
48
|
+
"@w5s/dev": "^3.4.6",
|
|
49
|
+
"@w5s/eslint-config-ignore": "^1.2.6",
|
|
50
|
+
"@w5s/prettier-config": "^3.1.14",
|
|
55
51
|
"eslint-merge-processors": "^2.0.0",
|
|
56
52
|
"eslint-plugin-import": "~2.32.0",
|
|
57
53
|
"eslint-plugin-jsdoc": "~63.0.0",
|
|
58
54
|
"eslint-plugin-jsonc": "~3.2.0",
|
|
59
55
|
"eslint-plugin-n": "~18.1.0",
|
|
60
|
-
"eslint-plugin-unicorn": "~
|
|
61
|
-
"eslint-plugin-yml": "~3.
|
|
56
|
+
"eslint-plugin-unicorn": "~65.0.0",
|
|
57
|
+
"eslint-plugin-yml": "~3.5.0",
|
|
62
58
|
"globals": "^17.0.0",
|
|
63
59
|
"jsonc-eslint-parser": "^3.0.0",
|
|
64
60
|
"parse-gitignore": "^2.0.0",
|
|
@@ -83,5 +79,5 @@
|
|
|
83
79
|
"access": "public"
|
|
84
80
|
},
|
|
85
81
|
"sideEffect": false,
|
|
86
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "4cca98f83977b854f9d1d6b2338658aa3104ad0b"
|
|
87
83
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { interopDefault } from '@w5s/dev';
|
|
2
|
+
import { type Config, type PluginOptionsBase } from '../type.js';
|
|
3
|
+
import type { RuleOptions } from '../typegen/react.js';
|
|
4
|
+
import { sourceGlob } from '../glob.js';
|
|
5
|
+
|
|
6
|
+
const defaultFiles = [sourceGlob];
|
|
7
|
+
|
|
8
|
+
export async function react(options: react.Options = {}) {
|
|
9
|
+
const [reactPlugin] = await Promise.all([
|
|
10
|
+
interopDefault(import('@eslint-react/eslint-plugin')),
|
|
11
|
+
] as const);
|
|
12
|
+
const { files = defaultFiles, recommended, rules = {} } = options;
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
name: 'w5s/react/setup',
|
|
16
|
+
plugins: {
|
|
17
|
+
react: reactPlugin,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'w5s/react/rules',
|
|
22
|
+
files,
|
|
23
|
+
languageOptions: {
|
|
24
|
+
parserOptions: {
|
|
25
|
+
ecmaFeatures: {
|
|
26
|
+
jsx: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
sourceType: 'module',
|
|
30
|
+
},
|
|
31
|
+
rules: {
|
|
32
|
+
...(recommended ? reactPlugin.configs['recommended'].rules : {}),
|
|
33
|
+
...rules,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
] as [Config, Config] satisfies Array<Config>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export namespace react {
|
|
40
|
+
export type Rules = RuleOptions;
|
|
41
|
+
|
|
42
|
+
export interface Options extends Omit<PluginOptionsBase<Rules>, 'stylistic'> {}
|
|
43
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './config/imports.js';
|
|
|
7
7
|
export * from './config/markdown.js';
|
|
8
8
|
export * from './config/next.js';
|
|
9
9
|
export * from './config/node.js';
|
|
10
|
+
export * from './config/react.js';
|
|
10
11
|
export * from './config/stylistic.js';
|
|
11
12
|
export * from './config/test.js';
|
|
12
13
|
export * from './config/ts.js';
|
package/src/defineConfig.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { ESLintConfig } from '@w5s/dev';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
e18e,
|
|
4
|
+
es,
|
|
5
|
+
ignores,
|
|
6
|
+
imports,
|
|
7
|
+
jsdoc,
|
|
8
|
+
jsonc,
|
|
9
|
+
markdown,
|
|
10
|
+
next,
|
|
11
|
+
node,
|
|
12
|
+
react,
|
|
13
|
+
stylistic,
|
|
14
|
+
test,
|
|
15
|
+
ts,
|
|
16
|
+
unicorn,
|
|
17
|
+
yml,
|
|
18
|
+
} from './config.js';
|
|
3
19
|
import type { Config } from './type.js';
|
|
4
20
|
|
|
5
21
|
export interface DefineConfigOptions extends ignores.Options {
|
|
@@ -11,6 +27,7 @@ export interface DefineConfigOptions extends ignores.Options {
|
|
|
11
27
|
jsonc?: boolean | jsonc.Options;
|
|
12
28
|
next?: boolean | next.Options;
|
|
13
29
|
node?: boolean | node.Options;
|
|
30
|
+
react?: boolean | react.Options;
|
|
14
31
|
stylistic?: boolean | stylistic.Options;
|
|
15
32
|
test?: boolean | test.Options;
|
|
16
33
|
ts?: boolean | ts.Options;
|
|
@@ -38,6 +55,7 @@ export async function defineConfig(options: DefineConfigOptions = {}) {
|
|
|
38
55
|
...includeEnabled(ignores, toOption(options)),
|
|
39
56
|
...includeEnabled(jsonc, toOption(options.jsonc)),
|
|
40
57
|
...includeEnabled(jsdoc, toOption(options.jsdoc)),
|
|
58
|
+
...includeEnabled(react, toOption(options.react)),
|
|
41
59
|
...includeEnabled(stylistic, toOption(options.stylistic)),
|
|
42
60
|
...includeEnabled(imports, toOption(options.import)),
|
|
43
61
|
...includeEnabled(markdown, toOption(options.markdown)),
|
package/src/typegen/e18e.d.ts
CHANGED
|
@@ -61,6 +61,14 @@ export interface RuleOptions {
|
|
|
61
61
|
* Prefer the exponentiation operator ** over Math.pow()
|
|
62
62
|
*/
|
|
63
63
|
'e18e/prefer-exponentiation-operator'?: Linter.RuleEntry<[]>
|
|
64
|
+
/**
|
|
65
|
+
* Prefer Array.prototype.flatMap() over .map(fn).flat() to avoid the intermediate array
|
|
66
|
+
*/
|
|
67
|
+
'e18e/prefer-flatmap-over-map-flat'?: Linter.RuleEntry<[]>
|
|
68
|
+
/**
|
|
69
|
+
* Prefer `Map.prototype.getOrInsert()` over reading an entry with a default and writing it back
|
|
70
|
+
*/
|
|
71
|
+
'e18e/prefer-get-or-insert'?: Linter.RuleEntry<[]>
|
|
64
72
|
/**
|
|
65
73
|
* Prefer .includes() over indexOf() comparisons for arrays and strings
|
|
66
74
|
*/
|