@luxass/eslint-config 4.0.0-beta.8 → 4.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 +351 -48
- package/dist/{chunk-TQ476NL2.mjs → chunk-4YBQZLPS.mjs} +13 -2
- package/dist/{chunk-NDNDG7BH.mjs → chunk-5NK24IKQ.mjs} +2 -5
- package/dist/{chunk-2SW2E3TH.mjs → chunk-5SDSWPKR.mjs} +14 -4
- package/dist/chunk-6T7MXPCT.mjs +17 -0
- package/dist/{chunk-ADP4MYOS.mjs → chunk-ANUYBAYV.mjs} +1 -1
- package/dist/{chunk-R4NSLRAE.mjs → chunk-ATRL3UZP.mjs} +14 -8
- package/dist/{chunk-P3N5WLFL.mjs → chunk-BXBN56WI.mjs} +11 -7
- package/dist/chunk-CJ3ZUYUJ.mjs +183 -0
- package/dist/chunk-DAJA5AV3.mjs +29 -0
- package/dist/{chunk-FK567E7G.mjs → chunk-DVQQVCGF.mjs} +7 -3
- package/dist/chunk-DZCXT6HT.mjs +288 -0
- package/dist/chunk-FU5SRKZU.mjs +104 -0
- package/dist/{chunk-LQLF2CMA.mjs → chunk-GBLPCM3X.mjs} +14 -17
- package/dist/chunk-KJ7ZCBK4.mjs +48 -0
- package/dist/{chunk-BAKUP7QM.mjs → chunk-P3QUAOFO.mjs} +36 -34
- package/dist/{chunk-I2ECCPNN.mjs → chunk-PYS26PF3.mjs} +15 -10
- package/dist/chunk-Q57BF3CR.mjs +63 -0
- package/dist/{chunk-SPQZTV4E.mjs → chunk-QK56GX3F.mjs} +12 -14
- package/dist/{chunk-3QHLEAXK.mjs → chunk-RDZJT36Z.mjs} +22 -8
- package/dist/{chunk-HE56XDG6.mjs → chunk-RVSUTDCE.mjs} +15 -5
- package/dist/chunk-UMUUVFB7.mjs +69 -0
- package/dist/{chunk-NUG6FLHN.mjs → chunk-VZ2YFMWH.mjs} +54 -11
- package/dist/chunk-WDSV2EFG.mjs +7 -0
- package/dist/{chunk-M5WNLLBT.mjs → chunk-WOYZWHPM.mjs} +20 -7
- package/dist/chunk-WRURTO5T.mjs +144 -0
- package/dist/configs/astro.cjs +11 -21
- package/dist/configs/astro.d.cts +3 -6
- package/dist/configs/astro.d.ts +3 -6
- package/dist/configs/astro.mjs +3 -3
- package/dist/configs/comments.cjs +9 -12
- package/dist/configs/comments.d.cts +3 -2
- package/dist/configs/comments.d.ts +3 -2
- package/dist/configs/comments.mjs +1 -2
- package/dist/configs/formatters.cjs +274 -0
- package/dist/configs/formatters.d.cts +11 -0
- package/dist/configs/formatters.d.ts +11 -0
- package/dist/configs/formatters.mjs +9 -0
- package/dist/configs/ignores.cjs +1 -8
- package/dist/configs/ignores.d.cts +3 -2
- package/dist/configs/ignores.d.ts +3 -2
- package/dist/configs/ignores.mjs +2 -2
- package/dist/configs/imports.cjs +35 -9
- package/dist/configs/imports.d.cts +13 -4
- package/dist/configs/imports.d.ts +13 -4
- package/dist/configs/imports.mjs +2 -2
- package/dist/configs/index.cjs +1116 -707
- package/dist/configs/index.d.cts +7 -18
- package/dist/configs/index.d.ts +7 -18
- package/dist/configs/index.mjs +40 -36
- package/dist/configs/javascript.cjs +9 -23
- package/dist/configs/javascript.d.cts +3 -6
- package/dist/configs/javascript.d.ts +3 -6
- package/dist/configs/javascript.mjs +2 -3
- package/dist/configs/jsdoc.cjs +6 -2
- package/dist/configs/jsdoc.d.cts +17 -4
- package/dist/configs/jsdoc.d.ts +17 -4
- package/dist/configs/jsdoc.mjs +2 -2
- package/dist/configs/jsonc.cjs +8 -11
- package/dist/configs/jsonc.d.cts +3 -6
- package/dist/configs/jsonc.d.ts +3 -6
- package/dist/configs/jsonc.mjs +3 -3
- package/dist/configs/markdown.cjs +46 -35
- package/dist/configs/markdown.d.cts +25 -4
- package/dist/configs/markdown.d.ts +25 -4
- package/dist/configs/markdown.mjs +3 -3
- package/dist/configs/nextjs.cjs +15 -12
- package/dist/configs/nextjs.d.cts +3 -6
- package/dist/configs/nextjs.d.ts +3 -6
- package/dist/configs/nextjs.mjs +3 -3
- package/dist/configs/node.cjs +0 -10
- package/dist/configs/node.d.cts +3 -2
- package/dist/configs/node.d.ts +3 -2
- package/dist/configs/node.mjs +1 -2
- package/dist/configs/perfectionist.cjs +2 -20
- package/dist/configs/perfectionist.d.cts +4 -3
- package/dist/configs/perfectionist.d.ts +4 -3
- package/dist/configs/perfectionist.mjs +1 -2
- package/dist/configs/react.cjs +201 -203
- package/dist/configs/react.d.cts +3 -6
- package/dist/configs/react.d.ts +3 -6
- package/dist/configs/react.mjs +3 -3
- package/dist/configs/sort.cjs +6 -6
- package/dist/configs/sort.d.cts +3 -2
- package/dist/configs/sort.d.ts +3 -2
- package/dist/configs/sort.mjs +1 -1
- package/dist/configs/stylistic.cjs +20 -11
- package/dist/configs/stylistic.d.cts +4 -7
- package/dist/configs/stylistic.d.ts +4 -7
- package/dist/configs/stylistic.mjs +4 -3
- package/dist/configs/tailwindcss.cjs +34 -45
- package/dist/configs/tailwindcss.d.cts +3 -6
- package/dist/configs/tailwindcss.d.ts +3 -6
- package/dist/configs/tailwindcss.mjs +3 -3
- package/dist/configs/test.cjs +103 -16
- package/dist/configs/test.d.cts +3 -6
- package/dist/configs/test.d.ts +3 -6
- package/dist/configs/test.mjs +4 -3
- package/dist/configs/toml.cjs +131 -0
- package/dist/configs/toml.d.cts +11 -0
- package/dist/configs/toml.d.ts +11 -0
- package/dist/configs/toml.mjs +8 -0
- package/dist/configs/typescript.cjs +32 -43
- package/dist/configs/typescript.d.cts +3 -6
- package/dist/configs/typescript.d.ts +3 -6
- package/dist/configs/typescript.mjs +3 -4
- package/dist/configs/unicorn.cjs +13 -10
- package/dist/configs/unicorn.d.cts +3 -2
- package/dist/configs/unicorn.d.ts +3 -2
- package/dist/configs/unicorn.mjs +1 -2
- package/dist/configs/unocss.cjs +74 -4
- package/dist/configs/unocss.d.cts +3 -6
- package/dist/configs/unocss.d.ts +3 -6
- package/dist/configs/unocss.mjs +3 -2
- package/dist/configs/vue.cjs +51 -15
- package/dist/configs/vue.d.cts +3 -6
- package/dist/configs/vue.d.ts +3 -6
- package/dist/configs/vue.mjs +3 -3
- package/dist/configs/yaml.cjs +17 -11
- package/dist/configs/yaml.d.cts +3 -6
- package/dist/configs/yaml.d.ts +3 -6
- package/dist/configs/yaml.mjs +3 -3
- package/dist/custom-rules/utils.cjs +31 -0
- package/dist/custom-rules/utils.d.cts +6 -0
- package/dist/custom-rules/utils.d.ts +6 -0
- package/dist/custom-rules/utils.mjs +6 -0
- package/dist/globs.cjs +157 -0
- package/dist/globs.d.cts +28 -0
- package/dist/globs.d.ts +28 -0
- package/dist/globs.mjs +56 -0
- package/dist/index.cjs +1470 -1040
- package/dist/index.d.cts +10 -44
- package/dist/index.d.ts +10 -44
- package/dist/index.mjs +106 -140
- package/dist/types-spTEGSaV.d.cts +632 -0
- package/dist/types-spTEGSaV.d.ts +632 -0
- package/package.json +69 -37
- package/dist/chunk-24KJPXII.mjs +0 -51
- package/dist/chunk-4HH6LYJ6.mjs +0 -25
- package/dist/chunk-4JKENKIP.mjs +0 -67
- package/dist/chunk-C5VMTRKT.mjs +0 -18
- package/dist/chunk-CFSYEIE4.mjs +0 -23
- package/dist/chunk-ERFDRAGW.mjs +0 -86
- package/dist/chunk-HLDEUDLN.mjs +0 -28
- package/dist/chunk-UBPIYSHC.mjs +0 -284
- package/dist/types-fxhbVLKI.d.cts +0 -235
- package/dist/types-fxhbVLKI.d.ts +0 -235
- package/dist/{chunk-FKAOMYGL.mjs → chunk-ME2OAMS3.mjs} +0 -0
- package/dist/{chunk-FOIFEV73.mjs → chunk-XBASVDU6.mjs} +6 -6
|
@@ -30,18 +30,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/configs/stylistic.ts
|
|
31
31
|
var stylistic_exports = {};
|
|
32
32
|
__export(stylistic_exports, {
|
|
33
|
+
StylisticConfigDefaults: () => StylisticConfigDefaults,
|
|
33
34
|
stylistic: () => stylistic
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(stylistic_exports);
|
|
36
|
-
|
|
37
|
-
// src/plugins.ts
|
|
38
37
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
39
|
-
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
40
|
-
var pluginImport = __toESM(require("eslint-plugin-i"), 1);
|
|
41
|
-
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
42
|
-
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
43
|
-
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
44
|
-
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
45
38
|
|
|
46
39
|
// src/utils.ts
|
|
47
40
|
var import_node_process = __toESM(require("process"), 1);
|
|
@@ -52,8 +45,23 @@ async function interop(m) {
|
|
|
52
45
|
}
|
|
53
46
|
|
|
54
47
|
// src/configs/stylistic.ts
|
|
48
|
+
var StylisticConfigDefaults = {
|
|
49
|
+
indent: 2,
|
|
50
|
+
jsx: true,
|
|
51
|
+
quotes: "double",
|
|
52
|
+
semi: true
|
|
53
|
+
};
|
|
55
54
|
async function stylistic(options = {}) {
|
|
56
|
-
const {
|
|
55
|
+
const {
|
|
56
|
+
indent,
|
|
57
|
+
jsx,
|
|
58
|
+
overrides = {},
|
|
59
|
+
quotes,
|
|
60
|
+
semi
|
|
61
|
+
} = {
|
|
62
|
+
...StylisticConfigDefaults,
|
|
63
|
+
...options
|
|
64
|
+
};
|
|
57
65
|
const pluginStylistic = await interop(import("@stylistic/eslint-plugin"));
|
|
58
66
|
const config = pluginStylistic.configs.customize({
|
|
59
67
|
flat: true,
|
|
@@ -74,16 +82,17 @@ async function stylistic(options = {}) {
|
|
|
74
82
|
...config.rules,
|
|
75
83
|
"antfu/consistent-list-newline": "error",
|
|
76
84
|
"antfu/if-newline": "off",
|
|
77
|
-
"antfu/indent-binary-ops": ["error", { indent }],
|
|
78
85
|
"antfu/top-level-function": "error",
|
|
79
86
|
"curly": ["error", "multi-line", "consistent"],
|
|
80
87
|
"style/arrow-parens": ["error", "always", { requireForBlockBody: true }],
|
|
81
|
-
"style/brace-style": ["error", "1tbs", { allowSingleLine: true }]
|
|
88
|
+
"style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
89
|
+
...overrides
|
|
82
90
|
}
|
|
83
91
|
}
|
|
84
92
|
];
|
|
85
93
|
}
|
|
86
94
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
95
|
0 && (module.exports = {
|
|
96
|
+
StylisticConfigDefaults,
|
|
88
97
|
stylistic
|
|
89
98
|
});
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@stylistic/eslint-plugin';
|
|
2
|
+
export { S as StylisticConfig, o as StylisticConfigDefaults, c as StylisticOptions, s as stylistic } from '../types-spTEGSaV.cjs';
|
|
2
3
|
import 'eslint-config-flat-gitignore';
|
|
3
|
-
import '@typescript-eslint/parser';
|
|
4
4
|
import '@antfu/eslint-define-config';
|
|
5
5
|
import '@eslint-types/jsdoc/types';
|
|
6
6
|
import '@eslint-types/typescript-eslint/types';
|
|
7
7
|
import '@eslint-types/unicorn/types';
|
|
8
8
|
import 'eslint-plugin-antfu';
|
|
9
|
-
import '@stylistic/eslint-plugin';
|
|
10
9
|
import 'eslint';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export { stylistic };
|
|
10
|
+
import '@typescript-eslint/parser';
|
|
11
|
+
import 'eslint-processor-vue-blocks';
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@stylistic/eslint-plugin';
|
|
2
|
+
export { S as StylisticConfig, o as StylisticConfigDefaults, c as StylisticOptions, s as stylistic } from '../types-spTEGSaV.js';
|
|
2
3
|
import 'eslint-config-flat-gitignore';
|
|
3
|
-
import '@typescript-eslint/parser';
|
|
4
4
|
import '@antfu/eslint-define-config';
|
|
5
5
|
import '@eslint-types/jsdoc/types';
|
|
6
6
|
import '@eslint-types/typescript-eslint/types';
|
|
7
7
|
import '@eslint-types/unicorn/types';
|
|
8
8
|
import 'eslint-plugin-antfu';
|
|
9
|
-
import '@stylistic/eslint-plugin';
|
|
10
9
|
import 'eslint';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export { stylistic };
|
|
10
|
+
import '@typescript-eslint/parser';
|
|
11
|
+
import 'eslint-processor-vue-blocks';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
StylisticConfigDefaults,
|
|
2
3
|
stylistic
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-TQ476NL2.mjs";
|
|
4
|
+
} from "../chunk-RDZJT36Z.mjs";
|
|
5
|
+
import "../chunk-4YBQZLPS.mjs";
|
|
6
6
|
export {
|
|
7
|
+
StylisticConfigDefaults,
|
|
7
8
|
stylistic
|
|
8
9
|
};
|
|
@@ -36,11 +36,8 @@ module.exports = __toCommonJS(tailwindcss_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/globs.ts
|
|
38
38
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
39
|
-
var GLOB_SRC =
|
|
40
|
-
var GLOB_JSX_EXT = "[jt]sx";
|
|
41
|
-
var GLOB_JSX = `**/*.${GLOB_JSX_EXT}`;
|
|
39
|
+
var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
42
40
|
var GLOB_MARKDOWN = "**/*.md";
|
|
43
|
-
var GLOB_HTML = "**/*.htm?(l)";
|
|
44
41
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
45
42
|
var GLOB_TESTS = [
|
|
46
43
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -49,11 +46,6 @@ var GLOB_TESTS = [
|
|
|
49
46
|
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
50
47
|
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
51
48
|
];
|
|
52
|
-
var GLOB_NEXTJS_OG = [
|
|
53
|
-
`**/app/**/opengraph-image.${GLOB_JSX_EXT}`,
|
|
54
|
-
`**/app/**/twitter-image.${GLOB_JSX_EXT}`,
|
|
55
|
-
`**/app/**/route.${GLOB_JSX_EXT}`
|
|
56
|
-
];
|
|
57
49
|
var GLOB_NEXTJS_ROUTES = [
|
|
58
50
|
`**/app/**/page.${GLOB_SRC_EXT}`,
|
|
59
51
|
`**/app/**/layout.${GLOB_SRC_EXT}`,
|
|
@@ -86,8 +78,8 @@ async function ensure(packages) {
|
|
|
86
78
|
const { default: prompts } = await import("prompts");
|
|
87
79
|
const { result } = await prompts([
|
|
88
80
|
{
|
|
89
|
-
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
|
|
90
81
|
name: "result",
|
|
82
|
+
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
|
|
91
83
|
type: "confirm"
|
|
92
84
|
}
|
|
93
85
|
]);
|
|
@@ -100,55 +92,52 @@ async function ensure(packages) {
|
|
|
100
92
|
}
|
|
101
93
|
|
|
102
94
|
// src/configs/tailwindcss.ts
|
|
103
|
-
var DEFAULT_TAILWIND_CALLEES = ["classnames", "clsx", "cx", "cn"];
|
|
104
|
-
var DEFAULT_CLASS_REGEX = "^class(Name)?$";
|
|
105
95
|
async function tailwindcss(options = {}) {
|
|
106
96
|
const {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
config = void 0,
|
|
110
|
-
nextjs,
|
|
111
|
-
removeDuplicates = true
|
|
97
|
+
files = [GLOB_SRC],
|
|
98
|
+
overrides
|
|
112
99
|
} = options;
|
|
113
100
|
await ensure([
|
|
114
101
|
"eslint-plugin-tailwindcss"
|
|
115
102
|
]);
|
|
116
|
-
const
|
|
117
|
-
|
|
103
|
+
const [
|
|
104
|
+
pluginTailwindCSS
|
|
105
|
+
] = await Promise.all([
|
|
106
|
+
interop(import("eslint-plugin-tailwindcss"))
|
|
107
|
+
]);
|
|
118
108
|
return [
|
|
119
109
|
{
|
|
120
|
-
name: "luxass:tailwindcss",
|
|
110
|
+
name: "luxass:tailwindcss:setup",
|
|
111
|
+
languageOptions: {
|
|
112
|
+
parserOptions: {
|
|
113
|
+
ecmaFeatures: {
|
|
114
|
+
jsx: true
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
121
118
|
plugins: {
|
|
122
|
-
|
|
119
|
+
tailwind: pluginTailwindCSS
|
|
123
120
|
}
|
|
124
121
|
},
|
|
125
122
|
{
|
|
126
|
-
files: [GLOB_SRC, GLOB_HTML],
|
|
127
123
|
name: "luxass:tailwindcss:rules",
|
|
124
|
+
files,
|
|
128
125
|
rules: {
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
files: ["**/tailwind.config.?([cm])[jt]s"],
|
|
148
|
-
name: "luxass:tailwindcss:sort-keys-override",
|
|
149
|
-
rules: {
|
|
150
|
-
"sort-keys": "off",
|
|
151
|
-
"sort-keys/sort-keys-fix": "off"
|
|
126
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/classnames-order.md
|
|
127
|
+
"tailwind/classnames-order": "warn",
|
|
128
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-negative-arbitrary-values.md
|
|
129
|
+
"tailwind/enforces-negative-arbitrary-values": "warn",
|
|
130
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-shorthand.md
|
|
131
|
+
"tailwind/enforces-shorthand": "warn",
|
|
132
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/migration-from-tailwind-2.md
|
|
133
|
+
"tailwind/migration-from-tailwind-2": "warn",
|
|
134
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-arbitrary-value.md
|
|
135
|
+
"tailwind/no-arbitrary-value": "off",
|
|
136
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-contradicting-classname.md
|
|
137
|
+
"tailwind/no-contradicting-classname": "error",
|
|
138
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-custom-classname.md
|
|
139
|
+
"tailwind/no-custom-classname": "warn",
|
|
140
|
+
...overrides
|
|
152
141
|
}
|
|
153
142
|
}
|
|
154
143
|
];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { h as TailwindCSSOptions, g as tailwindcss } from '../types-spTEGSaV.cjs';
|
|
2
2
|
import 'eslint-config-flat-gitignore';
|
|
3
|
-
import '@typescript-eslint/parser';
|
|
4
3
|
import '@antfu/eslint-define-config';
|
|
5
4
|
import '@eslint-types/jsdoc/types';
|
|
6
5
|
import '@eslint-types/typescript-eslint/types';
|
|
@@ -8,7 +7,5 @@ import '@eslint-types/unicorn/types';
|
|
|
8
7
|
import 'eslint-plugin-antfu';
|
|
9
8
|
import '@stylistic/eslint-plugin';
|
|
10
9
|
import 'eslint';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export { tailwindcss };
|
|
10
|
+
import '@typescript-eslint/parser';
|
|
11
|
+
import 'eslint-processor-vue-blocks';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { h as TailwindCSSOptions, g as tailwindcss } from '../types-spTEGSaV.js';
|
|
2
2
|
import 'eslint-config-flat-gitignore';
|
|
3
|
-
import '@typescript-eslint/parser';
|
|
4
3
|
import '@antfu/eslint-define-config';
|
|
5
4
|
import '@eslint-types/jsdoc/types';
|
|
6
5
|
import '@eslint-types/typescript-eslint/types';
|
|
@@ -8,7 +7,5 @@ import '@eslint-types/unicorn/types';
|
|
|
8
7
|
import 'eslint-plugin-antfu';
|
|
9
8
|
import '@stylistic/eslint-plugin';
|
|
10
9
|
import 'eslint';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export { tailwindcss };
|
|
10
|
+
import '@typescript-eslint/parser';
|
|
11
|
+
import 'eslint-processor-vue-blocks';
|
package/dist/configs/test.cjs
CHANGED
|
@@ -36,9 +36,7 @@ module.exports = __toCommonJS(test_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/globs.ts
|
|
38
38
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
39
|
-
var GLOB_SRC =
|
|
40
|
-
var GLOB_JSX_EXT = "[jt]sx";
|
|
41
|
-
var GLOB_JSX = `**/*.${GLOB_JSX_EXT}`;
|
|
39
|
+
var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
42
40
|
var GLOB_MARKDOWN = "**/*.md";
|
|
43
41
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
44
42
|
var GLOB_TESTS = [
|
|
@@ -48,11 +46,6 @@ var GLOB_TESTS = [
|
|
|
48
46
|
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
49
47
|
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
50
48
|
];
|
|
51
|
-
var GLOB_NEXTJS_OG = [
|
|
52
|
-
`**/app/**/opengraph-image.${GLOB_JSX_EXT}`,
|
|
53
|
-
`**/app/**/twitter-image.${GLOB_JSX_EXT}`,
|
|
54
|
-
`**/app/**/route.${GLOB_JSX_EXT}`
|
|
55
|
-
];
|
|
56
49
|
var GLOB_NEXTJS_ROUTES = [
|
|
57
50
|
`**/app/**/page.${GLOB_SRC_EXT}`,
|
|
58
51
|
`**/app/**/layout.${GLOB_SRC_EXT}`,
|
|
@@ -73,15 +66,109 @@ async function interop(m) {
|
|
|
73
66
|
return resolved.default || resolved;
|
|
74
67
|
}
|
|
75
68
|
|
|
69
|
+
// src/custom-rules/utils.ts
|
|
70
|
+
var import_utils = require("@typescript-eslint/utils");
|
|
71
|
+
var createRule = import_utils.ESLintUtils.RuleCreator((ruleName) => `https://github.com/luxass/eslint-config/blob/main/src/custom-rules/${ruleName}/README.md`);
|
|
72
|
+
|
|
73
|
+
// src/custom-rules/no-only-tests/index.ts
|
|
74
|
+
var DEFAULT_OPTIONS = {
|
|
75
|
+
blocks: ["describe", "it", "test"],
|
|
76
|
+
focus: ["only"]
|
|
77
|
+
};
|
|
78
|
+
function getPath(node, path = []) {
|
|
79
|
+
if (node) {
|
|
80
|
+
const nodeName = node.name || node.property && node.property.name;
|
|
81
|
+
if (node.object) {
|
|
82
|
+
return getPath(node.object, [
|
|
83
|
+
nodeName,
|
|
84
|
+
...path
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
if (node.callee)
|
|
88
|
+
return getPath(node.callee, path);
|
|
89
|
+
return [nodeName, ...path];
|
|
90
|
+
}
|
|
91
|
+
return path;
|
|
92
|
+
}
|
|
93
|
+
var noOnlyTests = createRule({
|
|
94
|
+
name: "no-only-tests",
|
|
95
|
+
create: (context, [options]) => {
|
|
96
|
+
const {
|
|
97
|
+
blocks = DEFAULT_OPTIONS.blocks,
|
|
98
|
+
focus = DEFAULT_OPTIONS.focus
|
|
99
|
+
} = options;
|
|
100
|
+
const handler = {
|
|
101
|
+
Identifier(node) {
|
|
102
|
+
const parent = node.parent?.object;
|
|
103
|
+
if (!parent)
|
|
104
|
+
return;
|
|
105
|
+
if (!focus.includes(node.name))
|
|
106
|
+
return;
|
|
107
|
+
const callPath = getPath(node.parent).join(".");
|
|
108
|
+
const found = blocks.find((block) => {
|
|
109
|
+
if (block.endsWith("*"))
|
|
110
|
+
return callPath.startsWith(block.replace(/\*$/, ""));
|
|
111
|
+
return callPath.startsWith(`${block}.`);
|
|
112
|
+
});
|
|
113
|
+
if (found) {
|
|
114
|
+
context.report({
|
|
115
|
+
data: { block: callPath.split(".")[0], focus: node.name },
|
|
116
|
+
messageId: "notPermitted",
|
|
117
|
+
node
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
return handler;
|
|
123
|
+
},
|
|
124
|
+
defaultOptions: [{
|
|
125
|
+
blocks: ["describe", "it", "test"],
|
|
126
|
+
focus: ["only"]
|
|
127
|
+
}],
|
|
128
|
+
meta: {
|
|
129
|
+
docs: {
|
|
130
|
+
description: "disallow .only blocks in tests",
|
|
131
|
+
recommended: "recommended"
|
|
132
|
+
},
|
|
133
|
+
messages: {
|
|
134
|
+
notPermitted: "{{ block }}.{{ focus }} not permitted"
|
|
135
|
+
},
|
|
136
|
+
schema: [{
|
|
137
|
+
additionalProperties: false,
|
|
138
|
+
properties: {
|
|
139
|
+
blocks: {
|
|
140
|
+
items: {
|
|
141
|
+
type: "string"
|
|
142
|
+
},
|
|
143
|
+
type: "array",
|
|
144
|
+
uniqueItems: true
|
|
145
|
+
},
|
|
146
|
+
focus: {
|
|
147
|
+
items: {
|
|
148
|
+
type: "string"
|
|
149
|
+
},
|
|
150
|
+
type: "array",
|
|
151
|
+
uniqueItems: true
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
type: "object"
|
|
155
|
+
}],
|
|
156
|
+
type: "layout"
|
|
157
|
+
}
|
|
158
|
+
// i need to have this here, otherwise typechecking fails.
|
|
159
|
+
});
|
|
160
|
+
|
|
76
161
|
// src/configs/test.ts
|
|
77
162
|
async function test(options = {}) {
|
|
78
|
-
const {
|
|
163
|
+
const {
|
|
164
|
+
editor = false,
|
|
165
|
+
files = GLOB_TESTS,
|
|
166
|
+
overrides = {}
|
|
167
|
+
} = options;
|
|
79
168
|
const [
|
|
80
|
-
pluginVitest
|
|
81
|
-
pluginNoOnlyTests
|
|
169
|
+
pluginVitest
|
|
82
170
|
] = await Promise.all([
|
|
83
|
-
interop(import("eslint-plugin-vitest"))
|
|
84
|
-
interop(import("eslint-plugin-no-only-tests"))
|
|
171
|
+
interop(import("eslint-plugin-vitest"))
|
|
85
172
|
]);
|
|
86
173
|
return [
|
|
87
174
|
{
|
|
@@ -91,21 +178,21 @@ async function test(options = {}) {
|
|
|
91
178
|
...pluginVitest,
|
|
92
179
|
rules: {
|
|
93
180
|
...pluginVitest.rules,
|
|
94
|
-
|
|
181
|
+
"no-only-tests": noOnlyTests
|
|
95
182
|
}
|
|
96
183
|
}
|
|
97
184
|
}
|
|
98
185
|
},
|
|
99
186
|
{
|
|
100
|
-
files: GLOB_TESTS,
|
|
101
187
|
name: "luxass:test:rules",
|
|
188
|
+
files,
|
|
102
189
|
rules: {
|
|
103
190
|
"test/consistent-test-it": [
|
|
104
191
|
"error",
|
|
105
192
|
{ fn: "it", withinDescribe: "it" }
|
|
106
193
|
],
|
|
107
194
|
"test/no-identical-title": "error",
|
|
108
|
-
"test/no-only-tests":
|
|
195
|
+
"test/no-only-tests": editor ? "off" : "error",
|
|
109
196
|
"test/prefer-hooks-in-order": "error",
|
|
110
197
|
"test/prefer-lowercase-title": "error",
|
|
111
198
|
...overrides
|
package/dist/configs/test.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { e as TestOptions, d as test } from '../types-spTEGSaV.cjs';
|
|
2
2
|
import 'eslint-config-flat-gitignore';
|
|
3
|
-
import '@typescript-eslint/parser';
|
|
4
3
|
import '@antfu/eslint-define-config';
|
|
5
4
|
import '@eslint-types/jsdoc/types';
|
|
6
5
|
import '@eslint-types/typescript-eslint/types';
|
|
@@ -8,7 +7,5 @@ import '@eslint-types/unicorn/types';
|
|
|
8
7
|
import 'eslint-plugin-antfu';
|
|
9
8
|
import '@stylistic/eslint-plugin';
|
|
10
9
|
import 'eslint';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export { test };
|
|
10
|
+
import '@typescript-eslint/parser';
|
|
11
|
+
import 'eslint-processor-vue-blocks';
|
package/dist/configs/test.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { e as TestOptions, d as test } from '../types-spTEGSaV.js';
|
|
2
2
|
import 'eslint-config-flat-gitignore';
|
|
3
|
-
import '@typescript-eslint/parser';
|
|
4
3
|
import '@antfu/eslint-define-config';
|
|
5
4
|
import '@eslint-types/jsdoc/types';
|
|
6
5
|
import '@eslint-types/typescript-eslint/types';
|
|
@@ -8,7 +7,5 @@ import '@eslint-types/unicorn/types';
|
|
|
8
7
|
import 'eslint-plugin-antfu';
|
|
9
8
|
import '@stylistic/eslint-plugin';
|
|
10
9
|
import 'eslint';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export { test };
|
|
10
|
+
import '@typescript-eslint/parser';
|
|
11
|
+
import 'eslint-processor-vue-blocks';
|
package/dist/configs/test.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
test
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-WRURTO5T.mjs";
|
|
4
|
+
import "../chunk-WDSV2EFG.mjs";
|
|
5
|
+
import "../chunk-4YBQZLPS.mjs";
|
|
6
|
+
import "../chunk-ATRL3UZP.mjs";
|
|
6
7
|
export {
|
|
7
8
|
test
|
|
8
9
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/configs/toml.ts
|
|
31
|
+
var toml_exports = {};
|
|
32
|
+
__export(toml_exports, {
|
|
33
|
+
toml: () => toml
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(toml_exports);
|
|
36
|
+
|
|
37
|
+
// src/globs.ts
|
|
38
|
+
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
39
|
+
var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
40
|
+
var GLOB_MARKDOWN = "**/*.md";
|
|
41
|
+
var GLOB_TOML = "**/*.toml";
|
|
42
|
+
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
43
|
+
var GLOB_TESTS = [
|
|
44
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
45
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
46
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
47
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
48
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
49
|
+
];
|
|
50
|
+
var GLOB_NEXTJS_ROUTES = [
|
|
51
|
+
`**/app/**/page.${GLOB_SRC_EXT}`,
|
|
52
|
+
`**/app/**/layout.${GLOB_SRC_EXT}`,
|
|
53
|
+
`**/app/**/error.${GLOB_SRC_EXT}`,
|
|
54
|
+
`**/app/**/template.${GLOB_SRC_EXT}`,
|
|
55
|
+
`**/app/**/not-found.${GLOB_SRC_EXT}`,
|
|
56
|
+
`**/app/**/loading.${GLOB_SRC_EXT}`,
|
|
57
|
+
`**/app/**/robots.${GLOB_SRC_EXT}`,
|
|
58
|
+
`**/app/**/sitemap.${GLOB_SRC_EXT}`,
|
|
59
|
+
`**/pages/**/*.${GLOB_SRC_EXT}`
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
// src/utils.ts
|
|
63
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
64
|
+
var import_local_pkg = require("local-pkg");
|
|
65
|
+
async function interop(m) {
|
|
66
|
+
const resolved = await m;
|
|
67
|
+
return resolved.default || resolved;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/configs/toml.ts
|
|
71
|
+
async function toml(options = {}) {
|
|
72
|
+
const {
|
|
73
|
+
files = [GLOB_TOML],
|
|
74
|
+
overrides = {},
|
|
75
|
+
stylistic = true
|
|
76
|
+
} = options;
|
|
77
|
+
const {
|
|
78
|
+
indent = 2
|
|
79
|
+
} = typeof stylistic === "boolean" ? {} : stylistic;
|
|
80
|
+
const [
|
|
81
|
+
pluginToml,
|
|
82
|
+
parserToml
|
|
83
|
+
] = await Promise.all([
|
|
84
|
+
interop(import("eslint-plugin-toml")),
|
|
85
|
+
interop(import("toml-eslint-parser"))
|
|
86
|
+
]);
|
|
87
|
+
return [
|
|
88
|
+
{
|
|
89
|
+
name: "luxass:toml:setup",
|
|
90
|
+
plugins: {
|
|
91
|
+
toml: pluginToml
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "luxass:toml:rules",
|
|
96
|
+
files,
|
|
97
|
+
languageOptions: {
|
|
98
|
+
parser: parserToml
|
|
99
|
+
},
|
|
100
|
+
rules: {
|
|
101
|
+
"style/spaced-comment": "off",
|
|
102
|
+
"toml/comma-style": "error",
|
|
103
|
+
"toml/keys-order": "error",
|
|
104
|
+
"toml/no-space-dots": "error",
|
|
105
|
+
"toml/no-unreadable-number-separator": "error",
|
|
106
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
107
|
+
"toml/precision-of-integer": "error",
|
|
108
|
+
"toml/tables-order": "error",
|
|
109
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
110
|
+
...stylistic ? {
|
|
111
|
+
"toml/array-bracket-newline": "error",
|
|
112
|
+
"toml/array-bracket-spacing": "error",
|
|
113
|
+
"toml/array-element-newline": "error",
|
|
114
|
+
"toml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
115
|
+
"toml/inline-table-curly-spacing": "error",
|
|
116
|
+
"toml/key-spacing": "error",
|
|
117
|
+
"toml/padding-line-between-pairs": "error",
|
|
118
|
+
"toml/padding-line-between-tables": "error",
|
|
119
|
+
"toml/quoted-keys": "error",
|
|
120
|
+
"toml/spaced-comment": "error",
|
|
121
|
+
"toml/table-bracket-spacing": "error"
|
|
122
|
+
} : {},
|
|
123
|
+
...overrides
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
+
0 && (module.exports = {
|
|
130
|
+
toml
|
|
131
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { p as TOMLOptions, q as toml } from '../types-spTEGSaV.cjs';
|
|
2
|
+
import 'eslint-config-flat-gitignore';
|
|
3
|
+
import '@antfu/eslint-define-config';
|
|
4
|
+
import '@eslint-types/jsdoc/types';
|
|
5
|
+
import '@eslint-types/typescript-eslint/types';
|
|
6
|
+
import '@eslint-types/unicorn/types';
|
|
7
|
+
import 'eslint-plugin-antfu';
|
|
8
|
+
import '@stylistic/eslint-plugin';
|
|
9
|
+
import 'eslint';
|
|
10
|
+
import '@typescript-eslint/parser';
|
|
11
|
+
import 'eslint-processor-vue-blocks';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { p as TOMLOptions, q as toml } from '../types-spTEGSaV.js';
|
|
2
|
+
import 'eslint-config-flat-gitignore';
|
|
3
|
+
import '@antfu/eslint-define-config';
|
|
4
|
+
import '@eslint-types/jsdoc/types';
|
|
5
|
+
import '@eslint-types/typescript-eslint/types';
|
|
6
|
+
import '@eslint-types/unicorn/types';
|
|
7
|
+
import 'eslint-plugin-antfu';
|
|
8
|
+
import '@stylistic/eslint-plugin';
|
|
9
|
+
import 'eslint';
|
|
10
|
+
import '@typescript-eslint/parser';
|
|
11
|
+
import 'eslint-processor-vue-blocks';
|