@luxass/eslint-config 4.2.14 → 4.3.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 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 { luxass } from '@luxass/eslint-config'
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 { luxass } = require('@luxass/eslint-config')
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 { luxass } = require('@luxass/eslint-config')
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
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 { luxass } from '@luxass/eslint-config'
425
+ import luxass from '@luxass/eslint-config'
426
426
 
427
427
  export default luxass({
428
428
  typescript: {
package/dist/index.cjs CHANGED
@@ -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,8 +1010,28 @@ async function jsonc(options = {}) {
989
1010
  ];
990
1011
  }
991
1012
 
1013
+ // node_modules/.pnpm/eslint-parser-plain@0.1.0/node_modules/eslint-parser-plain/dist/index.mjs
1014
+ var dist_exports = {};
1015
+ __export(dist_exports, {
1016
+ parseForESLint: () => parseForESLint
1017
+ });
1018
+ var parseForESLint = (code) => ({
1019
+ ast: {
1020
+ type: "Program",
1021
+ loc: { start: 0, end: code.length },
1022
+ range: [0, code.length],
1023
+ body: [],
1024
+ comments: [],
1025
+ tokens: []
1026
+ },
1027
+ services: { isPlain: true },
1028
+ scopeManager: null,
1029
+ visitorKeys: {
1030
+ Program: []
1031
+ }
1032
+ });
1033
+
992
1034
  // src/configs/markdown.ts
993
- var parserPlain = __toESM(require("eslint-parser-plain"), 1);
994
1035
  var import_eslint_merge_processors = require("eslint-merge-processors");
995
1036
  async function markdown(options = {}) {
996
1037
  const {
@@ -1022,7 +1063,7 @@ async function markdown(options = {}) {
1022
1063
  name: "luxass:markdown:parser",
1023
1064
  files,
1024
1065
  languageOptions: {
1025
- parser: parserPlain
1066
+ parser: dist_exports
1026
1067
  }
1027
1068
  },
1028
1069
  {
@@ -2037,7 +2078,7 @@ async function react(options = {}) {
2037
2078
  }
2038
2079
 
2039
2080
  // src/configs/astro.ts
2040
- async function astro(options) {
2081
+ async function astro(options = {}) {
2041
2082
  const {
2042
2083
  files = [GLOB_ASTRO],
2043
2084
  overrides = {},
@@ -2182,7 +2223,6 @@ async function tailwindcss(options = {}) {
2182
2223
  }
2183
2224
 
2184
2225
  // src/configs/formatters.ts
2185
- var parserPlain2 = __toESM(require("eslint-parser-plain"), 1);
2186
2226
  var import_local_pkg3 = require("local-pkg");
2187
2227
  async function formatters(options = {}, stylistic2 = {}) {
2188
2228
  if (options === true) {
@@ -2240,7 +2280,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2240
2280
  name: "luxass:formatter:css",
2241
2281
  files: [GLOB_CSS, GLOB_POSTCSS],
2242
2282
  languageOptions: {
2243
- parser: parserPlain2
2283
+ parser: dist_exports
2244
2284
  },
2245
2285
  rules: {
2246
2286
  "format/prettier": [
@@ -2256,7 +2296,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2256
2296
  name: "luxass:formatter:scss",
2257
2297
  files: [GLOB_SCSS],
2258
2298
  languageOptions: {
2259
- parser: parserPlain2
2299
+ parser: dist_exports
2260
2300
  },
2261
2301
  rules: {
2262
2302
  "format/prettier": [
@@ -2272,7 +2312,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2272
2312
  name: "luxass:formatter:less",
2273
2313
  files: [GLOB_LESS],
2274
2314
  languageOptions: {
2275
- parser: parserPlain2
2315
+ parser: dist_exports
2276
2316
  },
2277
2317
  rules: {
2278
2318
  "format/prettier": [
@@ -2291,7 +2331,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2291
2331
  name: "luxass:formatter:html",
2292
2332
  files: ["**/*.html"],
2293
2333
  languageOptions: {
2294
- parser: parserPlain2
2334
+ parser: dist_exports
2295
2335
  },
2296
2336
  rules: {
2297
2337
  "format/prettier": [
@@ -2310,7 +2350,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2310
2350
  name: "luxass:formatter:markdown",
2311
2351
  files: [GLOB_MARKDOWN],
2312
2352
  languageOptions: {
2313
- parser: parserPlain2
2353
+ parser: dist_exports
2314
2354
  },
2315
2355
  rules: {
2316
2356
  [`format/${formater}`]: [
@@ -2333,7 +2373,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2333
2373
  name: "luxass:formatter:astro",
2334
2374
  files: [GLOB_ASTRO],
2335
2375
  languageOptions: {
2336
- parser: parserPlain2
2376
+ parser: dist_exports
2337
2377
  },
2338
2378
  rules: {
2339
2379
  "format/prettier": [
@@ -2354,7 +2394,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2354
2394
  name: "luxass:formatter:graphql",
2355
2395
  files: [GLOB_GRAPHQL],
2356
2396
  languageOptions: {
2357
- parser: parserPlain2
2397
+ parser: dist_exports
2358
2398
  },
2359
2399
  rules: {
2360
2400
  "format/prettier": [
@@ -2521,9 +2561,18 @@ var VuePackages = [
2521
2561
  "vitepress",
2522
2562
  "@slidev/cli"
2523
2563
  ];
2524
- async function luxass(options = {}, ...userConfigs) {
2564
+ var defaultPluginRenaming = {
2565
+ "@stylistic": "style",
2566
+ "@typescript-eslint": "ts",
2567
+ "import-x": "import",
2568
+ "n": "node",
2569
+ "vitest": "test",
2570
+ "yml": "yaml"
2571
+ };
2572
+ function luxass(options = {}, ...userConfigs) {
2525
2573
  const {
2526
2574
  astro: enableAstro = false,
2575
+ autoRenamePlugins = true,
2527
2576
  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),
2528
2577
  exts = [],
2529
2578
  gitignore: enableGitignore = true,
@@ -2686,11 +2735,15 @@ async function luxass(options = {}, ...userConfigs) {
2686
2735
  if (Object.keys(fusedConfig).length) {
2687
2736
  configs.push([fusedConfig]);
2688
2737
  }
2689
- const merged = combine(
2738
+ let pipeline = new import_eslint_flat_config_utils.FlatConfigPipeline();
2739
+ pipeline = pipeline.append(
2690
2740
  ...configs,
2691
2741
  ...userConfigs
2692
2742
  );
2693
- return merged;
2743
+ if (autoRenamePlugins) {
2744
+ pipeline = pipeline.renamePlugins(defaultPluginRenaming);
2745
+ }
2746
+ return pipeline;
2694
2747
  }
2695
2748
 
2696
2749
  // src/index.ts
@@ -2736,10 +2789,10 @@ var src_default = luxass;
2736
2789
  javascript,
2737
2790
  jsdoc,
2738
2791
  jsonc,
2739
- luxass,
2740
2792
  markdown,
2741
2793
  nextjs,
2742
2794
  node,
2795
+ parserPlain,
2743
2796
  react,
2744
2797
  renameRules,
2745
2798
  resolveSubOptions,