@saasmakers/eslint 1.0.2 → 1.0.5

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.
Files changed (65) hide show
  1. package/dist/eslint.config.cjs +10903 -19
  2. package/dist/eslint.config.d.cts +2 -3876
  3. package/dist/eslint.config.d.mts +2 -3876
  4. package/dist/eslint.config.d.ts +2 -3876
  5. package/dist/eslint.config.mjs +10882 -18
  6. package/dist/index.cjs +9 -8
  7. package/dist/index.d.cts +2864 -530
  8. package/dist/index.d.mts +2864 -530
  9. package/dist/index.d.ts +2864 -530
  10. package/dist/index.mjs +9 -8
  11. package/dist/shared/{eslint.C6EaTeQZ.mjs → eslint.CohBuu1-.mjs} +1 -34
  12. package/dist/shared/{eslint.Dxl4X46J.cjs → eslint.DhFjwkxh.cjs} +0 -37
  13. package/package.json +6 -8
  14. package/dist/chunks/formatters.cjs +0 -248
  15. package/dist/chunks/formatters.mjs +0 -246
  16. package/dist/chunks/import.cjs +0 -53
  17. package/dist/chunks/import.mjs +0 -51
  18. package/dist/chunks/index.cjs +0 -120
  19. package/dist/chunks/index.mjs +0 -101
  20. package/dist/chunks/index2.cjs +0 -880
  21. package/dist/chunks/index2.mjs +0 -868
  22. package/dist/chunks/index3.cjs +0 -982
  23. package/dist/chunks/index3.mjs +0 -979
  24. package/dist/chunks/index4.cjs +0 -12099
  25. package/dist/chunks/index4.mjs +0 -12077
  26. package/dist/chunks/jsdoc.cjs +0 -38398
  27. package/dist/chunks/jsdoc.mjs +0 -38391
  28. package/dist/chunks/regexp.cjs +0 -18518
  29. package/dist/chunks/regexp.mjs +0 -18511
  30. package/dist/chunks/stylistic.cjs +0 -23935
  31. package/dist/chunks/stylistic.mjs +0 -23932
  32. package/dist/chunks/typescript.cjs +0 -56168
  33. package/dist/chunks/typescript.mjs +0 -56154
  34. package/dist/chunks/unicorn.cjs +0 -82775
  35. package/dist/chunks/unicorn.mjs +0 -82764
  36. package/dist/chunks/vue.cjs +0 -96233
  37. package/dist/chunks/vue.mjs +0 -96220
  38. package/dist/shared/eslint.05nu4VbT.mjs +0 -9
  39. package/dist/shared/eslint.07qTxm9w.mjs +0 -3352
  40. package/dist/shared/eslint.6MAvpL4q.cjs +0 -2141
  41. package/dist/shared/eslint.7dipMixF.cjs +0 -14
  42. package/dist/shared/eslint.B6FFUbNC.mjs +0 -3814
  43. package/dist/shared/eslint.BGpVg2tt.cjs +0 -13
  44. package/dist/shared/eslint.BL4sYiVQ.cjs +0 -820
  45. package/dist/shared/eslint.BOOP2x9L.cjs +0 -67
  46. package/dist/shared/eslint.BXzpdiiq.mjs +0 -10
  47. package/dist/shared/eslint.Bl69eiyD.cjs +0 -7073
  48. package/dist/shared/eslint.BtkqW7nC.mjs +0 -818
  49. package/dist/shared/eslint.C12_M0Cw.cjs +0 -9
  50. package/dist/shared/eslint.COweQ1RR.mjs +0 -5
  51. package/dist/shared/eslint.CUi9znUC.mjs +0 -13
  52. package/dist/shared/eslint.Cg6Ty7p7.mjs +0 -2699
  53. package/dist/shared/eslint.CxAZpd0w.cjs +0 -3365
  54. package/dist/shared/eslint.DDD2xc4l.cjs +0 -25
  55. package/dist/shared/eslint.DI7QBrVD.mjs +0 -6
  56. package/dist/shared/eslint.DITpUYTO.mjs +0 -36955
  57. package/dist/shared/eslint.DP_6nQqR.cjs +0 -3822
  58. package/dist/shared/eslint.DUamuDzp.cjs +0 -7
  59. package/dist/shared/eslint.Difk5awg.mjs +0 -2139
  60. package/dist/shared/eslint.Dlgr3LGM.mjs +0 -7070
  61. package/dist/shared/eslint.DoYGbUIG.cjs +0 -2724
  62. package/dist/shared/eslint.Dprsk9zl.mjs +0 -65
  63. package/dist/shared/eslint.MfgVmFE7.cjs +0 -3054
  64. package/dist/shared/eslint.W7RM7aEw.mjs +0 -3052
  65. package/dist/shared/eslint.sHyLr4S9.cjs +0 -37003
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { d as distExports } from './shared/eslint.C6EaTeQZ.mjs';
1
+ import { d as distExports } from './shared/eslint.CohBuu1-.mjs';
2
2
  import 'eslint';
3
3
  import 'eslint/use-at-your-own-risk';
4
4
 
@@ -155,9 +155,8 @@ function getFunctionName(testName) {
155
155
  }
156
156
  function getSpecificName(testName) {
157
157
  const parts = testName.split(".");
158
- const specialIndex = parts.findIndex(
159
- (part) => part === "errors" || part === "exceptions" || part === "middlewares"
160
- );
158
+ const specialParts = /* @__PURE__ */ new Set(["errors", "exceptions", "metrics", "middlewares"]);
159
+ const specialIndex = parts.findIndex((part) => specialParts.has(part));
161
160
  if (specialIndex === -1) {
162
161
  return parts.slice(2).join(".");
163
162
  }
@@ -171,10 +170,12 @@ function getTestName(node) {
171
170
  }
172
171
  function getTestPriority(testName) {
173
172
  if (testName.includes(".middlewares.")) {
174
- return 4;
173
+ return 5;
175
174
  } else if (testName.includes(".exceptions.")) {
176
- return 3;
175
+ return 4;
177
176
  } else if (testName.includes(".errors.")) {
177
+ return 3;
178
+ } else if (testName.includes(".metrics.")) {
178
179
  return 2;
179
180
  } else {
180
181
  return 1;
@@ -183,11 +184,11 @@ function getTestPriority(testName) {
183
184
  const rule$9 = {
184
185
  meta: {
185
186
  docs: {
186
- description: "Enforce sorted test functions grouped by method with sorted errors, exceptions and middlewares",
187
+ description: "Enforce sorted test functions grouped by method with sorted metrics, errors, exceptions and middlewares",
187
188
  recommended: true
188
189
  },
189
190
  fixable: "code",
190
- messages: { sortError: "Test functions should be grouped by method with sorted errors, exceptions and middlewares." },
191
+ messages: { sortError: "Test functions should be grouped by method with sorted metrics, errors, exceptions and middlewares." },
191
192
  schema: [],
192
193
  type: "suggestion"
193
194
  },
@@ -3,39 +3,6 @@ import require$$1 from 'eslint/use-at-your-own-risk';
3
3
 
4
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5
5
 
6
- function getDefaultExportFromCjs (x) {
7
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
8
- }
9
-
10
- function getAugmentedNamespace(n) {
11
- if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
12
- var f = n.default;
13
- if (typeof f == "function") {
14
- var a = function a () {
15
- var isInstance = false;
16
- try {
17
- isInstance = this instanceof a;
18
- } catch {}
19
- if (isInstance) {
20
- return Reflect.construct(f, arguments, this.constructor);
21
- }
22
- return f.apply(this, arguments);
23
- };
24
- a.prototype = f.prototype;
25
- } else a = {};
26
- Object.defineProperty(a, '__esModule', {value: true});
27
- Object.keys(n).forEach(function (k) {
28
- var d = Object.getOwnPropertyDescriptor(n, k);
29
- Object.defineProperty(a, k, d.get ? d : {
30
- enumerable: true,
31
- get: function () {
32
- return n[k];
33
- }
34
- });
35
- });
36
- return a;
37
- }
38
-
39
6
  var dist$3 = {};
40
7
 
41
8
  var astUtils = {};
@@ -14133,4 +14100,4 @@ function requireDist () {
14133
14100
 
14134
14101
  var distExports = requireDist();
14135
14102
 
14136
- export { getDefaultExportFromCjs as a, commonjsGlobal as c, distExports as d, getAugmentedNamespace as g, requireEslintUtils$2 as r };
14103
+ export { distExports as d };
@@ -10,39 +10,6 @@ const require$$1__default = /*#__PURE__*/_interopDefaultCompat(require$$1);
10
10
 
11
11
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
12
12
 
13
- function getDefaultExportFromCjs (x) {
14
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
15
- }
16
-
17
- function getAugmentedNamespace(n) {
18
- if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
19
- var f = n.default;
20
- if (typeof f == "function") {
21
- var a = function a () {
22
- var isInstance = false;
23
- try {
24
- isInstance = this instanceof a;
25
- } catch {}
26
- if (isInstance) {
27
- return Reflect.construct(f, arguments, this.constructor);
28
- }
29
- return f.apply(this, arguments);
30
- };
31
- a.prototype = f.prototype;
32
- } else a = {};
33
- Object.defineProperty(a, '__esModule', {value: true});
34
- Object.keys(n).forEach(function (k) {
35
- var d = Object.getOwnPropertyDescriptor(n, k);
36
- Object.defineProperty(a, k, d.get ? d : {
37
- enumerable: true,
38
- get: function () {
39
- return n[k];
40
- }
41
- });
42
- });
43
- return a;
44
- }
45
-
46
13
  var dist$3 = {};
47
14
 
48
15
  var astUtils = {};
@@ -14140,8 +14107,4 @@ function requireDist () {
14140
14107
 
14141
14108
  var distExports = requireDist();
14142
14109
 
14143
- exports.commonjsGlobal = commonjsGlobal;
14144
14110
  exports.distExports = distExports;
14145
- exports.getAugmentedNamespace = getAugmentedNamespace;
14146
- exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
14147
- exports.requireEslintUtils = requireEslintUtils$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/eslint",
3
- "version": "1.0.2",
3
+ "version": "1.0.5",
4
4
  "private": false,
5
5
  "description": "Shared ESLint config and rules for SaaS Makers projects",
6
6
  "license": "MIT",
@@ -27,18 +27,16 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@antfu/eslint-config": "7.4.3",
30
- "@unocss/eslint-plugin": "66.6.0",
31
- "@vitest/eslint-plugin": "1.6.9",
30
+ "@unocss/eslint-plugin": "66.7.0",
31
+ "@vitest/eslint-plugin": "1.6.20",
32
32
  "eslint-plugin-package-json": "0.31.0",
33
- "eslint-plugin-storybook": "10.2.8",
34
- "eslint-plugin-turbo": "2.8.10",
33
+ "eslint-plugin-turbo": "2.9.17",
35
34
  "eslint-plugin-zod": "3.4.0",
36
- "typescript-eslint": "8.55.0"
35
+ "typescript-eslint": "8.61.0"
37
36
  },
38
37
  "devDependencies": {
39
38
  "@eslint/config-inspector": "1.4.2",
40
- "@nuxt/eslint-config": "1.15.2",
41
- "eslint": "10.0.1",
39
+ "eslint": "10.4.1",
42
40
  "typescript": "5.9.3"
43
41
  },
44
42
  "peerDependencies": {
@@ -1,248 +0,0 @@
1
- 'use strict';
2
-
3
- const eslint_config = require('../shared/eslint.sHyLr4S9.cjs');
4
- const eslintConfig_CUi9znUC = require('../shared/eslint.DDD2xc4l.cjs');
5
- require('node:process');
6
- require('@antfu/eslint-config');
7
- require('node:fs');
8
- require('node:path');
9
- require('node:fs/promises');
10
- require('node:url');
11
- require('node:module');
12
- require('node:assert');
13
- require('node:v8');
14
- require('node:util');
15
- require('../shared/eslint.Dxl4X46J.cjs');
16
- require('eslint');
17
- require('eslint/use-at-your-own-risk');
18
- require('@saasmakers/eslint');
19
- require('@vitest/eslint-plugin');
20
- require('eslint-plugin-package-json');
21
- require('eslint-plugin-storybook');
22
- require('eslint-plugin-turbo');
23
- require('eslint-plugin-zod');
24
-
25
- function mergePrettierOptions(options, overrides = {}) {
26
- return {
27
- ...options,
28
- ...overrides,
29
- plugins: [
30
- ...overrides.plugins || [],
31
- ...options.plugins || []
32
- ]
33
- };
34
- }
35
- async function formatters(options = {}, stylistic) {
36
- if (!options)
37
- return [];
38
- if (options === true) {
39
- const isPrettierPluginXmlInScope = eslint_config.isPackageExists("@prettier/plugin-xml");
40
- options = {
41
- css: true,
42
- graphql: true,
43
- html: true,
44
- // Markdown is disabled by default as many Nuxt projects use MDC with @nuxt/content,
45
- // where Prettier doesn't fully understand.
46
- markdown: false,
47
- svg: isPrettierPluginXmlInScope,
48
- xml: isPrettierPluginXmlInScope
49
- };
50
- }
51
- await eslint_config.ensurePackages([
52
- "eslint-plugin-format",
53
- options.xml || options.svg ? "@prettier/plugin-xml" : void 0
54
- ]);
55
- const {
56
- indent,
57
- quotes,
58
- semi
59
- } = {
60
- indent: 2,
61
- quotes: "single",
62
- semi: false,
63
- ...stylistic
64
- };
65
- const prettierOptions = Object.assign(
66
- {
67
- endOfLine: "auto",
68
- printWidth: 120,
69
- semi,
70
- singleQuote: quotes === "single",
71
- tabWidth: typeof indent === "number" ? indent : 2,
72
- trailingComma: "all",
73
- useTabs: indent === "tab"
74
- },
75
- options.prettierOptions || {}
76
- );
77
- const prettierXmlOptions = {
78
- xmlQuoteAttributes: "double",
79
- xmlSelfClosingSpace: true,
80
- xmlSortAttributesByKey: false,
81
- xmlWhitespaceSensitivity: "ignore"
82
- };
83
- const dprintOptions = Object.assign(
84
- {
85
- indentWidth: typeof indent === "number" ? indent : 2,
86
- quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
87
- useTabs: indent === "tab"
88
- },
89
- options.dprintOptions || {}
90
- );
91
- const pluginFormat = await eslint_config.interopDefault(import('eslint-plugin-format'));
92
- const configs = [
93
- {
94
- name: "nuxt/formatter/setup",
95
- plugins: {
96
- format: pluginFormat
97
- }
98
- }
99
- ];
100
- if (options.css) {
101
- configs.push(
102
- {
103
- files: [eslintConfig_CUi9znUC.GLOB_CSS, eslintConfig_CUi9znUC.GLOB_POSTCSS],
104
- languageOptions: {
105
- parser: eslint_config.parserPlain
106
- },
107
- name: "nuxt/formatter/css",
108
- rules: {
109
- "format/prettier": [
110
- "error",
111
- mergePrettierOptions(prettierOptions, {
112
- parser: "css"
113
- })
114
- ]
115
- }
116
- },
117
- {
118
- files: [eslintConfig_CUi9znUC.GLOB_SCSS],
119
- languageOptions: {
120
- parser: eslint_config.parserPlain
121
- },
122
- name: "nuxt/formatter/scss",
123
- rules: {
124
- "format/prettier": [
125
- "error",
126
- mergePrettierOptions(prettierOptions, {
127
- parser: "scss"
128
- })
129
- ]
130
- }
131
- },
132
- {
133
- files: [eslintConfig_CUi9znUC.GLOB_LESS],
134
- languageOptions: {
135
- parser: eslint_config.parserPlain
136
- },
137
- name: "nuxt/formatter/less",
138
- rules: {
139
- "format/prettier": [
140
- "error",
141
- mergePrettierOptions(prettierOptions, {
142
- parser: "less"
143
- })
144
- ]
145
- }
146
- }
147
- );
148
- }
149
- if (options.html) {
150
- configs.push({
151
- files: [eslintConfig_CUi9znUC.GLOB_HTML],
152
- languageOptions: {
153
- parser: eslint_config.parserPlain
154
- },
155
- name: "nuxt/formatter/html",
156
- rules: {
157
- "format/prettier": [
158
- "error",
159
- mergePrettierOptions(prettierOptions, {
160
- parser: "html"
161
- })
162
- ]
163
- }
164
- });
165
- }
166
- if (options.xml) {
167
- configs.push({
168
- files: [eslintConfig_CUi9znUC.GLOB_XML],
169
- languageOptions: {
170
- parser: eslint_config.parserPlain
171
- },
172
- name: "nuxt/formatter/xml",
173
- rules: {
174
- "format/prettier": [
175
- "error",
176
- mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
177
- parser: "xml",
178
- plugins: [
179
- "@prettier/plugin-xml"
180
- ]
181
- })
182
- ]
183
- }
184
- });
185
- }
186
- if (options.svg) {
187
- configs.push({
188
- files: [eslintConfig_CUi9znUC.GLOB_SVG],
189
- languageOptions: {
190
- parser: eslint_config.parserPlain
191
- },
192
- name: "nuxt/formatter/svg",
193
- rules: {
194
- "format/prettier": [
195
- "error",
196
- mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
197
- parser: "xml",
198
- plugins: [
199
- "@prettier/plugin-xml"
200
- ]
201
- })
202
- ]
203
- }
204
- });
205
- }
206
- if (options.markdown) {
207
- const formater = options.markdown === true ? "prettier" : options.markdown;
208
- configs.push({
209
- files: [eslintConfig_CUi9znUC.GLOB_MARKDOWN],
210
- languageOptions: {
211
- parser: eslint_config.parserPlain
212
- },
213
- name: "nuxt/formatter/markdown",
214
- rules: {
215
- [`format/${formater}`]: [
216
- "error",
217
- formater === "prettier" ? mergePrettierOptions(prettierOptions, {
218
- embeddedLanguageFormatting: "off",
219
- parser: "markdown"
220
- }) : {
221
- ...dprintOptions,
222
- language: "markdown"
223
- }
224
- ]
225
- }
226
- });
227
- }
228
- if (options.graphql) {
229
- configs.push({
230
- files: [eslintConfig_CUi9znUC.GLOB_GRAPHQL],
231
- languageOptions: {
232
- parser: eslint_config.parserPlain
233
- },
234
- name: "nuxt/formatter/graphql",
235
- rules: {
236
- "format/prettier": [
237
- "error",
238
- mergePrettierOptions(prettierOptions, {
239
- parser: "graphql"
240
- })
241
- ]
242
- }
243
- });
244
- }
245
- return configs;
246
- }
247
-
248
- exports.formatters = formatters;
@@ -1,246 +0,0 @@
1
- import { j as isPackageExists, k as ensurePackages, l as interopDefault, p as parserPlain } from '../shared/eslint.DITpUYTO.mjs';
2
- import { b as GLOB_CSS, c as GLOB_POSTCSS, d as GLOB_SCSS, e as GLOB_LESS, f as GLOB_HTML, g as GLOB_XML, h as GLOB_SVG, i as GLOB_MARKDOWN, j as GLOB_GRAPHQL } from '../shared/eslint.CUi9znUC.mjs';
3
- import 'node:process';
4
- import '@antfu/eslint-config';
5
- import 'node:fs';
6
- import 'node:path';
7
- import 'node:fs/promises';
8
- import 'node:url';
9
- import 'node:module';
10
- import 'node:assert';
11
- import 'node:v8';
12
- import 'node:util';
13
- import '../shared/eslint.C6EaTeQZ.mjs';
14
- import 'eslint';
15
- import 'eslint/use-at-your-own-risk';
16
- import '@saasmakers/eslint';
17
- import '@vitest/eslint-plugin';
18
- import 'eslint-plugin-package-json';
19
- import 'eslint-plugin-storybook';
20
- import 'eslint-plugin-turbo';
21
- import 'eslint-plugin-zod';
22
-
23
- function mergePrettierOptions(options, overrides = {}) {
24
- return {
25
- ...options,
26
- ...overrides,
27
- plugins: [
28
- ...overrides.plugins || [],
29
- ...options.plugins || []
30
- ]
31
- };
32
- }
33
- async function formatters(options = {}, stylistic) {
34
- if (!options)
35
- return [];
36
- if (options === true) {
37
- const isPrettierPluginXmlInScope = isPackageExists("@prettier/plugin-xml");
38
- options = {
39
- css: true,
40
- graphql: true,
41
- html: true,
42
- // Markdown is disabled by default as many Nuxt projects use MDC with @nuxt/content,
43
- // where Prettier doesn't fully understand.
44
- markdown: false,
45
- svg: isPrettierPluginXmlInScope,
46
- xml: isPrettierPluginXmlInScope
47
- };
48
- }
49
- await ensurePackages([
50
- "eslint-plugin-format",
51
- options.xml || options.svg ? "@prettier/plugin-xml" : void 0
52
- ]);
53
- const {
54
- indent,
55
- quotes,
56
- semi
57
- } = {
58
- indent: 2,
59
- quotes: "single",
60
- semi: false,
61
- ...stylistic
62
- };
63
- const prettierOptions = Object.assign(
64
- {
65
- endOfLine: "auto",
66
- printWidth: 120,
67
- semi,
68
- singleQuote: quotes === "single",
69
- tabWidth: typeof indent === "number" ? indent : 2,
70
- trailingComma: "all",
71
- useTabs: indent === "tab"
72
- },
73
- options.prettierOptions || {}
74
- );
75
- const prettierXmlOptions = {
76
- xmlQuoteAttributes: "double",
77
- xmlSelfClosingSpace: true,
78
- xmlSortAttributesByKey: false,
79
- xmlWhitespaceSensitivity: "ignore"
80
- };
81
- const dprintOptions = Object.assign(
82
- {
83
- indentWidth: typeof indent === "number" ? indent : 2,
84
- quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
85
- useTabs: indent === "tab"
86
- },
87
- options.dprintOptions || {}
88
- );
89
- const pluginFormat = await interopDefault(import('eslint-plugin-format'));
90
- const configs = [
91
- {
92
- name: "nuxt/formatter/setup",
93
- plugins: {
94
- format: pluginFormat
95
- }
96
- }
97
- ];
98
- if (options.css) {
99
- configs.push(
100
- {
101
- files: [GLOB_CSS, GLOB_POSTCSS],
102
- languageOptions: {
103
- parser: parserPlain
104
- },
105
- name: "nuxt/formatter/css",
106
- rules: {
107
- "format/prettier": [
108
- "error",
109
- mergePrettierOptions(prettierOptions, {
110
- parser: "css"
111
- })
112
- ]
113
- }
114
- },
115
- {
116
- files: [GLOB_SCSS],
117
- languageOptions: {
118
- parser: parserPlain
119
- },
120
- name: "nuxt/formatter/scss",
121
- rules: {
122
- "format/prettier": [
123
- "error",
124
- mergePrettierOptions(prettierOptions, {
125
- parser: "scss"
126
- })
127
- ]
128
- }
129
- },
130
- {
131
- files: [GLOB_LESS],
132
- languageOptions: {
133
- parser: parserPlain
134
- },
135
- name: "nuxt/formatter/less",
136
- rules: {
137
- "format/prettier": [
138
- "error",
139
- mergePrettierOptions(prettierOptions, {
140
- parser: "less"
141
- })
142
- ]
143
- }
144
- }
145
- );
146
- }
147
- if (options.html) {
148
- configs.push({
149
- files: [GLOB_HTML],
150
- languageOptions: {
151
- parser: parserPlain
152
- },
153
- name: "nuxt/formatter/html",
154
- rules: {
155
- "format/prettier": [
156
- "error",
157
- mergePrettierOptions(prettierOptions, {
158
- parser: "html"
159
- })
160
- ]
161
- }
162
- });
163
- }
164
- if (options.xml) {
165
- configs.push({
166
- files: [GLOB_XML],
167
- languageOptions: {
168
- parser: parserPlain
169
- },
170
- name: "nuxt/formatter/xml",
171
- rules: {
172
- "format/prettier": [
173
- "error",
174
- mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
175
- parser: "xml",
176
- plugins: [
177
- "@prettier/plugin-xml"
178
- ]
179
- })
180
- ]
181
- }
182
- });
183
- }
184
- if (options.svg) {
185
- configs.push({
186
- files: [GLOB_SVG],
187
- languageOptions: {
188
- parser: parserPlain
189
- },
190
- name: "nuxt/formatter/svg",
191
- rules: {
192
- "format/prettier": [
193
- "error",
194
- mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
195
- parser: "xml",
196
- plugins: [
197
- "@prettier/plugin-xml"
198
- ]
199
- })
200
- ]
201
- }
202
- });
203
- }
204
- if (options.markdown) {
205
- const formater = options.markdown === true ? "prettier" : options.markdown;
206
- configs.push({
207
- files: [GLOB_MARKDOWN],
208
- languageOptions: {
209
- parser: parserPlain
210
- },
211
- name: "nuxt/formatter/markdown",
212
- rules: {
213
- [`format/${formater}`]: [
214
- "error",
215
- formater === "prettier" ? mergePrettierOptions(prettierOptions, {
216
- embeddedLanguageFormatting: "off",
217
- parser: "markdown"
218
- }) : {
219
- ...dprintOptions,
220
- language: "markdown"
221
- }
222
- ]
223
- }
224
- });
225
- }
226
- if (options.graphql) {
227
- configs.push({
228
- files: [GLOB_GRAPHQL],
229
- languageOptions: {
230
- parser: parserPlain
231
- },
232
- name: "nuxt/formatter/graphql",
233
- rules: {
234
- "format/prettier": [
235
- "error",
236
- mergePrettierOptions(prettierOptions, {
237
- parser: "graphql"
238
- })
239
- ]
240
- }
241
- });
242
- }
243
- return configs;
244
- }
245
-
246
- export { formatters };