@luxass/eslint-config 4.2.15 → 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
@@ -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 name2 in all)
10
- __defProp(target, name2, { get: all[name2], enumerable: true });
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,18 +1010,11 @@ 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
1013
+ // node_modules/.pnpm/eslint-parser-plain@0.1.0/node_modules/eslint-parser-plain/dist/index.mjs
993
1014
  var dist_exports = {};
994
1015
  __export(dist_exports, {
995
- meta: () => meta,
996
1016
  parseForESLint: () => parseForESLint
997
1017
  });
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
1018
  var parseForESLint = (code) => ({
1005
1019
  ast: {
1006
1020
  type: "Program",
@@ -1016,10 +1030,6 @@ var parseForESLint = (code) => ({
1016
1030
  Program: []
1017
1031
  }
1018
1032
  });
1019
- var meta = {
1020
- name,
1021
- version
1022
- };
1023
1033
 
1024
1034
  // src/configs/markdown.ts
1025
1035
  var import_eslint_merge_processors = require("eslint-merge-processors");
@@ -2068,7 +2078,7 @@ async function react(options = {}) {
2068
2078
  }
2069
2079
 
2070
2080
  // src/configs/astro.ts
2071
- async function astro(options) {
2081
+ async function astro(options = {}) {
2072
2082
  const {
2073
2083
  files = [GLOB_ASTRO],
2074
2084
  overrides = {},
@@ -2551,9 +2561,18 @@ var VuePackages = [
2551
2561
  "vitepress",
2552
2562
  "@slidev/cli"
2553
2563
  ];
2554
- 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) {
2555
2573
  const {
2556
2574
  astro: enableAstro = false,
2575
+ autoRenamePlugins = true,
2557
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),
2558
2577
  exts = [],
2559
2578
  gitignore: enableGitignore = true,
@@ -2716,11 +2735,15 @@ async function luxass(options = {}, ...userConfigs) {
2716
2735
  if (Object.keys(fusedConfig).length) {
2717
2736
  configs.push([fusedConfig]);
2718
2737
  }
2719
- const merged = combine(
2738
+ let pipeline = new import_eslint_flat_config_utils.FlatConfigPipeline();
2739
+ pipeline = pipeline.append(
2720
2740
  ...configs,
2721
2741
  ...userConfigs
2722
2742
  );
2723
- return merged;
2743
+ if (autoRenamePlugins) {
2744
+ pipeline = pipeline.renamePlugins(defaultPluginRenaming);
2745
+ }
2746
+ return pipeline;
2724
2747
  }
2725
2748
 
2726
2749
  // src/index.ts
@@ -2766,10 +2789,10 @@ var src_default = luxass;
2766
2789
  javascript,
2767
2790
  jsdoc,
2768
2791
  jsonc,
2769
- luxass,
2770
2792
  markdown,
2771
2793
  nextjs,
2772
2794
  node,
2795
+ parserPlain,
2773
2796
  react,
2774
2797
  renameRules,
2775
2798
  resolveSubOptions,