@debbl/eslint-config 1.0.0 → 1.1.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 +10 -4
- package/dist/index.cjs +68 -33
- package/dist/index.d.cts +17 -6
- package/dist/index.d.ts +17 -6
- package/dist/index.js +64 -31
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ export default config({
|
|
|
50
50
|
|
|
51
51
|
## 完整的 OptionConfig
|
|
52
52
|
|
|
53
|
-
[types.ts](./src/types.ts#
|
|
53
|
+
[types.ts](./src/types.ts#L56)
|
|
54
54
|
|
|
55
55
|
```ts
|
|
56
56
|
export interface OptionsConfig extends OptionsComponentExts {
|
|
@@ -89,11 +89,11 @@ export interface OptionsConfig extends OptionsComponentExts {
|
|
|
89
89
|
vue?: boolean;
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* Enable React support.
|
|
92
|
+
* Enable React support, Passing an object to enable Next.js support.
|
|
93
93
|
*
|
|
94
94
|
* @default false
|
|
95
95
|
*/
|
|
96
|
-
react?: boolean;
|
|
96
|
+
react?: boolean | ReactOptions;
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* Enable JSONC support.
|
|
@@ -123,9 +123,15 @@ export interface OptionsConfig extends OptionsComponentExts {
|
|
|
123
123
|
*/
|
|
124
124
|
prettier?: boolean | PrettierRequiredOptions;
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Enable Tailwind CSS support.
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
tailwindcss?: boolean;
|
|
131
|
+
|
|
126
132
|
/**
|
|
127
133
|
* Custom config
|
|
128
134
|
*/
|
|
129
135
|
customConfig?: ConfigItem[] | ConfigItem;
|
|
130
136
|
}
|
|
131
|
-
```
|
|
137
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -67,18 +67,21 @@ __export(src_exports, {
|
|
|
67
67
|
parserTs: () => parserTs,
|
|
68
68
|
parserVue: () => import_vue_eslint_parser.default,
|
|
69
69
|
parserYml: () => import_yaml_eslint_parser.default,
|
|
70
|
+
perfectionist: () => perfectionist,
|
|
70
71
|
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
71
72
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
72
73
|
pluginImport: () => pluginImport,
|
|
73
74
|
pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
|
|
74
75
|
pluginJsonc: () => pluginJsonc,
|
|
75
76
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
77
|
+
pluginNext: () => pluginNext,
|
|
76
78
|
pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
|
|
77
79
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
80
|
+
pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
|
|
78
81
|
pluginPrettier: () => import_eslint_plugin_prettier.default,
|
|
79
82
|
pluginReact: () => import_eslint_plugin_react.default,
|
|
80
83
|
pluginReactHooks: () => import_eslint_plugin_react_hooks.default,
|
|
81
|
-
|
|
84
|
+
pluginTailwindcss: () => import_eslint_plugin_tailwindcss.default,
|
|
82
85
|
pluginTs: () => import_eslint_plugin.default,
|
|
83
86
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
84
87
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
@@ -86,7 +89,6 @@ __export(src_exports, {
|
|
|
86
89
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
87
90
|
pluginYml: () => pluginYml,
|
|
88
91
|
prettier: () => prettier,
|
|
89
|
-
sortKeys: () => sortKeys,
|
|
90
92
|
sortPackageJson: () => sortPackageJson,
|
|
91
93
|
sortTsconfig: () => sortTsconfig,
|
|
92
94
|
test: () => test,
|
|
@@ -108,11 +110,12 @@ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
|
108
110
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
109
111
|
var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
|
|
110
112
|
var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
|
|
111
|
-
var
|
|
113
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
112
114
|
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
113
115
|
var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
|
|
114
116
|
var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
|
|
115
117
|
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
|
|
118
|
+
var pluginNext = __toESM(require("@next/eslint-plugin-next"), 1);
|
|
116
119
|
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
117
120
|
var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
118
121
|
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
@@ -121,6 +124,7 @@ var pluginYml = __toESM(require("eslint-plugin-yml"), 1);
|
|
|
121
124
|
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
122
125
|
var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
123
126
|
var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
|
|
127
|
+
var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
|
|
124
128
|
|
|
125
129
|
// src/configs/comments.ts
|
|
126
130
|
function comments() {
|
|
@@ -1287,13 +1291,13 @@ function test() {
|
|
|
1287
1291
|
];
|
|
1288
1292
|
}
|
|
1289
1293
|
|
|
1290
|
-
// src/configs/
|
|
1291
|
-
function
|
|
1294
|
+
// src/configs/perfectionist.ts
|
|
1295
|
+
function perfectionist() {
|
|
1292
1296
|
return [
|
|
1293
1297
|
{
|
|
1294
|
-
name: "eslint:
|
|
1298
|
+
name: "eslint:perfectionist",
|
|
1295
1299
|
plugins: {
|
|
1296
|
-
|
|
1300
|
+
perfectionist: import_eslint_plugin_perfectionist.default
|
|
1297
1301
|
}
|
|
1298
1302
|
}
|
|
1299
1303
|
];
|
|
@@ -1324,36 +1328,62 @@ function prettier(options) {
|
|
|
1324
1328
|
|
|
1325
1329
|
// src/utils.ts
|
|
1326
1330
|
function combine(...configs) {
|
|
1327
|
-
return configs.
|
|
1328
|
-
(config2) => Array.isArray(config2) ? config2 : [config2]
|
|
1329
|
-
);
|
|
1331
|
+
return configs.flat();
|
|
1330
1332
|
}
|
|
1331
1333
|
|
|
1332
1334
|
// src/configs/react.ts
|
|
1333
|
-
function
|
|
1335
|
+
function next() {
|
|
1334
1336
|
return [
|
|
1335
1337
|
{
|
|
1336
|
-
name: "eslint:react",
|
|
1337
1338
|
plugins: {
|
|
1338
|
-
"
|
|
1339
|
-
"react-hooks": import_eslint_plugin_react_hooks.default
|
|
1339
|
+
"@next/next": pluginNext
|
|
1340
1340
|
},
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1341
|
+
rules: {
|
|
1342
|
+
...pluginNext.configs.recommended.rules,
|
|
1343
|
+
...pluginNext.configs["core-web-vitals"].rules
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
];
|
|
1347
|
+
}
|
|
1348
|
+
function react(options = {}) {
|
|
1349
|
+
const { next: enableNext = false } = options;
|
|
1350
|
+
const _react = {
|
|
1351
|
+
name: "eslint:react",
|
|
1352
|
+
plugins: {
|
|
1353
|
+
"react": import_eslint_plugin_react.default,
|
|
1354
|
+
"react-hooks": import_eslint_plugin_react_hooks.default
|
|
1355
|
+
},
|
|
1356
|
+
settings: {
|
|
1357
|
+
react: {
|
|
1358
|
+
version: "18.0"
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1361
|
+
rules: {
|
|
1362
|
+
...import_eslint_plugin_react.default.configs.recommended.rules,
|
|
1363
|
+
...import_eslint_plugin_react_hooks.default.configs.recommended.rules,
|
|
1364
|
+
"jsx-quotes": ["error", "prefer-double"],
|
|
1365
|
+
"react/react-in-jsx-scope": "off",
|
|
1366
|
+
"react/jsx-indent": [1, 2],
|
|
1367
|
+
"react/jsx-indent-props": [1, 2],
|
|
1368
|
+
"react/jsx-closing-bracket-location": [
|
|
1369
|
+
1,
|
|
1370
|
+
{ selfClosing: "tag-aligned", nonEmpty: "tag-aligned" }
|
|
1371
|
+
]
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
return combine(_react, enableNext ? next() : []);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
// src/configs/tailwindcss.ts
|
|
1378
|
+
function tailwindcss() {
|
|
1379
|
+
return [
|
|
1380
|
+
{
|
|
1381
|
+
name: "eslint:tailwindcss",
|
|
1382
|
+
plugins: {
|
|
1383
|
+
tailwindcss: import_eslint_plugin_tailwindcss.default
|
|
1345
1384
|
},
|
|
1346
1385
|
rules: {
|
|
1347
|
-
...
|
|
1348
|
-
...import_eslint_plugin_react_hooks.default.configs.recommended.rules,
|
|
1349
|
-
"jsx-quotes": ["error", "prefer-double"],
|
|
1350
|
-
"react/react-in-jsx-scope": "off",
|
|
1351
|
-
"react/jsx-indent": [1, 2],
|
|
1352
|
-
"react/jsx-indent-props": [1, 2],
|
|
1353
|
-
"react/jsx-closing-bracket-location": [
|
|
1354
|
-
1,
|
|
1355
|
-
{ selfClosing: "tag-aligned", nonEmpty: "tag-aligned" }
|
|
1356
|
-
]
|
|
1386
|
+
...import_eslint_plugin_tailwindcss.default.configs.recommended.rules
|
|
1357
1387
|
}
|
|
1358
1388
|
}
|
|
1359
1389
|
];
|
|
@@ -1366,6 +1396,7 @@ function config(options = {}) {
|
|
|
1366
1396
|
react: enableReact,
|
|
1367
1397
|
typescript: enableTypeScript,
|
|
1368
1398
|
gitignore: enableGitignore = true,
|
|
1399
|
+
tailwindcss: enableTailwindcss,
|
|
1369
1400
|
componentExts = []
|
|
1370
1401
|
} = options;
|
|
1371
1402
|
const configs = [];
|
|
@@ -1379,8 +1410,7 @@ function config(options = {}) {
|
|
|
1379
1410
|
jsdoc(),
|
|
1380
1411
|
imports(),
|
|
1381
1412
|
unicorn(),
|
|
1382
|
-
|
|
1383
|
-
sortKeys()
|
|
1413
|
+
perfectionist()
|
|
1384
1414
|
);
|
|
1385
1415
|
if (enableVue)
|
|
1386
1416
|
componentExts.push("vue");
|
|
@@ -1403,7 +1433,7 @@ function config(options = {}) {
|
|
|
1403
1433
|
);
|
|
1404
1434
|
}
|
|
1405
1435
|
if (enableReact) {
|
|
1406
|
-
configs.push(react());
|
|
1436
|
+
configs.push(react(typeof enableReact !== "boolean" ? enableReact : {}));
|
|
1407
1437
|
}
|
|
1408
1438
|
if (options.jsonc ?? true) {
|
|
1409
1439
|
configs.push(jsonc(), sortPackageJson(), sortTsconfig());
|
|
@@ -1418,6 +1448,9 @@ function config(options = {}) {
|
|
|
1418
1448
|
})
|
|
1419
1449
|
);
|
|
1420
1450
|
}
|
|
1451
|
+
if (enableTailwindcss) {
|
|
1452
|
+
configs.push(tailwindcss());
|
|
1453
|
+
}
|
|
1421
1454
|
if (options.prettier ?? true) {
|
|
1422
1455
|
configs.push(
|
|
1423
1456
|
prettier({
|
|
@@ -1469,18 +1502,21 @@ var src_default = config;
|
|
|
1469
1502
|
parserTs,
|
|
1470
1503
|
parserVue,
|
|
1471
1504
|
parserYml,
|
|
1505
|
+
perfectionist,
|
|
1472
1506
|
pluginAntfu,
|
|
1473
1507
|
pluginComments,
|
|
1474
1508
|
pluginImport,
|
|
1475
1509
|
pluginJsdoc,
|
|
1476
1510
|
pluginJsonc,
|
|
1477
1511
|
pluginMarkdown,
|
|
1512
|
+
pluginNext,
|
|
1478
1513
|
pluginNoOnlyTests,
|
|
1479
1514
|
pluginNode,
|
|
1515
|
+
pluginPerfectionist,
|
|
1480
1516
|
pluginPrettier,
|
|
1481
1517
|
pluginReact,
|
|
1482
1518
|
pluginReactHooks,
|
|
1483
|
-
|
|
1519
|
+
pluginTailwindcss,
|
|
1484
1520
|
pluginTs,
|
|
1485
1521
|
pluginUnicorn,
|
|
1486
1522
|
pluginUnusedImports,
|
|
@@ -1488,7 +1524,6 @@ var src_default = config;
|
|
|
1488
1524
|
pluginVue,
|
|
1489
1525
|
pluginYml,
|
|
1490
1526
|
prettier,
|
|
1491
|
-
sortKeys,
|
|
1492
1527
|
sortPackageJson,
|
|
1493
1528
|
sortTsconfig,
|
|
1494
1529
|
test,
|
package/dist/index.d.cts
CHANGED
|
@@ -14,11 +14,13 @@ export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
|
14
14
|
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
15
15
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
16
16
|
export { default as pluginVitest } from 'eslint-plugin-vitest';
|
|
17
|
-
export { default as
|
|
17
|
+
export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
|
|
18
18
|
export { default as pluginPrettier } from 'eslint-plugin-prettier';
|
|
19
19
|
export { default as configPrettier } from 'eslint-config-prettier';
|
|
20
20
|
export { default as pluginReact } from 'eslint-plugin-react';
|
|
21
21
|
export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
|
|
22
|
+
import * as eslintPluginNext from '@next/eslint-plugin-next';
|
|
23
|
+
export { eslintPluginNext as pluginNext };
|
|
22
24
|
export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
23
25
|
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
24
26
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
@@ -28,6 +30,7 @@ export { default as parserYml } from 'yaml-eslint-parser';
|
|
|
28
30
|
import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
|
|
29
31
|
export { eslintPluginJsonc as pluginJsonc };
|
|
30
32
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
33
|
+
export { default as pluginTailwindcss } from 'eslint-plugin-tailwindcss';
|
|
31
34
|
|
|
32
35
|
type PrettierRequiredOptions = Partial<RequiredOptions>;
|
|
33
36
|
interface ConfigItem extends FlatESLintConfigItem {
|
|
@@ -67,6 +70,9 @@ interface OptionsTypeScriptWithTypes {
|
|
|
67
70
|
interface OptionsHasTypeScript {
|
|
68
71
|
typescript?: boolean;
|
|
69
72
|
}
|
|
73
|
+
interface ReactOptions {
|
|
74
|
+
next?: boolean;
|
|
75
|
+
}
|
|
70
76
|
interface OptionsConfig extends OptionsComponentExts {
|
|
71
77
|
/**
|
|
72
78
|
* Enable gitignore support.
|
|
@@ -97,11 +103,11 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
97
103
|
*/
|
|
98
104
|
vue?: boolean;
|
|
99
105
|
/**
|
|
100
|
-
* Enable React support.
|
|
106
|
+
* Enable React support, Passing an object to enable Next.js support.
|
|
101
107
|
*
|
|
102
108
|
* @default false
|
|
103
109
|
*/
|
|
104
|
-
react?: boolean;
|
|
110
|
+
react?: boolean | ReactOptions;
|
|
105
111
|
/**
|
|
106
112
|
* Enable JSONC support.
|
|
107
113
|
*
|
|
@@ -126,6 +132,11 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
126
132
|
* @default true
|
|
127
133
|
*/
|
|
128
134
|
prettier?: boolean | PrettierRequiredOptions;
|
|
135
|
+
/**
|
|
136
|
+
* Enable Tailwind CSS support.
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
tailwindcss?: boolean;
|
|
129
140
|
/**
|
|
130
141
|
* Custom config
|
|
131
142
|
*/
|
|
@@ -183,9 +194,9 @@ declare function test(): ConfigItem[];
|
|
|
183
194
|
/**
|
|
184
195
|
* Optional sort-keys plugin
|
|
185
196
|
*
|
|
186
|
-
* @see https://github.com/
|
|
197
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist/
|
|
187
198
|
*/
|
|
188
|
-
declare function
|
|
199
|
+
declare function perfectionist(): ConfigItem[];
|
|
189
200
|
|
|
190
201
|
declare function prettier(options: PrettierRequiredOptions): ConfigItem[];
|
|
191
202
|
|
|
@@ -216,4 +227,4 @@ declare const GLOB_TESTS: string[];
|
|
|
216
227
|
declare const GLOB_ALL_SRC: string[];
|
|
217
228
|
declare const GLOB_EXCLUDE: string[];
|
|
218
229
|
|
|
219
|
-
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, PrettierRequiredOptions, combine, comments, config, config as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node,
|
|
230
|
+
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, PrettierRequiredOptions, ReactOptions, combine, comments, config, config as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, perfectionist, prettier, sortPackageJson, sortTsconfig, test, typescript, unicorn, vue, yml };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,11 +14,13 @@ export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
|
14
14
|
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
15
15
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
16
16
|
export { default as pluginVitest } from 'eslint-plugin-vitest';
|
|
17
|
-
export { default as
|
|
17
|
+
export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
|
|
18
18
|
export { default as pluginPrettier } from 'eslint-plugin-prettier';
|
|
19
19
|
export { default as configPrettier } from 'eslint-config-prettier';
|
|
20
20
|
export { default as pluginReact } from 'eslint-plugin-react';
|
|
21
21
|
export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
|
|
22
|
+
import * as eslintPluginNext from '@next/eslint-plugin-next';
|
|
23
|
+
export { eslintPluginNext as pluginNext };
|
|
22
24
|
export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
23
25
|
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
24
26
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
@@ -28,6 +30,7 @@ export { default as parserYml } from 'yaml-eslint-parser';
|
|
|
28
30
|
import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
|
|
29
31
|
export { eslintPluginJsonc as pluginJsonc };
|
|
30
32
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
33
|
+
export { default as pluginTailwindcss } from 'eslint-plugin-tailwindcss';
|
|
31
34
|
|
|
32
35
|
type PrettierRequiredOptions = Partial<RequiredOptions>;
|
|
33
36
|
interface ConfigItem extends FlatESLintConfigItem {
|
|
@@ -67,6 +70,9 @@ interface OptionsTypeScriptWithTypes {
|
|
|
67
70
|
interface OptionsHasTypeScript {
|
|
68
71
|
typescript?: boolean;
|
|
69
72
|
}
|
|
73
|
+
interface ReactOptions {
|
|
74
|
+
next?: boolean;
|
|
75
|
+
}
|
|
70
76
|
interface OptionsConfig extends OptionsComponentExts {
|
|
71
77
|
/**
|
|
72
78
|
* Enable gitignore support.
|
|
@@ -97,11 +103,11 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
97
103
|
*/
|
|
98
104
|
vue?: boolean;
|
|
99
105
|
/**
|
|
100
|
-
* Enable React support.
|
|
106
|
+
* Enable React support, Passing an object to enable Next.js support.
|
|
101
107
|
*
|
|
102
108
|
* @default false
|
|
103
109
|
*/
|
|
104
|
-
react?: boolean;
|
|
110
|
+
react?: boolean | ReactOptions;
|
|
105
111
|
/**
|
|
106
112
|
* Enable JSONC support.
|
|
107
113
|
*
|
|
@@ -126,6 +132,11 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
126
132
|
* @default true
|
|
127
133
|
*/
|
|
128
134
|
prettier?: boolean | PrettierRequiredOptions;
|
|
135
|
+
/**
|
|
136
|
+
* Enable Tailwind CSS support.
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
tailwindcss?: boolean;
|
|
129
140
|
/**
|
|
130
141
|
* Custom config
|
|
131
142
|
*/
|
|
@@ -183,9 +194,9 @@ declare function test(): ConfigItem[];
|
|
|
183
194
|
/**
|
|
184
195
|
* Optional sort-keys plugin
|
|
185
196
|
*
|
|
186
|
-
* @see https://github.com/
|
|
197
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist/
|
|
187
198
|
*/
|
|
188
|
-
declare function
|
|
199
|
+
declare function perfectionist(): ConfigItem[];
|
|
189
200
|
|
|
190
201
|
declare function prettier(options: PrettierRequiredOptions): ConfigItem[];
|
|
191
202
|
|
|
@@ -216,4 +227,4 @@ declare const GLOB_TESTS: string[];
|
|
|
216
227
|
declare const GLOB_ALL_SRC: string[];
|
|
217
228
|
declare const GLOB_EXCLUDE: string[];
|
|
218
229
|
|
|
219
|
-
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, PrettierRequiredOptions, combine, comments, config, config as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node,
|
|
230
|
+
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, PrettierRequiredOptions, ReactOptions, combine, comments, config, config as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, perfectionist, prettier, sortPackageJson, sortTsconfig, test, typescript, unicorn, vue, yml };
|
package/dist/index.js
CHANGED
|
@@ -9,11 +9,12 @@ import { default as default7 } from "eslint-plugin-unicorn";
|
|
|
9
9
|
import { default as default8 } from "eslint-plugin-unused-imports";
|
|
10
10
|
import { default as default9 } from "eslint-plugin-no-only-tests";
|
|
11
11
|
import { default as default10 } from "eslint-plugin-vitest";
|
|
12
|
-
import { default as default11 } from "eslint-plugin-
|
|
12
|
+
import { default as default11 } from "eslint-plugin-perfectionist";
|
|
13
13
|
import { default as default12 } from "eslint-plugin-prettier";
|
|
14
14
|
import { default as default13 } from "eslint-config-prettier";
|
|
15
15
|
import { default as default14 } from "eslint-plugin-react";
|
|
16
16
|
import { default as default15 } from "eslint-plugin-react-hooks";
|
|
17
|
+
import * as pluginNext from "@next/eslint-plugin-next";
|
|
17
18
|
import * as parserTs from "@typescript-eslint/parser";
|
|
18
19
|
import { default as default16 } from "@typescript-eslint/eslint-plugin";
|
|
19
20
|
import { default as default17 } from "eslint-plugin-vue";
|
|
@@ -22,6 +23,7 @@ import * as pluginYml from "eslint-plugin-yml";
|
|
|
22
23
|
import { default as default19 } from "yaml-eslint-parser";
|
|
23
24
|
import * as pluginJsonc from "eslint-plugin-jsonc";
|
|
24
25
|
import { default as default20 } from "jsonc-eslint-parser";
|
|
26
|
+
import { default as default21 } from "eslint-plugin-tailwindcss";
|
|
25
27
|
|
|
26
28
|
// src/configs/comments.ts
|
|
27
29
|
function comments() {
|
|
@@ -1188,13 +1190,13 @@ function test() {
|
|
|
1188
1190
|
];
|
|
1189
1191
|
}
|
|
1190
1192
|
|
|
1191
|
-
// src/configs/
|
|
1192
|
-
function
|
|
1193
|
+
// src/configs/perfectionist.ts
|
|
1194
|
+
function perfectionist() {
|
|
1193
1195
|
return [
|
|
1194
1196
|
{
|
|
1195
|
-
name: "eslint:
|
|
1197
|
+
name: "eslint:perfectionist",
|
|
1196
1198
|
plugins: {
|
|
1197
|
-
|
|
1199
|
+
perfectionist: default11
|
|
1198
1200
|
}
|
|
1199
1201
|
}
|
|
1200
1202
|
];
|
|
@@ -1225,36 +1227,62 @@ function prettier(options) {
|
|
|
1225
1227
|
|
|
1226
1228
|
// src/utils.ts
|
|
1227
1229
|
function combine(...configs) {
|
|
1228
|
-
return configs.
|
|
1229
|
-
(config2) => Array.isArray(config2) ? config2 : [config2]
|
|
1230
|
-
);
|
|
1230
|
+
return configs.flat();
|
|
1231
1231
|
}
|
|
1232
1232
|
|
|
1233
1233
|
// src/configs/react.ts
|
|
1234
|
-
function
|
|
1234
|
+
function next() {
|
|
1235
1235
|
return [
|
|
1236
1236
|
{
|
|
1237
|
-
name: "eslint:react",
|
|
1238
1237
|
plugins: {
|
|
1239
|
-
"
|
|
1240
|
-
"react-hooks": default15
|
|
1238
|
+
"@next/next": pluginNext
|
|
1241
1239
|
},
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1240
|
+
rules: {
|
|
1241
|
+
...pluginNext.configs.recommended.rules,
|
|
1242
|
+
...pluginNext.configs["core-web-vitals"].rules
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
];
|
|
1246
|
+
}
|
|
1247
|
+
function react(options = {}) {
|
|
1248
|
+
const { next: enableNext = false } = options;
|
|
1249
|
+
const _react = {
|
|
1250
|
+
name: "eslint:react",
|
|
1251
|
+
plugins: {
|
|
1252
|
+
"react": default14,
|
|
1253
|
+
"react-hooks": default15
|
|
1254
|
+
},
|
|
1255
|
+
settings: {
|
|
1256
|
+
react: {
|
|
1257
|
+
version: "18.0"
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
rules: {
|
|
1261
|
+
...default14.configs.recommended.rules,
|
|
1262
|
+
...default15.configs.recommended.rules,
|
|
1263
|
+
"jsx-quotes": ["error", "prefer-double"],
|
|
1264
|
+
"react/react-in-jsx-scope": "off",
|
|
1265
|
+
"react/jsx-indent": [1, 2],
|
|
1266
|
+
"react/jsx-indent-props": [1, 2],
|
|
1267
|
+
"react/jsx-closing-bracket-location": [
|
|
1268
|
+
1,
|
|
1269
|
+
{ selfClosing: "tag-aligned", nonEmpty: "tag-aligned" }
|
|
1270
|
+
]
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
return combine(_react, enableNext ? next() : []);
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// src/configs/tailwindcss.ts
|
|
1277
|
+
function tailwindcss() {
|
|
1278
|
+
return [
|
|
1279
|
+
{
|
|
1280
|
+
name: "eslint:tailwindcss",
|
|
1281
|
+
plugins: {
|
|
1282
|
+
tailwindcss: default21
|
|
1246
1283
|
},
|
|
1247
1284
|
rules: {
|
|
1248
|
-
...
|
|
1249
|
-
...default15.configs.recommended.rules,
|
|
1250
|
-
"jsx-quotes": ["error", "prefer-double"],
|
|
1251
|
-
"react/react-in-jsx-scope": "off",
|
|
1252
|
-
"react/jsx-indent": [1, 2],
|
|
1253
|
-
"react/jsx-indent-props": [1, 2],
|
|
1254
|
-
"react/jsx-closing-bracket-location": [
|
|
1255
|
-
1,
|
|
1256
|
-
{ selfClosing: "tag-aligned", nonEmpty: "tag-aligned" }
|
|
1257
|
-
]
|
|
1285
|
+
...default21.configs.recommended.rules
|
|
1258
1286
|
}
|
|
1259
1287
|
}
|
|
1260
1288
|
];
|
|
@@ -1267,6 +1295,7 @@ function config(options = {}) {
|
|
|
1267
1295
|
react: enableReact,
|
|
1268
1296
|
typescript: enableTypeScript,
|
|
1269
1297
|
gitignore: enableGitignore = true,
|
|
1298
|
+
tailwindcss: enableTailwindcss,
|
|
1270
1299
|
componentExts = []
|
|
1271
1300
|
} = options;
|
|
1272
1301
|
const configs = [];
|
|
@@ -1280,8 +1309,7 @@ function config(options = {}) {
|
|
|
1280
1309
|
jsdoc(),
|
|
1281
1310
|
imports(),
|
|
1282
1311
|
unicorn(),
|
|
1283
|
-
|
|
1284
|
-
sortKeys()
|
|
1312
|
+
perfectionist()
|
|
1285
1313
|
);
|
|
1286
1314
|
if (enableVue)
|
|
1287
1315
|
componentExts.push("vue");
|
|
@@ -1304,7 +1332,7 @@ function config(options = {}) {
|
|
|
1304
1332
|
);
|
|
1305
1333
|
}
|
|
1306
1334
|
if (enableReact) {
|
|
1307
|
-
configs.push(react());
|
|
1335
|
+
configs.push(react(typeof enableReact !== "boolean" ? enableReact : {}));
|
|
1308
1336
|
}
|
|
1309
1337
|
if (options.jsonc ?? true) {
|
|
1310
1338
|
configs.push(jsonc(), sortPackageJson(), sortTsconfig());
|
|
@@ -1319,6 +1347,9 @@ function config(options = {}) {
|
|
|
1319
1347
|
})
|
|
1320
1348
|
);
|
|
1321
1349
|
}
|
|
1350
|
+
if (enableTailwindcss) {
|
|
1351
|
+
configs.push(tailwindcss());
|
|
1352
|
+
}
|
|
1322
1353
|
if (options.prettier ?? true) {
|
|
1323
1354
|
configs.push(
|
|
1324
1355
|
prettier({
|
|
@@ -1370,18 +1401,21 @@ export {
|
|
|
1370
1401
|
parserTs,
|
|
1371
1402
|
default18 as parserVue,
|
|
1372
1403
|
default19 as parserYml,
|
|
1404
|
+
perfectionist,
|
|
1373
1405
|
default2 as pluginAntfu,
|
|
1374
1406
|
default3 as pluginComments,
|
|
1375
1407
|
pluginImport,
|
|
1376
1408
|
default4 as pluginJsdoc,
|
|
1377
1409
|
pluginJsonc,
|
|
1378
1410
|
default5 as pluginMarkdown,
|
|
1411
|
+
pluginNext,
|
|
1379
1412
|
default9 as pluginNoOnlyTests,
|
|
1380
1413
|
default6 as pluginNode,
|
|
1414
|
+
default11 as pluginPerfectionist,
|
|
1381
1415
|
default12 as pluginPrettier,
|
|
1382
1416
|
default14 as pluginReact,
|
|
1383
1417
|
default15 as pluginReactHooks,
|
|
1384
|
-
|
|
1418
|
+
default21 as pluginTailwindcss,
|
|
1385
1419
|
default16 as pluginTs,
|
|
1386
1420
|
default7 as pluginUnicorn,
|
|
1387
1421
|
default8 as pluginUnusedImports,
|
|
@@ -1389,7 +1423,6 @@ export {
|
|
|
1389
1423
|
default17 as pluginVue,
|
|
1390
1424
|
pluginYml,
|
|
1391
1425
|
prettier,
|
|
1392
|
-
sortKeys,
|
|
1393
1426
|
sortPackageJson,
|
|
1394
1427
|
sortTsconfig,
|
|
1395
1428
|
test,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@debbl/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"packageManager": "pnpm@8.10.
|
|
4
|
+
"version": "1.1.0",
|
|
5
|
+
"packageManager": "pnpm@8.10.2",
|
|
6
6
|
"description": "Brendan Dash's ESLint config",
|
|
7
7
|
"author": "Debbl <me@aiwan.run> (https://github.com/Debbl/)",
|
|
8
8
|
"license": "MIT",
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"eslint": ">=8.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@next/eslint-plugin-next": "^14.0.1",
|
|
30
31
|
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
|
31
32
|
"@typescript-eslint/parser": "^6.9.1",
|
|
32
33
|
"eslint-config-prettier": "^9.0.0",
|
|
33
34
|
"eslint-define-config": "^1.24.1",
|
|
34
|
-
"eslint-plugin-antfu": "^1.0.
|
|
35
|
+
"eslint-plugin-antfu": "^1.0.2",
|
|
35
36
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
36
37
|
"eslint-plugin-i": "^2.29.0",
|
|
37
38
|
"eslint-plugin-jsdoc": "^46.8.2",
|
|
@@ -39,13 +40,14 @@
|
|
|
39
40
|
"eslint-plugin-markdown": "^3.0.1",
|
|
40
41
|
"eslint-plugin-n": "^16.2.0",
|
|
41
42
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
43
|
+
"eslint-plugin-perfectionist": "^2.2.0",
|
|
42
44
|
"eslint-plugin-prettier": "^5.0.1",
|
|
43
45
|
"eslint-plugin-react": "^7.33.2",
|
|
44
46
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
45
|
-
"eslint-plugin-
|
|
47
|
+
"eslint-plugin-tailwindcss": "^3.13.0",
|
|
46
48
|
"eslint-plugin-unicorn": "^49.0.0",
|
|
47
49
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
48
|
-
"eslint-plugin-vitest": "^0.3.
|
|
50
|
+
"eslint-plugin-vitest": "^0.3.9",
|
|
49
51
|
"eslint-plugin-vue": "^9.18.1",
|
|
50
52
|
"eslint-plugin-yml": "^1.10.0",
|
|
51
53
|
"globals": "^13.23.0",
|
|
@@ -56,7 +58,6 @@
|
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
60
|
"@types/eslint": "^8.44.6",
|
|
59
|
-
"@types/fs-extra": "^11.0.3",
|
|
60
61
|
"@types/node": "^20.8.10",
|
|
61
62
|
"bumpp": "^9.2.0",
|
|
62
63
|
"eslint": "^8.52.0",
|