@luxass/eslint-config 4.2.15 → 4.3.1
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 +14 -14
- package/dist/index.cjs +50 -48
- package/dist/index.d.cts +11754 -58
- package/dist/index.d.ts +11754 -58
- package/dist/index.js +47 -51
- package/package.json +29 -36
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ With [`"type": "module"`](https://nodejs.org/api/packages.html#type) in `package
|
|
|
29
29
|
|
|
30
30
|
```js
|
|
31
31
|
// eslint.config.js
|
|
32
|
-
import
|
|
32
|
+
import luxass from '@luxass/eslint-config'
|
|
33
33
|
|
|
34
34
|
export default luxass()
|
|
35
35
|
```
|
|
@@ -38,7 +38,7 @@ With CJS:
|
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
40
|
// eslint.config.js
|
|
41
|
-
const
|
|
41
|
+
const luxass = require('@luxass/eslint-config')
|
|
42
42
|
|
|
43
43
|
module.exports = luxass()
|
|
44
44
|
```
|
|
@@ -47,7 +47,7 @@ Combined with legacy config:
|
|
|
47
47
|
|
|
48
48
|
```js
|
|
49
49
|
// eslint.config.js
|
|
50
|
-
const
|
|
50
|
+
const luxass = require('@luxass/eslint-config')
|
|
51
51
|
const { FlatCompat } = require('@eslint/eslintrc')
|
|
52
52
|
|
|
53
53
|
const compat = new FlatCompat()
|
|
@@ -129,7 +129,7 @@ Normally you would only need to import the `luxass` preset:
|
|
|
129
129
|
|
|
130
130
|
```js
|
|
131
131
|
// eslint.config.js
|
|
132
|
-
import
|
|
132
|
+
import luxass from '@luxass/eslint-config'
|
|
133
133
|
|
|
134
134
|
export default luxass()
|
|
135
135
|
```
|
|
@@ -138,7 +138,7 @@ you can also configure each `config` individually:
|
|
|
138
138
|
|
|
139
139
|
```js
|
|
140
140
|
// eslint.config.js
|
|
141
|
-
import
|
|
141
|
+
import luxass from '@luxass/eslint-config'
|
|
142
142
|
|
|
143
143
|
export default luxass({
|
|
144
144
|
stylistic: true,
|
|
@@ -159,7 +159,7 @@ The `luxass` function accepts an arbitrary number of `flat configs` overrides:
|
|
|
159
159
|
|
|
160
160
|
```js
|
|
161
161
|
// eslint.config.js
|
|
162
|
-
import
|
|
162
|
+
import luxass from '@luxass/eslint-config'
|
|
163
163
|
|
|
164
164
|
export default luxass({
|
|
165
165
|
// configuration points for my config
|
|
@@ -246,7 +246,7 @@ Certain rules would only be enabled in specific files, for example, `ts/*` rules
|
|
|
246
246
|
|
|
247
247
|
```js
|
|
248
248
|
// eslint.config.js
|
|
249
|
-
import
|
|
249
|
+
import luxass from '@luxass/eslint-config'
|
|
250
250
|
|
|
251
251
|
export default luxass(
|
|
252
252
|
{ vue: true, typescript: true },
|
|
@@ -270,7 +270,7 @@ We also provided a `overrides` options to make it easier:
|
|
|
270
270
|
|
|
271
271
|
```js
|
|
272
272
|
// eslint.config.js
|
|
273
|
-
import
|
|
273
|
+
import luxass from '@luxass/eslint-config'
|
|
274
274
|
|
|
275
275
|
export default luxass({
|
|
276
276
|
overrides: {
|
|
@@ -299,7 +299,7 @@ Use external formatters to format files that ESLint cannot handle yet (`.css`, `
|
|
|
299
299
|
|
|
300
300
|
```js
|
|
301
301
|
// eslint.config.js
|
|
302
|
-
import
|
|
302
|
+
import luxass from '@luxass/eslint-config'
|
|
303
303
|
|
|
304
304
|
export default luxass({
|
|
305
305
|
formatters: {
|
|
@@ -340,7 +340,7 @@ To enable React support, need to explicitly turn it on:
|
|
|
340
340
|
|
|
341
341
|
```js
|
|
342
342
|
// eslint.config.js
|
|
343
|
-
import
|
|
343
|
+
import luxass from '@luxass/eslint-config'
|
|
344
344
|
|
|
345
345
|
export default luxass({
|
|
346
346
|
react: true,
|
|
@@ -361,7 +361,7 @@ Next.JS also enables React support.
|
|
|
361
361
|
|
|
362
362
|
```js
|
|
363
363
|
// eslint.config.js
|
|
364
|
-
import
|
|
364
|
+
import luxass from '@luxass/eslint-config'
|
|
365
365
|
|
|
366
366
|
export default luxass({
|
|
367
367
|
nextjs: true,
|
|
@@ -380,7 +380,7 @@ To enable UnoCSS support, need to explicitly turn it on:
|
|
|
380
380
|
|
|
381
381
|
```js
|
|
382
382
|
// eslint.config.js
|
|
383
|
-
import
|
|
383
|
+
import luxass from '@luxass/eslint-config'
|
|
384
384
|
|
|
385
385
|
export default luxass({
|
|
386
386
|
unocss: true,
|
|
@@ -399,7 +399,7 @@ To enable TailwindCSS support, need to explicitly turn it on:
|
|
|
399
399
|
|
|
400
400
|
```js
|
|
401
401
|
// eslint.config.js
|
|
402
|
-
import
|
|
402
|
+
import luxass from '@luxass/eslint-config'
|
|
403
403
|
|
|
404
404
|
export default luxass({
|
|
405
405
|
tailwindcss: true,
|
|
@@ -422,7 +422,7 @@ You can optionally enable the [type aware rules](https://typescript-eslint.io/li
|
|
|
422
422
|
|
|
423
423
|
```js
|
|
424
424
|
// eslint.config.js
|
|
425
|
-
import
|
|
425
|
+
import luxass from '@luxass/eslint-config'
|
|
426
426
|
|
|
427
427
|
export default luxass({
|
|
428
428
|
typescript: {
|
package/dist/index.cjs
CHANGED
|
@@ -6,8 +6,8 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __export = (target, all) => {
|
|
9
|
-
for (var
|
|
10
|
-
__defProp(target,
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
11
|
};
|
|
12
12
|
var __copyProps = (to, from, except, desc) => {
|
|
13
13
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -70,10 +70,10 @@ __export(src_exports, {
|
|
|
70
70
|
javascript: () => javascript,
|
|
71
71
|
jsdoc: () => jsdoc,
|
|
72
72
|
jsonc: () => jsonc,
|
|
73
|
-
luxass: () => luxass,
|
|
74
73
|
markdown: () => markdown,
|
|
75
74
|
nextjs: () => nextjs,
|
|
76
75
|
node: () => node,
|
|
76
|
+
parserPlain: () => parserPlain,
|
|
77
77
|
react: () => react,
|
|
78
78
|
renameRules: () => renameRules,
|
|
79
79
|
resolveSubOptions: () => resolveSubOptions,
|
|
@@ -97,6 +97,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
97
97
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
98
98
|
var import_node_fs = require("fs");
|
|
99
99
|
var import_local_pkg4 = require("local-pkg");
|
|
100
|
+
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
100
101
|
|
|
101
102
|
// src/configs/comments.ts
|
|
102
103
|
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
@@ -822,6 +823,26 @@ async function javascript(options = {}) {
|
|
|
822
823
|
// src/utils.ts
|
|
823
824
|
var import_node_process = __toESM(require("process"), 1);
|
|
824
825
|
var import_local_pkg = require("local-pkg");
|
|
826
|
+
var parserPlain = {
|
|
827
|
+
meta: {
|
|
828
|
+
name: "parser-plain"
|
|
829
|
+
},
|
|
830
|
+
parseForESLint: (code) => ({
|
|
831
|
+
ast: {
|
|
832
|
+
body: [],
|
|
833
|
+
comments: [],
|
|
834
|
+
loc: { end: code.length, start: 0 },
|
|
835
|
+
range: [0, code.length],
|
|
836
|
+
tokens: [],
|
|
837
|
+
type: "Program"
|
|
838
|
+
},
|
|
839
|
+
scopeManager: null,
|
|
840
|
+
services: { isPlain: true },
|
|
841
|
+
visitorKeys: {
|
|
842
|
+
Program: []
|
|
843
|
+
}
|
|
844
|
+
})
|
|
845
|
+
};
|
|
825
846
|
async function combine(...configs) {
|
|
826
847
|
const resolved = await Promise.all(configs);
|
|
827
848
|
return resolved.flat();
|
|
@@ -989,38 +1010,6 @@ async function jsonc(options = {}) {
|
|
|
989
1010
|
];
|
|
990
1011
|
}
|
|
991
1012
|
|
|
992
|
-
// node_modules/.pnpm/eslint-parser-plain@0.1.0_patch_hash=2wwjuy7bj3rwnupmtdrepccgsy/node_modules/eslint-parser-plain/dist/index.mjs
|
|
993
|
-
var dist_exports = {};
|
|
994
|
-
__export(dist_exports, {
|
|
995
|
-
meta: () => meta,
|
|
996
|
-
parseForESLint: () => parseForESLint
|
|
997
|
-
});
|
|
998
|
-
|
|
999
|
-
// node_modules/.pnpm/eslint-parser-plain@0.1.0_patch_hash=2wwjuy7bj3rwnupmtdrepccgsy/node_modules/eslint-parser-plain/package.json
|
|
1000
|
-
var name = "eslint-parser-plain";
|
|
1001
|
-
var version = "0.1.0";
|
|
1002
|
-
|
|
1003
|
-
// node_modules/.pnpm/eslint-parser-plain@0.1.0_patch_hash=2wwjuy7bj3rwnupmtdrepccgsy/node_modules/eslint-parser-plain/dist/index.mjs
|
|
1004
|
-
var parseForESLint = (code) => ({
|
|
1005
|
-
ast: {
|
|
1006
|
-
type: "Program",
|
|
1007
|
-
loc: { start: 0, end: code.length },
|
|
1008
|
-
range: [0, code.length],
|
|
1009
|
-
body: [],
|
|
1010
|
-
comments: [],
|
|
1011
|
-
tokens: []
|
|
1012
|
-
},
|
|
1013
|
-
services: { isPlain: true },
|
|
1014
|
-
scopeManager: null,
|
|
1015
|
-
visitorKeys: {
|
|
1016
|
-
Program: []
|
|
1017
|
-
}
|
|
1018
|
-
});
|
|
1019
|
-
var meta = {
|
|
1020
|
-
name,
|
|
1021
|
-
version
|
|
1022
|
-
};
|
|
1023
|
-
|
|
1024
1013
|
// src/configs/markdown.ts
|
|
1025
1014
|
var import_eslint_merge_processors = require("eslint-merge-processors");
|
|
1026
1015
|
async function markdown(options = {}) {
|
|
@@ -1053,7 +1042,7 @@ async function markdown(options = {}) {
|
|
|
1053
1042
|
name: "luxass:markdown:parser",
|
|
1054
1043
|
files,
|
|
1055
1044
|
languageOptions: {
|
|
1056
|
-
parser:
|
|
1045
|
+
parser: parserPlain
|
|
1057
1046
|
}
|
|
1058
1047
|
},
|
|
1059
1048
|
{
|
|
@@ -2068,7 +2057,7 @@ async function react(options = {}) {
|
|
|
2068
2057
|
}
|
|
2069
2058
|
|
|
2070
2059
|
// src/configs/astro.ts
|
|
2071
|
-
async function astro(options) {
|
|
2060
|
+
async function astro(options = {}) {
|
|
2072
2061
|
const {
|
|
2073
2062
|
files = [GLOB_ASTRO],
|
|
2074
2063
|
overrides = {},
|
|
@@ -2270,7 +2259,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2270
2259
|
name: "luxass:formatter:css",
|
|
2271
2260
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
2272
2261
|
languageOptions: {
|
|
2273
|
-
parser:
|
|
2262
|
+
parser: parserPlain
|
|
2274
2263
|
},
|
|
2275
2264
|
rules: {
|
|
2276
2265
|
"format/prettier": [
|
|
@@ -2286,7 +2275,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2286
2275
|
name: "luxass:formatter:scss",
|
|
2287
2276
|
files: [GLOB_SCSS],
|
|
2288
2277
|
languageOptions: {
|
|
2289
|
-
parser:
|
|
2278
|
+
parser: parserPlain
|
|
2290
2279
|
},
|
|
2291
2280
|
rules: {
|
|
2292
2281
|
"format/prettier": [
|
|
@@ -2302,7 +2291,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2302
2291
|
name: "luxass:formatter:less",
|
|
2303
2292
|
files: [GLOB_LESS],
|
|
2304
2293
|
languageOptions: {
|
|
2305
|
-
parser:
|
|
2294
|
+
parser: parserPlain
|
|
2306
2295
|
},
|
|
2307
2296
|
rules: {
|
|
2308
2297
|
"format/prettier": [
|
|
@@ -2321,7 +2310,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2321
2310
|
name: "luxass:formatter:html",
|
|
2322
2311
|
files: ["**/*.html"],
|
|
2323
2312
|
languageOptions: {
|
|
2324
|
-
parser:
|
|
2313
|
+
parser: parserPlain
|
|
2325
2314
|
},
|
|
2326
2315
|
rules: {
|
|
2327
2316
|
"format/prettier": [
|
|
@@ -2340,7 +2329,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2340
2329
|
name: "luxass:formatter:markdown",
|
|
2341
2330
|
files: [GLOB_MARKDOWN],
|
|
2342
2331
|
languageOptions: {
|
|
2343
|
-
parser:
|
|
2332
|
+
parser: parserPlain
|
|
2344
2333
|
},
|
|
2345
2334
|
rules: {
|
|
2346
2335
|
[`format/${formater}`]: [
|
|
@@ -2363,7 +2352,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2363
2352
|
name: "luxass:formatter:astro",
|
|
2364
2353
|
files: [GLOB_ASTRO],
|
|
2365
2354
|
languageOptions: {
|
|
2366
|
-
parser:
|
|
2355
|
+
parser: parserPlain
|
|
2367
2356
|
},
|
|
2368
2357
|
rules: {
|
|
2369
2358
|
"format/prettier": [
|
|
@@ -2384,7 +2373,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2384
2373
|
name: "luxass:formatter:graphql",
|
|
2385
2374
|
files: [GLOB_GRAPHQL],
|
|
2386
2375
|
languageOptions: {
|
|
2387
|
-
parser:
|
|
2376
|
+
parser: parserPlain
|
|
2388
2377
|
},
|
|
2389
2378
|
rules: {
|
|
2390
2379
|
"format/prettier": [
|
|
@@ -2551,9 +2540,18 @@ var VuePackages = [
|
|
|
2551
2540
|
"vitepress",
|
|
2552
2541
|
"@slidev/cli"
|
|
2553
2542
|
];
|
|
2554
|
-
|
|
2543
|
+
var defaultPluginRenaming = {
|
|
2544
|
+
"@stylistic": "style",
|
|
2545
|
+
"@typescript-eslint": "ts",
|
|
2546
|
+
"import-x": "import",
|
|
2547
|
+
"n": "node",
|
|
2548
|
+
"vitest": "test",
|
|
2549
|
+
"yml": "yaml"
|
|
2550
|
+
};
|
|
2551
|
+
function luxass(options = {}, ...userConfigs) {
|
|
2555
2552
|
const {
|
|
2556
2553
|
astro: enableAstro = false,
|
|
2554
|
+
autoRenamePlugins = true,
|
|
2557
2555
|
editor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
|
|
2558
2556
|
exts = [],
|
|
2559
2557
|
gitignore: enableGitignore = true,
|
|
@@ -2716,11 +2714,15 @@ async function luxass(options = {}, ...userConfigs) {
|
|
|
2716
2714
|
if (Object.keys(fusedConfig).length) {
|
|
2717
2715
|
configs.push([fusedConfig]);
|
|
2718
2716
|
}
|
|
2719
|
-
|
|
2717
|
+
let pipeline = new import_eslint_flat_config_utils.FlatConfigPipeline();
|
|
2718
|
+
pipeline = pipeline.append(
|
|
2720
2719
|
...configs,
|
|
2721
2720
|
...userConfigs
|
|
2722
2721
|
);
|
|
2723
|
-
|
|
2722
|
+
if (autoRenamePlugins) {
|
|
2723
|
+
pipeline = pipeline.renamePlugins(defaultPluginRenaming);
|
|
2724
|
+
}
|
|
2725
|
+
return pipeline;
|
|
2724
2726
|
}
|
|
2725
2727
|
|
|
2726
2728
|
// src/index.ts
|
|
@@ -2766,10 +2768,10 @@ var src_default = luxass;
|
|
|
2766
2768
|
javascript,
|
|
2767
2769
|
jsdoc,
|
|
2768
2770
|
jsonc,
|
|
2769
|
-
luxass,
|
|
2770
2771
|
markdown,
|
|
2771
2772
|
nextjs,
|
|
2772
2773
|
node,
|
|
2774
|
+
parserPlain,
|
|
2773
2775
|
react,
|
|
2774
2776
|
renameRules,
|
|
2775
2777
|
resolveSubOptions,
|