@lntvow/eslint-config 9.3.2 → 9.3.6

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/dist/index.cjs CHANGED
@@ -1 +1,1017 @@
1
- "use strict";var le=Object.create;var x=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var de=(e,o)=>{for(var r in o)x(e,r,{get:o[r],enumerable:!0})},V=(e,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of ce(o))!ve.call(e,t)&&t!==r&&x(e,t,{get:()=>o[t],enumerable:!(n=ue(o,t))||n.enumerable});return e};var i=(e,o,r)=>(r=e!=null?le(me(e)):{},V(o||!e||!e.__esModule?x(r,"default",{value:e,enumerable:!0}):r,e)),ge=e=>V(x({},"__esModule",{value:!0}),e);var Re={};de(Re,{GLOB_ALL_SRC:()=>Be,GLOB_ASTRO:()=>je,GLOB_CSS:()=>we,GLOB_EXCLUDE:()=>j,GLOB_GRAPHQL:()=>Ge,GLOB_HTML:()=>Q,GLOB_JS:()=>ye,GLOB_JSON:()=>J,GLOB_JSON5:()=>W,GLOB_JSONC:()=>Le,GLOB_JSX:()=>xe,GLOB_LESS:()=>_e,GLOB_MARKDOWN:()=>S,GLOB_MARKDOWN_CODE:()=>Fe,GLOB_MARKDOWN_IN_MARKDOWN:()=>Te,GLOB_POSTCSS:()=>he,GLOB_SCSS:()=>Ce,GLOB_SRC:()=>l,GLOB_SRC_EXT:()=>u,GLOB_STYLE:()=>X,GLOB_SVELTE:()=>H,GLOB_TESTS:()=>ke,GLOB_TOML:()=>Se,GLOB_TS:()=>Oe,GLOB_TSX:()=>be,GLOB_VUE:()=>O,GLOB_XML:()=>Y,GLOB_YAML:()=>z,StylisticConfigDefaults:()=>te,default:()=>Ee,getVueVersion:()=>pe,gitignore:()=>T,ignores:()=>G,imports:()=>F,javascript:()=>k,lntvow:()=>_,prettier:()=>B,regexp:()=>P,renameRules:()=>w,stylistic:()=>R,typescript:()=>q,vue:()=>A});module.exports=ge(Re);var fe=require("eslint-flat-config-utils"),ae=require("@lntvow/utils"),U=require("local-pkg");var D=i(require("fs"),1),$=require("find-up"),M=require("@lntvow/utils"),K=i(require("parse-gitignore"),1);async function T(e){let{name:o=".gitignore",root:r=!1,files:n=r?o:(0,$.findUpSync)(o)||[]}=e,t=(0,M.castArray)(n),f=[];for(let m of t)try{let v=D.default.readFileSync(m,"utf8"),C=(0,K.default)(v).globs();for(let s of C)s.type==="ignore"?f.push(...s.patterns):s.type==="unignore"&&f.push(...s.patterns.map(g=>`!${g}`))}catch{throw new Error(`Failed to read file: ${m}`)}return[{ignores:f}]}var u="?([cm])[jt]s?(x)",l="**/*.?([cm])[jt]s?(x)",ye="**/*.?([cm])js",xe="**/*.?([cm])jsx",Oe="**/*.?([cm])ts",be="**/*.?([cm])tsx",X="**/*.{c,le,sc}ss",we="**/*.css",he="**/*.{p,post}css",_e="**/*.less",Ce="**/*.scss",J="**/*.json",W="**/*.json5",Le="**/*.jsonc",S="**/*.md",Te="**/*.md/*.md",H="**/*.svelte",O="**/*.vue",z="**/*.y?(a)ml",Se="**/*.toml",Y="**/*.xml",Q="**/*.htm?(l)",je="**/*.astro",Ge="**/*.{g,graph}ql",Fe=`${S}/${l}`,ke=[`**/__tests__/**/*.${u}`,`**/*.spec.${u}`,`**/*.test.${u}`,`**/*.bench.${u}`,`**/*.benchmark.${u}`],Be=[l,X,J,W,S,H,O,z,Y,Q],j=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];async function G(){return[{ignores:[...j]}]}var Z=i(require("eslint-plugin-import-x"),1);async function F(){return[{name:"lntvow/imports/rules",plugins:{import:Z.default},rules:{"import/order":"error","import/newline-after-import":"error"}}]}var ee=i(require("@eslint/js"),1),b=i(require("globals"),1);async function k(e={}){let{overrides:o={}}=e;return[{name:"lntvow/javascript/rules",languageOptions:{ecmaVersion:2022,sourceType:"module",parserOptions:{ecmaVersion:2022,sourceType:"module",ecmaFeatures:{jsx:!0}},globals:{...b.default.browser,...b.default.es2021,...b.default.node,document:"readonly",navigator:"readonly",window:"readonly"}},linterOptions:{reportUnusedDisableDirectives:!0},rules:{...ee.default.configs.all.rules,"no-unused-vars":"warn","no-use-before-define":["error",{functions:!1}],"no-useless-assignment":"off","require-atomic-updates":"off",camelcase:"warn","capitalized-comments":"off","class-methods-use-this":"off",complexity:"off",curly:["error","multi-line"],"func-names":"off","func-style":"off","guard-for-in":"off","id-denylist":"off","id-length":"off","id-match":"off","init-declarations":"off","max-classes-per-file":"off","max-depth":"off","max-lines":"off","max-lines-per-function":"off","max-nested-callbacks":"off","max-params":"off","max-statements":"off","new-cap":["error",{capIsNew:!1}],"no-bitwise":"off","no-case-declarations":"off","no-console":"warn","no-continue":"off","no-empty":["error",{allowEmptyCatch:!0}],"no-implicit-coercion":"off","no-implicit-globals":"off","no-magic-numbers":0,"no-nested-ternary":"off","no-new":"off","no-param-reassign":"off","no-plusplus":"off","no-restricted-exports":"off","no-restricted-globals":["error",{message:"Use `globalThis` instead.",name:"global"},{message:"Use `globalThis` instead.",name:"self"}],"no-restricted-imports":"off","no-restricted-properties":["error",{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:"__proto__"},{message:"Use `Object.defineProperty` instead.",property:"__defineGetter__"},{message:"Use `Object.defineProperty` instead.",property:"__defineSetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupGetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupSetter__"}],"no-restricted-syntax":"off","no-shadow":"off","no-ternary":"off","no-throw-literal":"off","no-undefined":"off","no-underscore-dangle":"off","no-void":"off","no-warning-comments":"off","one-var":"off","prefer-exponentiation-operator":"off","prefer-promise-reject-errors":"off",radix:"off","require-await":"off","require-unicode-regexp":"off","sort-imports":"off","sort-keys":"off","sort-vars":"off",strict:"off",...o}},{files:[`scripts/${l}`],name:"lntvow/javascript/disables",rules:{"no-console":"off"}}]}var oe=i(require("eslint-plugin-prettier"),1),re=i(require("eslint-config-prettier"),1);async function B(){return[{name:"lntvow/prettier/rules",plugins:{prettier:oe.default},rules:{...re.default.rules,"prettier/prettier":"warn"}}]}var I=require("eslint-plugin-regexp");async function P(e={}){let{overrides:o}=e,r=I.configs["flat/recommended"].plugins.regexp,{rules:n}=I.configs["flat/recommended"];return[{name:"lntvow/regexp/rules",plugins:{regexp:r},rules:{...n,...o}}]}var E=i(require("@stylistic/eslint-plugin"),1),te={indent:2,jsx:!0,quotes:"single",semi:!1};async function R(e={}){let{indent:o,jsx:r,overrides:n={},quotes:t,semi:f}={...te,...e},m=E.default.configs.customize({flat:!0,indent:o,jsx:r,pluginName:"style",quotes:t,semi:f});return[{name:"lntvow/stylistic/rules",plugins:{style:E.default},rules:{"style/spaced-comment":"error","style/padding-line-between-statements":["error",{blankLine:"always",prev:"*",next:"cjs-export"},{blankLine:"always",prev:"*",next:"export"},{blankLine:"always",prev:"*",next:"function"}],...n}}]}var h=i(require("@typescript-eslint/eslint-plugin"),1),ne=i(require("@typescript-eslint/parser"),1);function w(e,o){return Object.fromEntries(Object.entries(e).map(([r,n])=>{for(let[t,f]of Object.entries(o))if(r.startsWith(`${t}/`))return[f+r.slice(t.length),n];return[r,n]}))}async function q(e={}){let{componentExts:o=[],overrides:r={},parserOptions:n={}}=e,t=[l,...o.map(f=>`**/*.${f}`)];return[{name:"lntvow/typescript/rules",plugins:{ts:h.default},languageOptions:{parser:ne.default,parserOptions:{sourceType:"module"}},files:t,rules:{...w(h.default.configs["eslint-recommended"].overrides[0].rules,{"@typescript-eslint":"typescript"}),...w(h.default.configs.strict.rules,{"@typescript-eslint":"typescript"}),"ts/no-non-null-assertion":"off","ts/no-explicit-any":"off","ts/ban-ts-comment":"off","ts/no-unused-vars":"warn","no-use-before-define":"off","ts/no-use-before-define":["error",{functions:!1}],...r}}]}var se=require("local-pkg"),N=i(require("@typescript-eslint/parser"),1),ie=i(require("vue-eslint-parser"),1),a=i(require("eslint-plugin-vue"),1);async function A(e={}){let{overrides:o={},vueVersion:r=pe()}=e,n={...a.default.configs["vue3-essential"].rules,...a.default.configs["vue3-strongly-recommended"].rules,...a.default.configs["vue3-recommended"].rules,"vue/block-lang":["error",{script:{lang:["ts","tsx"]}}],"vue/block-order":["error",{order:["script[setup]","template","style[scoped]"]}],"vue/component-api-style":"error"},t={...a.default.configs.essential.rules,...a.default.configs["strongly-recommended"].rules,...a.default.configs.recommended.rules,"vue/block-lang":["error",{script:{allowNoLang:!0}}],"vue/block-order":["error",{order:[["script","template"],"style[scoped]"]}]};return[{name:"lntvow/vue/rules",plugins:{vue:a.default},languageOptions:{parser:ie.default,parserOptions:{ecmaFeatures:{jsx:!0},parser:{ts:N.default,tsx:N.default},sourceType:"module"}},processor:a.default.processors[".vue"],files:[O],rules:{...a.default.configs.base.rules,...r===3?n:t,"vue/multi-word-component-names":"off","vue/attribute-hyphenation":["error","never"],"vue/html-indent":"off","vue/html-self-closing":["error",{html:{void:"always",normal:"always",component:"always"},svg:"always",math:"always"}],"vue/max-attributes-per-line":"off","vue/singleline-html-element-content-newline":"off","vue/v-on-event-hyphenation":["error","never"],"vue/block-tag-newline":"error","vue/component-name-in-template-casing":["error","PascalCase",{ignores:["/-/"]}],"vue/component-options-name-casing":"error","vue/custom-event-name-casing":"error","vue/define-emits-declaration":"error","vue/define-macros-order":"error","vue/define-props-declaration":"error","vue/enforce-style-attribute":"error","vue/html-button-has-type":"off","vue/html-comment-content-newline":"error","vue/html-comment-content-spacing":"error","vue/html-comment-indent":"off","vue/match-component-file-name":["error",{extensions:["jsx","tsx"],shouldMatchCase:!0}],"vue/match-component-import-name":"error","vue/max-lines-per-block":"off","vue/new-line-between-multi-line-property":"off","vue/next-tick-style":"off","vue/no-bare-strings-in-template":"off","vue/no-boolean-default":"off","vue/no-deprecated-model-definition":"error","vue/no-duplicate-attr-inheritance":"error","vue/no-empty-component-block":"off","vue/no-multiple-objects-in-class":"error","vue/no-potential-component-option-typo":"error","vue/no-ref-object-reactivity-loss":"error","vue/no-required-prop-with-default":"error","vue/no-restricted-block":"off","vue/no-restricted-call-after-await":"off","vue/no-restricted-class":"off","vue/no-restricted-component-names":"off","vue/no-restricted-component-options":"off","vue/no-restricted-custom-event":"off","vue/no-restricted-html-elements":"off","vue/no-restricted-props":"off","vue/no-restricted-static-attribute":"off","vue/no-restricted-v-bind":"off","vue/no-root-v-if":"off","vue/no-setup-props-reactivity-loss":"error","vue/no-static-inline-styles":"error","vue/no-template-target-blank":"error","vue/no-this-in-before-route-enter":"error","vue/no-undef-components":"off","vue/no-undef-properties":"error","vue/no-unsupported-features":"off","vue/no-unused-emit-declarations":"error","vue/no-unused-properties":["warn",{groups:["props","data","computed","methods","setup"]}],"vue/no-unused-refs":"error","vue/no-use-v-else-with-v-for":"error","vue/no-useless-mustaches":"error","vue/no-useless-v-bind":"error","vue/no-v-text":"error","vue/padding-line-between-blocks":"error","vue/padding-line-between-tags":["error",[{blankLine:"never",prev:"*",next:"*"}]],"vue/padding-lines-in-component-definition":["error",{betweenOptions:"never"}],"vue/prefer-define-options":"error","vue/prefer-prop-type-boolean-first":"error","vue/prefer-separate-static-class":"error","vue/prefer-true-attribute-shorthand":"error","vue/require-direct-export":"error","vue/require-emit-validator":"off","vue/require-explicit-slots":"error","vue/require-expose":"error","vue/require-macro-variable-name":"error","vue/require-name-property":"off","vue/require-prop-comment":"off","vue/require-typed-object-prop":"error","vue/require-typed-ref":"error","vue/script-indent":"off","vue/sort-keys":"off","vue/static-class-names-order":"error","vue/v-for-delimiter-style":"error","vue/v-on-handler-style":"off","vue/valid-define-options":"error","vue/array-bracket-newline":"off","vue/array-bracket-spacing":"off","vue/array-element-newline":"off","vue/arrow-spacing":"off","vue/block-spacing":"off","vue/brace-style":"off","vue/camelcase":"error","vue/comma-dangle":"off","vue/comma-spacing":"off","vue/comma-style":"off","vue/dot-location":"off","vue/dot-notation":"error","vue/eqeqeq":"error","vue/func-call-spacing":"off","vue/key-spacing":"off","vue/keyword-spacing":"off","vue/max-len":"off","vue/multiline-ternary":"off","vue/no-console":"off","vue/no-constant-condition":"error","vue/no-extra-parens":"off","vue/no-empty-pattern":"error","vue/no-irregular-whitespace":"error","vue/no-loss-of-precision":"off","vue/no-restricted-syntax":"off","vue/no-sparse-arrays":"error","vue/no-useless-concat":"error","vue/object-curly-newline":"off","vue/object-curly-spacing":"off","vue/object-property-newline":"off","vue/object-shorthand":"error","vue/operator-linebreak":"off","vue/prefer-template":"error","vue/quote-props":"off","vue/space-in-parens":"off","vue/space-infix-ops":"off","vue/space-unary-ops":"off","vue/template-curly-spacing":"off",...o}}]}function pe(){let e=(0,se.getPackageInfoSync)("vue",{paths:[process.cwd()]});return e&&e.version?+e.version[0]:3}var Ie=["name","files","ignores","languageOptions","linterOptions","processor","plugins","rules","settings"],Pe={"@stylistic":"style","@typescript-eslint":"typescript","import-x":"import"};function _(e={},...o){let{autoRenamePlugins:r=!0,componentExts:n=[],gitignore:t=!0,regexp:f=!0,typescript:m=(0,U.isPackageExists)("typescript"),vue:v=["vue","nuxt","vitepress"].some(y=>(0,U.isPackageExists)(y)),stylistic:C=!0}=e,s=[];s.push(G(),k({...c(e,"javascript")}),F()),t&&s.push(T({...c(e,"gitignore")})),v&&n.push("vue"),m&&s.push(q({...c(e,"typescript"),componentExts:n})),v&&s.push(A({...c(e,"vue")})),f&&s.push(P({...c(e,"regexp")})),C&&s.push(R({...c(e,"stylistic")}));let g=Ie.reduce((y,L)=>(L in e&&(y[L]=e[L]),y),{});Object.keys(g).length&&s.push([g]),s.push(B());let d=new fe.FlatConfigComposer;return d=d.append(...s,...o),r&&(d=d.renamePlugins(Pe)),d}function c(e,o){return(0,ae.isBoolean)(e[o])?{}:e[o]||{}}var Ee=_;0&&(module.exports={GLOB_ALL_SRC,GLOB_ASTRO,GLOB_CSS,GLOB_EXCLUDE,GLOB_GRAPHQL,GLOB_HTML,GLOB_JS,GLOB_JSON,GLOB_JSON5,GLOB_JSONC,GLOB_JSX,GLOB_LESS,GLOB_MARKDOWN,GLOB_MARKDOWN_CODE,GLOB_MARKDOWN_IN_MARKDOWN,GLOB_POSTCSS,GLOB_SCSS,GLOB_SRC,GLOB_SRC_EXT,GLOB_STYLE,GLOB_SVELTE,GLOB_TESTS,GLOB_TOML,GLOB_TS,GLOB_TSX,GLOB_VUE,GLOB_XML,GLOB_YAML,StylisticConfigDefaults,getVueVersion,gitignore,ignores,imports,javascript,lntvow,prettier,regexp,renameRules,stylistic,typescript,vue});
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/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ GLOB_ALL_SRC: () => GLOB_ALL_SRC,
34
+ GLOB_ASTRO: () => GLOB_ASTRO,
35
+ GLOB_CSS: () => GLOB_CSS,
36
+ GLOB_EXCLUDE: () => GLOB_EXCLUDE,
37
+ GLOB_GRAPHQL: () => GLOB_GRAPHQL,
38
+ GLOB_HTML: () => GLOB_HTML,
39
+ GLOB_JS: () => GLOB_JS,
40
+ GLOB_JSON: () => GLOB_JSON,
41
+ GLOB_JSON5: () => GLOB_JSON5,
42
+ GLOB_JSONC: () => GLOB_JSONC,
43
+ GLOB_JSX: () => GLOB_JSX,
44
+ GLOB_LESS: () => GLOB_LESS,
45
+ GLOB_MARKDOWN: () => GLOB_MARKDOWN,
46
+ GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
47
+ GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
48
+ GLOB_POSTCSS: () => GLOB_POSTCSS,
49
+ GLOB_SCSS: () => GLOB_SCSS,
50
+ GLOB_SRC: () => GLOB_SRC,
51
+ GLOB_SRC_EXT: () => GLOB_SRC_EXT,
52
+ GLOB_STYLE: () => GLOB_STYLE,
53
+ GLOB_SVELTE: () => GLOB_SVELTE,
54
+ GLOB_TESTS: () => GLOB_TESTS,
55
+ GLOB_TOML: () => GLOB_TOML,
56
+ GLOB_TS: () => GLOB_TS,
57
+ GLOB_TSX: () => GLOB_TSX,
58
+ GLOB_VUE: () => GLOB_VUE,
59
+ GLOB_XML: () => GLOB_XML,
60
+ GLOB_YAML: () => GLOB_YAML,
61
+ StylisticConfigDefaults: () => StylisticConfigDefaults,
62
+ custom: () => custom,
63
+ default: () => src_default,
64
+ getVueVersion: () => getVueVersion,
65
+ gitignore: () => gitignore,
66
+ ignores: () => ignores,
67
+ imports: () => imports,
68
+ javascript: () => javascript,
69
+ lntvow: () => lntvow,
70
+ prettier: () => prettier,
71
+ regexp: () => regexp,
72
+ renameRules: () => renameRules,
73
+ stylistic: () => stylistic,
74
+ test: () => test,
75
+ typescript: () => typescript,
76
+ vue: () => vue
77
+ });
78
+ module.exports = __toCommonJS(src_exports);
79
+
80
+ // src/factory.ts
81
+ var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
82
+ var import_utils3 = require("@lntvow/utils");
83
+ var import_local_pkg2 = require("local-pkg");
84
+
85
+ // src/configs/custom.ts
86
+ var import_eslint_plugin = __toESM(require("@lntvow/eslint-plugin"), 1);
87
+
88
+ // src/globs.ts
89
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
90
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
91
+ var GLOB_JS = "**/*.?([cm])js";
92
+ var GLOB_JSX = "**/*.?([cm])jsx";
93
+ var GLOB_TS = "**/*.?([cm])ts";
94
+ var GLOB_TSX = "**/*.?([cm])tsx";
95
+ var GLOB_STYLE = "**/*.{c,le,sc}ss";
96
+ var GLOB_CSS = "**/*.css";
97
+ var GLOB_POSTCSS = "**/*.{p,post}css";
98
+ var GLOB_LESS = "**/*.less";
99
+ var GLOB_SCSS = "**/*.scss";
100
+ var GLOB_JSON = "**/*.json";
101
+ var GLOB_JSON5 = "**/*.json5";
102
+ var GLOB_JSONC = "**/*.jsonc";
103
+ var GLOB_MARKDOWN = "**/*.md";
104
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
105
+ var GLOB_SVELTE = "**/*.svelte";
106
+ var GLOB_VUE = "**/*.vue";
107
+ var GLOB_YAML = "**/*.y?(a)ml";
108
+ var GLOB_TOML = "**/*.toml";
109
+ var GLOB_XML = "**/*.xml";
110
+ var GLOB_HTML = "**/*.htm?(l)";
111
+ var GLOB_ASTRO = "**/*.astro";
112
+ var GLOB_GRAPHQL = "**/*.{g,graph}ql";
113
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
114
+ var GLOB_TESTS = [
115
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
116
+ `**/*.spec.${GLOB_SRC_EXT}`,
117
+ `**/*.test.${GLOB_SRC_EXT}`,
118
+ `**/*.bench.${GLOB_SRC_EXT}`,
119
+ `**/*.benchmark.${GLOB_SRC_EXT}`
120
+ ];
121
+ var GLOB_ALL_SRC = [
122
+ GLOB_SRC,
123
+ GLOB_STYLE,
124
+ GLOB_JSON,
125
+ GLOB_JSON5,
126
+ GLOB_MARKDOWN,
127
+ GLOB_SVELTE,
128
+ GLOB_VUE,
129
+ GLOB_YAML,
130
+ GLOB_XML,
131
+ GLOB_HTML
132
+ ];
133
+ var GLOB_EXCLUDE = [
134
+ "**/node_modules",
135
+ "**/dist",
136
+ "**/package-lock.json",
137
+ "**/yarn.lock",
138
+ "**/pnpm-lock.yaml",
139
+ "**/bun.lockb",
140
+ "**/output",
141
+ "**/coverage",
142
+ "**/temp",
143
+ "**/.temp",
144
+ "**/tmp",
145
+ "**/.tmp",
146
+ "**/.history",
147
+ "**/.vitepress/cache",
148
+ "**/.nuxt",
149
+ "**/.next",
150
+ "**/.vercel",
151
+ "**/.changeset",
152
+ "**/.idea",
153
+ "**/.cache",
154
+ "**/.output",
155
+ "**/.vite-inspect",
156
+ "**/.yarn",
157
+ "**/CHANGELOG*.md",
158
+ "**/*.min.*",
159
+ "**/LICENSE*",
160
+ "**/__snapshots__",
161
+ "**/auto-import?(s).d.ts",
162
+ "**/components.d.ts"
163
+ ];
164
+
165
+ // src/configs/custom.ts
166
+ async function custom() {
167
+ return [
168
+ {
169
+ name: "lntvow/custom",
170
+ plugins: {
171
+ lntvow: import_eslint_plugin.default
172
+ }
173
+ },
174
+ {
175
+ name: "lntvow/custom/test/rules",
176
+ files: [GLOB_TESTS],
177
+ rules: {
178
+ "lntvow/newline-before": "error"
179
+ }
180
+ }
181
+ ];
182
+ }
183
+
184
+ // src/configs/gitignore.ts
185
+ var import_fs = __toESM(require("fs"), 1);
186
+ var import_find_up = require("find-up");
187
+ var import_utils = require("@lntvow/utils");
188
+ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
189
+ async function gitignore(options) {
190
+ const { name = ".gitignore", root = false, files: _files = root ? name : (0, import_find_up.findUpSync)(name) || [] } = options;
191
+ const files = (0, import_utils.castArray)(_files);
192
+ const ignores2 = [];
193
+ for (const file of files) {
194
+ try {
195
+ const content = import_fs.default.readFileSync(file, "utf8");
196
+ const globs = (0, import_parse_gitignore.default)(content).globs();
197
+ for (const glob of globs) {
198
+ if (glob.type === "ignore") {
199
+ ignores2.push(...glob.patterns);
200
+ } else if (glob.type === "unignore") {
201
+ ignores2.push(...glob.patterns.map((pattern) => `!${pattern}`));
202
+ }
203
+ }
204
+ } catch (error) {
205
+ throw new Error(`Failed to read file: ${file}`);
206
+ }
207
+ }
208
+ return [
209
+ {
210
+ ignores: ignores2
211
+ }
212
+ ];
213
+ }
214
+
215
+ // src/configs/ignores.ts
216
+ async function ignores() {
217
+ return [
218
+ {
219
+ ignores: [...GLOB_EXCLUDE]
220
+ }
221
+ ];
222
+ }
223
+
224
+ // src/configs/imports.ts
225
+ var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
226
+ async function imports() {
227
+ return [
228
+ {
229
+ name: "lntvow/imports/rules",
230
+ plugins: {
231
+ import: import_eslint_plugin_import_x.default
232
+ },
233
+ rules: {
234
+ "import/order": "error",
235
+ "import/newline-after-import": "error"
236
+ }
237
+ }
238
+ ];
239
+ }
240
+
241
+ // src/configs/javascript.ts
242
+ var import_js = __toESM(require("@eslint/js"), 1);
243
+ var import_globals = __toESM(require("globals"), 1);
244
+ async function javascript(options = {}) {
245
+ const { overrides = {} } = options;
246
+ return [
247
+ {
248
+ name: "lntvow/javascript/rules",
249
+ languageOptions: {
250
+ ecmaVersion: 2022,
251
+ sourceType: "module",
252
+ parserOptions: {
253
+ ecmaVersion: 2022,
254
+ sourceType: "module",
255
+ ecmaFeatures: {
256
+ jsx: true
257
+ }
258
+ },
259
+ globals: {
260
+ ...import_globals.default.browser,
261
+ ...import_globals.default.es2021,
262
+ ...import_globals.default.node,
263
+ document: "readonly",
264
+ navigator: "readonly",
265
+ window: "readonly"
266
+ }
267
+ },
268
+ linterOptions: {
269
+ reportUnusedDisableDirectives: true
270
+ },
271
+ rules: {
272
+ // Update to eslint-plugin-vue v9.3.0
273
+ ...import_js.default.configs.all.rules,
274
+ // 禁止未使用过的变量
275
+ "no-unused-vars": "warn",
276
+ // 禁止定义前使用
277
+ "no-use-before-define": ["error", { functions: false }],
278
+ // 禁止无用的分配 有时候需要置空变量时候需要用到
279
+ "no-useless-assignment": "off",
280
+ // 禁止使用 await 或 yield 导致竞争条件的分配
281
+ "require-atomic-updates": "off",
282
+ // 强制使用骆驼拼写法命名约定
283
+ "camelcase": "warn",
284
+ // 强制注释首字母大写或小写
285
+ "capitalized-comments": "off",
286
+ // 强制类方法使用this
287
+ "class-methods-use-this": "off",
288
+ // 指定程序中允许的最大环路复杂度
289
+ "complexity": "off",
290
+ // 强制保证多行所有的花括号,
291
+ "curly": ["error", "multi-line"],
292
+ // 要求使用命名的 function 表达式 便于调试
293
+ "func-names": "off",
294
+ // 强制一致地使用 function 声明或表达式
295
+ "func-style": "off",
296
+ // 要求 for-in 循环中有一个 if 语句
297
+ "guard-for-in": "off",
298
+ // 禁用指定的标识符
299
+ "id-denylist": "off",
300
+ // 强制标识符的最小和最大长度
301
+ "id-length": "off",
302
+ // 禁止使用指定的标识符
303
+ "id-match": "off",
304
+ // 要求变量声明并同时初始化
305
+ "init-declarations": "off",
306
+ // 强制每个文件中包含的的类的最大数量
307
+ "max-classes-per-file": "off",
308
+ // 强制可嵌套的块的最大深度
309
+ "max-depth": "off",
310
+ // 强制最大行数
311
+ "max-lines": "off",
312
+ // 强制函数最大行数
313
+ "max-lines-per-function": "off",
314
+ // 强制回调函数最大嵌套深度
315
+ "max-nested-callbacks": "off",
316
+ // 强制函数定义中最多允许的参数数量
317
+ "max-params": "off",
318
+ // 强制函数块最多允许的的语句数量
319
+ "max-statements": "off",
320
+ // 要求构造函数首字母大写
321
+ "new-cap": ["error", { capIsNew: false }],
322
+ // 禁止使用按位操作符
323
+ "no-bitwise": "off",
324
+ // 禁止在 case 或 default 子句中出现词法声明
325
+ "no-case-declarations": "off",
326
+ // 禁止使用 console
327
+ "no-console": "warn",
328
+ // 禁用 continue 语句
329
+ "no-continue": "off",
330
+ // 禁止空块语句
331
+ "no-empty": ["error", { allowEmptyCatch: true }],
332
+ // 禁止使用短符号进行类型转换
333
+ "no-implicit-coercion": "off",
334
+ // 禁止在全局范围内使用变量声明和 function 声明
335
+ "no-implicit-globals": "off",
336
+ // 禁用魔术数字
337
+ "no-magic-numbers": 0,
338
+ // 禁用嵌套的三元表达式
339
+ "no-nested-ternary": "off",
340
+ // 禁止空 new 以避免产生副作用
341
+ "no-new": "off",
342
+ // 禁止对 function 的参数进行重新赋值
343
+ "no-param-reassign": "off",
344
+ // 禁用一元操作符 ++ 和 --
345
+ "no-plusplus": "off",
346
+ // 禁用特定导出名称
347
+ "no-restricted-exports": "off",
348
+ // 禁用特定的全局变量
349
+ "no-restricted-globals": [
350
+ "error",
351
+ { message: "Use `globalThis` instead.", name: "global" },
352
+ { message: "Use `globalThis` instead.", name: "self" }
353
+ ],
354
+ // 禁用特定的导入
355
+ "no-restricted-imports": "off",
356
+ // 禁止使用对象的某些属性
357
+ "no-restricted-properties": [
358
+ "error",
359
+ { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
360
+ { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
361
+ { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
362
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
363
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
364
+ ],
365
+ // 禁用特定的语法
366
+ "no-restricted-syntax": "off",
367
+ // 禁止变量声明与外层作用域的变量同名
368
+ "no-shadow": "off",
369
+ // 禁用三元操作符
370
+ "no-ternary": "off",
371
+ // 禁止抛出异常字面量
372
+ "no-throw-literal": "off",
373
+ // 禁用undefined
374
+ "no-undefined": "off",
375
+ // 禁止标识符中有下划线
376
+ "no-underscore-dangle": "off",
377
+ // 禁用 void 操作符
378
+ "no-void": "off",
379
+ // 禁止在注释中使用特定的警告术语
380
+ "no-warning-comments": "off",
381
+ // 强制函数中的变量在一起声明
382
+ "one-var": "off",
383
+ // 禁止使用 Math.pow 幂运算符
384
+ "prefer-exponentiation-operator": "off",
385
+ // 要求使用 Error 对象作为 Promise 拒绝的原因
386
+ "prefer-promise-reject-errors": "off",
387
+ // 强制在parseInt()使用基数参数
388
+ "radix": "off",
389
+ // 禁止使用不带 await 表达式的 async 函数
390
+ "require-await": "off",
391
+ // 强制在RegExp上使用u标志
392
+ "require-unicode-regexp": "off",
393
+ // imports排序 不好用
394
+ "sort-imports": "off",
395
+ // 要求对象属性按序排列
396
+ "sort-keys": "off",
397
+ // 要求同一个声明块中的变量按顺序排列
398
+ "sort-vars": "off",
399
+ // 要求或禁止使用严格模式指令
400
+ "strict": "off",
401
+ // Overrides
402
+ ...overrides
403
+ }
404
+ },
405
+ {
406
+ files: [`scripts/${GLOB_SRC}`],
407
+ name: "lntvow/javascript/disables",
408
+ rules: {
409
+ "no-console": "off"
410
+ }
411
+ }
412
+ ];
413
+ }
414
+
415
+ // src/configs/prettier.ts
416
+ var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
417
+ var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
418
+ async function prettier() {
419
+ return [
420
+ {
421
+ name: "lntvow/prettier/rules",
422
+ plugins: {
423
+ prettier: import_eslint_plugin_prettier.default
424
+ },
425
+ rules: {
426
+ ...import_eslint_config_prettier.default.rules,
427
+ "prettier/prettier": "warn"
428
+ }
429
+ }
430
+ ];
431
+ }
432
+
433
+ // src/configs/regexp.ts
434
+ var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
435
+ var import_eslint_plugin2 = __toESM(require("@lntvow/eslint-plugin"), 1);
436
+ async function regexp(options = {}) {
437
+ const { overrides } = options;
438
+ const pluginRegexp = import_eslint_plugin_regexp.configs["flat/recommended"].plugins.regexp;
439
+ const { rules } = import_eslint_plugin_regexp.configs["flat/recommended"];
440
+ return [
441
+ {
442
+ name: "lntvow/regexp/rules",
443
+ plugins: {
444
+ regexp: pluginRegexp,
445
+ lntvow: import_eslint_plugin2.default
446
+ },
447
+ rules: {
448
+ // Update to eslint-plugin-regexp v2.6.0
449
+ ...rules,
450
+ // 'lntvow/newline-before': 'error',
451
+ // Overrides
452
+ ...overrides
453
+ }
454
+ }
455
+ ];
456
+ }
457
+
458
+ // src/configs/stylistic.ts
459
+ var import_eslint_plugin3 = __toESM(require("@stylistic/eslint-plugin"), 1);
460
+ var StylisticConfigDefaults = {
461
+ indent: 2,
462
+ jsx: true,
463
+ quotes: "single",
464
+ semi: false
465
+ };
466
+ async function stylistic(options = {}) {
467
+ const {
468
+ indent,
469
+ jsx,
470
+ overrides = {},
471
+ quotes,
472
+ semi
473
+ } = {
474
+ ...StylisticConfigDefaults,
475
+ ...options
476
+ };
477
+ const config = import_eslint_plugin3.default.configs.customize({
478
+ flat: true,
479
+ indent,
480
+ jsx,
481
+ pluginName: "style",
482
+ quotes,
483
+ semi
484
+ });
485
+ return [
486
+ {
487
+ name: "lntvow/stylistic/rules",
488
+ plugins: {
489
+ style: import_eslint_plugin3.default
490
+ },
491
+ rules: {
492
+ // ...config.rules,
493
+ // Custom rules
494
+ "style/spaced-comment": "error",
495
+ "style/padding-line-between-statements": [
496
+ "error",
497
+ { blankLine: "always", prev: "*", next: "cjs-export" },
498
+ { blankLine: "always", prev: "*", next: "export" },
499
+ { blankLine: "always", prev: "*", next: "function" }
500
+ ],
501
+ // overrides
502
+ ...overrides
503
+ }
504
+ }
505
+ ];
506
+ }
507
+
508
+ // src/configs/test.ts
509
+ var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
510
+ async function test(options = {}) {
511
+ const { overrides } = options;
512
+ return [
513
+ {
514
+ name: "lntvow/test/rules",
515
+ plugins: {
516
+ test: import_eslint_plugin_vitest.default
517
+ },
518
+ files: [GLOB_TESTS],
519
+ rules: {
520
+ // Update to eslint-plugin-regexp v2.6.0
521
+ // ...rules,
522
+ // Overrides
523
+ ...overrides
524
+ }
525
+ }
526
+ ];
527
+ }
528
+
529
+ // src/configs/typescript.ts
530
+ var import_eslint_plugin4 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
531
+ var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
532
+
533
+ // src/utils/index.ts
534
+ function renameRules(rules, map) {
535
+ return Object.fromEntries(
536
+ Object.entries(rules).map(([key, value]) => {
537
+ for (const [from, to] of Object.entries(map)) {
538
+ if (key.startsWith(`${from}/`))
539
+ return [to + key.slice(from.length), value];
540
+ }
541
+ return [key, value];
542
+ })
543
+ );
544
+ }
545
+
546
+ // src/configs/typescript.ts
547
+ async function typescript(options = {}) {
548
+ const { componentExts = [], overrides = {}, parserOptions = {} } = options;
549
+ const files = [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)];
550
+ return [
551
+ {
552
+ name: "lntvow/typescript/rules",
553
+ plugins: {
554
+ ts: import_eslint_plugin4.default
555
+ },
556
+ languageOptions: {
557
+ parser: import_parser.default,
558
+ parserOptions: {
559
+ sourceType: "module"
560
+ }
561
+ },
562
+ files,
563
+ rules: {
564
+ ...renameRules(import_eslint_plugin4.default.configs["eslint-recommended"].overrides[0].rules, {
565
+ "@typescript-eslint": "ts"
566
+ }),
567
+ ...renameRules(import_eslint_plugin4.default.configs.strict.rules, { "@typescript-eslint": "ts" }),
568
+ // Override default configuration
569
+ // 禁止使用!断言
570
+ "ts/no-non-null-assertion": "off",
571
+ // 禁止使用any
572
+ "ts/no-explicit-any": "off",
573
+ // 禁止使用ts注释
574
+ "ts/ban-ts-comment": "off",
575
+ // 未使用的变量
576
+ "ts/no-unused-vars": "warn",
577
+ // Override javascript configuration
578
+ "no-use-before-define": "off",
579
+ "ts/no-use-before-define": ["error", { functions: false }],
580
+ // Overrides
581
+ ...overrides
582
+ }
583
+ }
584
+ ];
585
+ }
586
+
587
+ // src/configs/vue.ts
588
+ var import_local_pkg = require("local-pkg");
589
+ var import_parser2 = __toESM(require("@typescript-eslint/parser"), 1);
590
+ var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
591
+ var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
592
+ async function vue(options = {}) {
593
+ const { overrides = {}, vueVersion = getVueVersion() } = options;
594
+ const vue3Rules = {
595
+ ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
596
+ ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
597
+ ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules,
598
+ "vue/block-lang": ["error", { script: { lang: ["ts", "tsx"] } }],
599
+ "vue/block-order": ["error", { order: ["script[setup]", "template", "style[scoped]"] }],
600
+ "vue/component-api-style": "error"
601
+ };
602
+ const vue2Rules = {
603
+ ...import_eslint_plugin_vue.default.configs.essential.rules,
604
+ ...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
605
+ ...import_eslint_plugin_vue.default.configs.recommended.rules,
606
+ "vue/block-lang": ["error", { script: { allowNoLang: true } }],
607
+ "vue/block-order": ["error", { order: [["script", "template"], "style[scoped]"] }]
608
+ };
609
+ return [
610
+ {
611
+ name: "lntvow/vue/rules",
612
+ plugins: {
613
+ vue: import_eslint_plugin_vue.default
614
+ },
615
+ languageOptions: {
616
+ parser: import_vue_eslint_parser.default,
617
+ parserOptions: {
618
+ ecmaFeatures: {
619
+ jsx: true
620
+ },
621
+ parser: {
622
+ ts: import_parser2.default,
623
+ tsx: import_parser2.default
624
+ },
625
+ sourceType: "module"
626
+ }
627
+ // globals: {
628
+ // computed: 'readonly',
629
+ // defineEmits: 'readonly',
630
+ // defineExpose: 'readonly',
631
+ // defineProps: 'readonly',
632
+ // onMounted: 'readonly',
633
+ // onUnmounted: 'readonly',
634
+ // reactive: 'readonly',
635
+ // ref: 'readonly',
636
+ // shallowReactive: 'readonly',
637
+ // shallowRef: 'readonly',
638
+ // toRef: 'readonly',
639
+ // toRefs: 'readonly',
640
+ // watch: 'readonly',
641
+ // watchEffect: 'readonly',
642
+ // },
643
+ },
644
+ processor: import_eslint_plugin_vue.default.processors[".vue"],
645
+ files: [GLOB_VUE],
646
+ rules: {
647
+ // Update to eslint-plugin-vue v9.26.0
648
+ ...import_eslint_plugin_vue.default.configs.base.rules,
649
+ ...vueVersion === 3 ? vue3Rules : vue2Rules,
650
+ // Override default configuration
651
+ // vue禁用多个单词组件名
652
+ "vue/multi-word-component-names": "off",
653
+ // vue禁用 属性-连接 个人喜欢驼峰
654
+ "vue/attribute-hyphenation": ["error", "never"],
655
+ // vue禁用标签缩进
656
+ "vue/html-indent": "off",
657
+ // 标签自闭合
658
+ "vue/html-self-closing": [
659
+ "error",
660
+ {
661
+ html: { void: "always", normal: "always", component: "always" },
662
+ svg: "always",
663
+ math: "always"
664
+ }
665
+ ],
666
+ // vue禁用标签属性换行
667
+ "vue/max-attributes-per-line": "off",
668
+ // vue内容强制换行
669
+ "vue/singleline-html-element-content-newline": "off",
670
+ // 禁用事件驼峰 个人喜欢驼峰
671
+ "vue/v-on-event-hyphenation": ["error", "never"],
672
+ // Custom rules
673
+ // 标签换行
674
+ "vue/block-tag-newline": "error",
675
+ // 强制模板组件名称为PascalCase
676
+ "vue/component-name-in-template-casing": ["error", "PascalCase", { ignores: ["/-/"] }],
677
+ // 强制组件名大驼峰
678
+ "vue/component-options-name-casing": "error",
679
+ // 强制事件名小驼峰
680
+ "vue/custom-event-name-casing": "error",
681
+ // 强制定义emits
682
+ "vue/define-emits-declaration": "error",
683
+ // 强制定义宏defineProps defineEmits的顺序
684
+ "vue/define-macros-order": "error",
685
+ // 强制定义props
686
+ "vue/define-props-declaration": "error",
687
+ // 强制style属性
688
+ "vue/enforce-style-attribute": "error",
689
+ // 禁止button没有type
690
+ "vue/html-button-has-type": "off",
691
+ // 强制html注释换行
692
+ "vue/html-comment-content-newline": "error",
693
+ // 强制html注释空格
694
+ "vue/html-comment-content-spacing": "error",
695
+ // 强制html注释缩进
696
+ "vue/html-comment-indent": "off",
697
+ // 强制组件名和文件名一致
698
+ "vue/match-component-file-name": ["error", { extensions: ["jsx", "tsx"], shouldMatchCase: true }],
699
+ // 强制组件名导入名称一致
700
+ "vue/match-component-import-name": "error",
701
+ // 强制单个标签最大行数
702
+ "vue/max-lines-per-block": "off",
703
+ // 强制多行属性空行
704
+ "vue/new-line-between-multi-line-property": "off",
705
+ // 强制nextTick风格
706
+ "vue/next-tick-style": "off",
707
+ // 禁止模板中出现未翻译的字符串
708
+ "vue/no-bare-strings-in-template": "off",
709
+ // 布尔类型默认值校验
710
+ "vue/no-boolean-default": "off",
711
+ // 禁止使用已弃用的v-model定义
712
+ "vue/no-deprecated-model-definition": "error",
713
+ // 禁止重复继承属性
714
+ "vue/no-duplicate-attr-inheritance": "error",
715
+ // 禁止空的标签
716
+ "vue/no-empty-component-block": "off",
717
+ // 禁止class 中出现多个对象
718
+ "vue/no-multiple-objects-in-class": "error",
719
+ // 禁止潜在的组件选项拼写错误
720
+ "vue/no-potential-component-option-typo": "error",
721
+ // 禁止ref对象丢失响应性
722
+ "vue/no-ref-object-reactivity-loss": "error",
723
+ // 禁止default和required同时存在
724
+ "vue/no-required-prop-with-default": "error",
725
+ // 禁止特定的模板语法
726
+ "vue/no-restricted-block": "off",
727
+ // 禁止await后调用特定的函数
728
+ "vue/no-restricted-call-after-await": "off",
729
+ // 禁止特定的class
730
+ "vue/no-restricted-class": "off",
731
+ // 禁止特定的组件名
732
+ "vue/no-restricted-component-names": "off",
733
+ // 禁止特定的组件选项
734
+ "vue/no-restricted-component-options": "off",
735
+ // 禁止特定的事件名
736
+ "vue/no-restricted-custom-event": "off",
737
+ // 禁止特定的html标签
738
+ "vue/no-restricted-html-elements": "off",
739
+ // 禁止特定的props
740
+ "vue/no-restricted-props": "off",
741
+ // 禁止特定的静态属性
742
+ "vue/no-restricted-static-attribute": "off",
743
+ // 禁止特定的v-bind
744
+ "vue/no-restricted-v-bind": "off",
745
+ // 禁止根元素使用v-if
746
+ "vue/no-root-v-if": "off",
747
+ // 禁止setup中props丢失响应性
748
+ "vue/no-setup-props-reactivity-loss": "error",
749
+ // 禁止内联样式
750
+ "vue/no-static-inline-styles": "error",
751
+ // 禁止target="_blank"
752
+ "vue/no-template-target-blank": "error",
753
+ // 禁止在beforeRouteEnter中使用this
754
+ "vue/no-this-in-before-route-enter": "error",
755
+ // 禁止未定义的组件
756
+ "vue/no-undef-components": "off",
757
+ // 禁止未定义的属性 mixin vuex冲突
758
+ "vue/no-undef-properties": "error",
759
+ // 禁止不支持的特性
760
+ "vue/no-unsupported-features": "off",
761
+ // 禁止未使用的emits
762
+ "vue/no-unused-emit-declarations": "error",
763
+ // 未使用属性校验
764
+ "vue/no-unused-properties": ["warn", { groups: ["props", "data", "computed", "methods", "setup"] }],
765
+ // 禁止未使用属性ref
766
+ "vue/no-unused-refs": "error",
767
+ // 禁止v-else和v-for同时使用
768
+ "vue/no-use-v-else-with-v-for": "error",
769
+ // 禁止使用无效的模板语法
770
+ "vue/no-useless-mustaches": "error",
771
+ // v-bind强制简写
772
+ "vue/no-useless-v-bind": "error",
773
+ // 禁止使用v-text
774
+ "vue/no-v-text": "error",
775
+ // 模板三标签之间强制空一行
776
+ "vue/padding-line-between-blocks": "error",
777
+ // 禁止模板空行
778
+ "vue/padding-line-between-tags": ["error", [{ blankLine: "never", prev: "*", next: "*" }]],
779
+ // 组件定义强制空行
780
+ "vue/padding-lines-in-component-definition": ["error", { betweenOptions: "never" }],
781
+ // 宏定义选项强制
782
+ "vue/prefer-define-options": "error",
783
+ // props强制boolean类型在前
784
+ "vue/prefer-prop-type-boolean-first": "error",
785
+ // 要求模板中的静态类名位于单独的class属性中
786
+ "vue/prefer-separate-static-class": "error",
787
+ // props 强制true简写
788
+ "vue/prefer-true-attribute-shorthand": "error",
789
+ // 要求组件直接导出
790
+ "vue/require-direct-export": "error",
791
+ // 要求emit事件校验
792
+ "vue/require-emit-validator": "off",
793
+ // 要求明确的插槽
794
+ "vue/require-explicit-slots": "error",
795
+ // 强制expose
796
+ "vue/require-expose": "error",
797
+ // 宏定义变量名强制
798
+ "vue/require-macro-variable-name": "error",
799
+ // 强制name属性
800
+ "vue/require-name-property": "off",
801
+ // 强制prop注释
802
+ "vue/require-prop-comment": "off",
803
+ // 强制对象类型
804
+ "vue/require-typed-object-prop": "error",
805
+ // 强制ref类型
806
+ "vue/require-typed-ref": "error",
807
+ // script缩进
808
+ "vue/script-indent": "off",
809
+ // 强制属性排序
810
+ "vue/sort-keys": "off",
811
+ // class排序
812
+ "vue/static-class-names-order": "error",
813
+ // 强制v-for指令的分隔符样式
814
+ "vue/v-for-delimiter-style": "error",
815
+ // 强制v-on指令的风格
816
+ "vue/v-on-handler-style": "off",
817
+ // 宏定义选项校验
818
+ "vue/valid-define-options": "error",
819
+ // Stylistic
820
+ "vue/array-bracket-newline": "off",
821
+ "vue/array-bracket-spacing": "off",
822
+ "vue/array-element-newline": "off",
823
+ "vue/arrow-spacing": "off",
824
+ "vue/block-spacing": "off",
825
+ "vue/brace-style": "off",
826
+ // 强制驼峰
827
+ "vue/camelcase": "error",
828
+ "vue/comma-dangle": "off",
829
+ "vue/comma-spacing": "off",
830
+ "vue/comma-style": "off",
831
+ "vue/dot-location": "off",
832
+ // 要求使用点号
833
+ "vue/dot-notation": "error",
834
+ // 要求使用 === 和 !==
835
+ "vue/eqeqeq": "error",
836
+ "vue/func-call-spacing": "off",
837
+ "vue/key-spacing": "off",
838
+ "vue/keyword-spacing": "off",
839
+ "vue/max-len": "off",
840
+ "vue/multiline-ternary": "off",
841
+ "vue/no-console": "off",
842
+ // 禁止在条件中使用常量表达式
843
+ "vue/no-constant-condition": "error",
844
+ "vue/no-extra-parens": "off",
845
+ // 禁止使用空解构模式
846
+ "vue/no-empty-pattern": "error",
847
+ // 禁止不规则的空白
848
+ "vue/no-irregular-whitespace": "error",
849
+ "vue/no-loss-of-precision": "off",
850
+ "vue/no-restricted-syntax": "off",
851
+ // 禁用稀疏数组
852
+ "vue/no-sparse-arrays": "error",
853
+ // 禁止没有必要的字符拼接
854
+ "vue/no-useless-concat": "error",
855
+ "vue/object-curly-newline": "off",
856
+ "vue/object-curly-spacing": "off",
857
+ "vue/object-property-newline": "off",
858
+ // 要求对象字面量简写语法
859
+ "vue/object-shorthand": "error",
860
+ "vue/operator-linebreak": "off",
861
+ // 优先使用模板字符串
862
+ "vue/prefer-template": "error",
863
+ "vue/quote-props": "off",
864
+ "vue/space-in-parens": "off",
865
+ "vue/space-infix-ops": "off",
866
+ "vue/space-unary-ops": "off",
867
+ "vue/template-curly-spacing": "off",
868
+ // Overrides
869
+ ...overrides
870
+ }
871
+ }
872
+ ];
873
+ }
874
+ function getVueVersion() {
875
+ const pkg = (0, import_local_pkg.getPackageInfoSync)("vue", { paths: [process.cwd()] });
876
+ if (pkg && pkg.version) {
877
+ return +pkg.version[0];
878
+ }
879
+ return 3;
880
+ }
881
+
882
+ // src/factory.ts
883
+ var flatConfigProps = [
884
+ "name",
885
+ "files",
886
+ "ignores",
887
+ "languageOptions",
888
+ "linterOptions",
889
+ "processor",
890
+ "plugins",
891
+ "rules",
892
+ "settings"
893
+ ];
894
+ var defaultPluginRenaming = {
895
+ "@stylistic": "style",
896
+ "@typescript-eslint": "typescript",
897
+ "import-x": "import",
898
+ "vitest": "test"
899
+ };
900
+ function lntvow(options = {}, ...userConfigs) {
901
+ const {
902
+ autoRenamePlugins = true,
903
+ componentExts = [],
904
+ gitignore: enableGitignore = true,
905
+ regexp: enableRegexp = true,
906
+ typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
907
+ vue: enableVue = ["vue", "nuxt", "vitepress"].some((i) => (0, import_local_pkg2.isPackageExists)(i)),
908
+ test: enableTest = (0, import_local_pkg2.isPackageExists)("vitest"),
909
+ stylistic: enableStylistic = true
910
+ } = options;
911
+ const configs2 = [];
912
+ configs2.push(
913
+ ignores(),
914
+ javascript({
915
+ ...resolveSubOptions(options, "javascript")
916
+ }),
917
+ imports()
918
+ // comments(),
919
+ // node(),
920
+ // jsdoc({
921
+ // stylistic: stylisticOptions,
922
+ // }),
923
+ // unicorn(),
924
+ // command(),
925
+ // Optional plugins (installed but not enabled by default)
926
+ // perfectionist(),
927
+ );
928
+ if (enableGitignore) {
929
+ configs2.push(gitignore({ ...resolveSubOptions(options, "gitignore") }));
930
+ }
931
+ if (enableVue) {
932
+ componentExts.push("vue");
933
+ }
934
+ if (enableTypeScript) {
935
+ configs2.push(typescript({ ...resolveSubOptions(options, "typescript"), componentExts }));
936
+ }
937
+ if (enableVue) {
938
+ configs2.push(vue({ ...resolveSubOptions(options, "vue") }));
939
+ }
940
+ if (enableRegexp) {
941
+ configs2.push(regexp({ ...resolveSubOptions(options, "regexp") }));
942
+ }
943
+ if (enableTest) {
944
+ configs2.push(test({ ...resolveSubOptions(options, "test") }));
945
+ }
946
+ if (enableStylistic) {
947
+ configs2.push(stylistic({ ...resolveSubOptions(options, "stylistic") }));
948
+ }
949
+ const fusedConfig = flatConfigProps.reduce((acc, key) => {
950
+ if (key in options) {
951
+ acc[key] = options[key];
952
+ }
953
+ return acc;
954
+ }, {});
955
+ if (Object.keys(fusedConfig).length) {
956
+ configs2.push([fusedConfig]);
957
+ }
958
+ configs2.push(custom(), prettier());
959
+ let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
960
+ composer = composer.append(...configs2, ...userConfigs);
961
+ if (autoRenamePlugins) {
962
+ composer = composer.renamePlugins(defaultPluginRenaming);
963
+ }
964
+ return composer;
965
+ }
966
+ function resolveSubOptions(options, key) {
967
+ return (0, import_utils3.isBoolean)(options[key]) ? {} : options[key] || {};
968
+ }
969
+
970
+ // src/index.ts
971
+ var src_default = lntvow;
972
+ // Annotate the CommonJS export names for ESM import in node:
973
+ 0 && (module.exports = {
974
+ GLOB_ALL_SRC,
975
+ GLOB_ASTRO,
976
+ GLOB_CSS,
977
+ GLOB_EXCLUDE,
978
+ GLOB_GRAPHQL,
979
+ GLOB_HTML,
980
+ GLOB_JS,
981
+ GLOB_JSON,
982
+ GLOB_JSON5,
983
+ GLOB_JSONC,
984
+ GLOB_JSX,
985
+ GLOB_LESS,
986
+ GLOB_MARKDOWN,
987
+ GLOB_MARKDOWN_CODE,
988
+ GLOB_MARKDOWN_IN_MARKDOWN,
989
+ GLOB_POSTCSS,
990
+ GLOB_SCSS,
991
+ GLOB_SRC,
992
+ GLOB_SRC_EXT,
993
+ GLOB_STYLE,
994
+ GLOB_SVELTE,
995
+ GLOB_TESTS,
996
+ GLOB_TOML,
997
+ GLOB_TS,
998
+ GLOB_TSX,
999
+ GLOB_VUE,
1000
+ GLOB_XML,
1001
+ GLOB_YAML,
1002
+ StylisticConfigDefaults,
1003
+ custom,
1004
+ getVueVersion,
1005
+ gitignore,
1006
+ ignores,
1007
+ imports,
1008
+ javascript,
1009
+ lntvow,
1010
+ prettier,
1011
+ regexp,
1012
+ renameRules,
1013
+ stylistic,
1014
+ test,
1015
+ typescript,
1016
+ vue
1017
+ });