@eienjs/eslint-config 0.1.0 → 0.2.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.
@@ -1,5 +1,8 @@
1
- import { OptionsComponentExts, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsVue, StylisticConfig, TypedFlatConfigItem } from "../types-BDuTVdZ8.js";
1
+ import { OptionsAdonisJS, OptionsComponentExts, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsVue, StylisticConfig, TypedFlatConfigItem } from "../types-CBNl8Ios.js";
2
2
 
3
+ //#region src/configs/adonisjs.d.ts
4
+ declare function adonisjs(options?: OptionsAdonisJS): Promise<TypedFlatConfigItem[]>;
5
+ //#endregion
3
6
  //#region src/configs/astro.d.ts
4
7
  declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
5
8
  //#endregion
@@ -87,4 +90,4 @@ declare function vue(options?: OptionsVue & OptionsHasTypeScript & OptionsOverri
87
90
  //#region src/configs/yaml.d.ts
88
91
  declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
89
92
  //#endregion
90
- export { StylisticConfigDefaults, StylisticOptions, astro, command, comments, disables, formatters, ignores, imports, javascript, jsdoc, jsonc, markdown, node, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
93
+ export { StylisticConfigDefaults, StylisticOptions, adonisjs, astro, command, comments, disables, formatters, ignores, imports, javascript, jsdoc, jsonc, markdown, node, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
@@ -1,3 +1,3 @@
1
- import { StylisticConfigDefaults, astro, command, comments, disables, formatters, ignores, imports, javascript, jsdoc, jsonc, markdown, node, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml } from "../configs-B_fhQhgr.js";
1
+ import { StylisticConfigDefaults, adonisjs, astro, command, comments, disables, formatters, ignores, imports, javascript, jsdoc, jsonc, markdown, node, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml } from "../configs-ChITrcNN.js";
2
2
 
3
- export { StylisticConfigDefaults, astro, command, comments, disables, formatters, ignores, imports, javascript, jsdoc, jsonc, markdown, node, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
3
+ export { StylisticConfigDefaults, adonisjs, astro, command, comments, disables, formatters, ignores, imports, javascript, jsdoc, jsonc, markdown, node, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
@@ -1,4 +1,5 @@
1
1
  import { isPackageExists } from "local-pkg";
2
+ import { join } from "pathe";
2
3
  import process from "node:process";
3
4
  import { fileURLToPath } from "node:url";
4
5
  import createCommand from "eslint-plugin-command/config";
@@ -60,28 +61,36 @@ const GLOB_ALL_SRC = [
60
61
  const GLOB_EXCLUDE = [
61
62
  "**/node_modules",
62
63
  "**/dist",
64
+ "**/build",
63
65
  "**/package-lock.json",
64
66
  "**/yarn.lock",
65
67
  "**/pnpm-lock.yaml",
66
68
  "**/bun.lockb",
69
+ "**/composer.lock",
70
+ "**/composer.json",
67
71
  "**/output",
68
72
  "**/coverage",
69
73
  "**/temp",
70
74
  "**/.temp",
71
75
  "**/tmp",
72
76
  "**/.tmp",
77
+ "**/vendor",
78
+ "**/public",
73
79
  "**/.history",
74
80
  "**/.vitepress/cache",
81
+ "**/.adonisjs",
75
82
  "**/.nuxt",
76
83
  "**/.next",
77
84
  "**/.svelte-kit",
78
85
  "**/.vercel",
86
+ "**/.husky",
79
87
  "**/.changeset",
80
88
  "**/.idea",
81
89
  "**/.cache",
82
90
  "**/.output",
83
91
  "**/.vite-inspect",
84
92
  "**/.yarn",
93
+ "**/.pnpm-store",
85
94
  "**/vite.config.*.timestamp-*",
86
95
  "**/CHANGELOG*.md",
87
96
  "**/*.min.*",
@@ -148,6 +157,106 @@ function isInGitHooksOrLintStaged() {
148
157
  return Boolean(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
149
158
  }
150
159
 
160
+ //#endregion
161
+ //#region src/configs/adonisjs.ts
162
+ async function adonisjs(options = {}) {
163
+ const { overrides = {}, dirs = {} } = options;
164
+ await ensurePackages(["@adonisjs/eslint-plugin"]);
165
+ const pluginAdonisJS = await interopDefault(import("@adonisjs/eslint-plugin"));
166
+ dirs.root = dirs.root || ".";
167
+ const appPath = `${dirs.root}/app`;
168
+ dirs.controllers = dirs.controllers || `${appPath}/controllers`;
169
+ dirs.exceptions = dirs.exceptions || `${appPath}/exceptions`;
170
+ dirs.models = dirs.models || `${appPath}/models`;
171
+ dirs.mails = dirs.mails || `${appPath}/mails`;
172
+ dirs.services = dirs.services || `${appPath}/services`;
173
+ dirs.listeners = dirs.listeners || `${appPath}/listeners`;
174
+ dirs.events = dirs.events || `${appPath}/events`;
175
+ dirs.middleware = dirs.middleware || `${appPath}/middleware`;
176
+ dirs.validators = dirs.validators || `${appPath}/validators`;
177
+ dirs.policies = dirs.policies || `${appPath}/policies`;
178
+ dirs.abilities = dirs.abilities || `${appPath}/abilities`;
179
+ dirs.providers = dirs.providers || `${dirs.root}/providers`;
180
+ dirs.database = dirs.database || `${dirs.root}/database`;
181
+ dirs.bin = dirs.bin || `${dirs.root}/bin`;
182
+ dirs.start = dirs.start || `${dirs.root}/start`;
183
+ dirs.tests = dirs.tests || `${dirs.root}/tests`;
184
+ dirs.config = dirs.config || `${dirs.root}/config`;
185
+ dirs.commands = dirs.commands || `${dirs.root}/commands`;
186
+ const nestedGlobPattern = `**/*.${GLOB_SRC_EXT}`;
187
+ const fileRoutes = Object.values(dirs).map((dir) => join(dir, nestedGlobPattern));
188
+ const commonRulesSet = {
189
+ "@typescript-eslint/require-await": "off",
190
+ "@typescript-eslint/explicit-function-return-type": "off",
191
+ "@typescript-eslint/explicit-module-boundary-types": "off",
192
+ "@typescript-eslint/no-floating-promises": "off",
193
+ "@typescript-eslint/no-unsafe-return": "off",
194
+ "unicorn/no-anonymous-default-export": "off"
195
+ };
196
+ return [
197
+ {
198
+ name: "eienjs/adonisjs/rules",
199
+ plugins: { "@adonisjs": pluginAdonisJS },
200
+ rules: {
201
+ "@adonisjs/prefer-lazy-controller-import": "error",
202
+ "@adonisjs/prefer-lazy-listener-import": "error",
203
+ ...overrides
204
+ }
205
+ },
206
+ {
207
+ files: [fileRoutes],
208
+ name: "eienjs/adonisjs/disables",
209
+ rules: { "antfu/no-top-level-await": "off" }
210
+ },
211
+ {
212
+ files: [join(dirs.database, nestedGlobPattern)],
213
+ name: "eienjs/adonisjs/database-disables",
214
+ rules: { ...commonRulesSet }
215
+ },
216
+ {
217
+ files: [join(dirs.bin, nestedGlobPattern)],
218
+ name: "eienjs/adonisjs/bin-disables",
219
+ rules: {
220
+ ...commonRulesSet,
221
+ "@typescript-eslint/no-misused-promises": "off"
222
+ }
223
+ },
224
+ {
225
+ files: [join(dirs.commands, nestedGlobPattern)],
226
+ name: "eienjs/adonisjs/commands-disables",
227
+ rules: { ...commonRulesSet }
228
+ },
229
+ {
230
+ files: [join(dirs.middleware, nestedGlobPattern)],
231
+ name: "eienjs/adonisjs/middleware-disables",
232
+ rules: { ...commonRulesSet }
233
+ },
234
+ {
235
+ files: [join(dirs.exceptions, nestedGlobPattern)],
236
+ name: "eienjs/adonisjs/exceptions-disables",
237
+ rules: { ...commonRulesSet }
238
+ },
239
+ {
240
+ files: [join(dirs.controllers, nestedGlobPattern)],
241
+ name: "eienjs/adonisjs/controllers-disables",
242
+ rules: {
243
+ "@typescript-eslint/explicit-function-return-type": "off",
244
+ "@typescript-eslint/explicit-module-boundary-types": "off"
245
+ }
246
+ },
247
+ {
248
+ files: [join(dirs.config, nestedGlobPattern)],
249
+ name: "eienjs/adonisjs/config-disables",
250
+ rules: { "@typescript-eslint/consistent-type-definitions": "off" }
251
+ },
252
+ {
253
+ files: [join(dirs.providers, nestedGlobPattern)],
254
+ name: "eienjs/adonisjs/providers-disables",
255
+ rules: { "@typescript-eslint/consistent-type-definitions": "off" }
256
+ }
257
+ ];
258
+ }
259
+
151
260
  //#endregion
152
261
  //#region src/configs/astro.ts
153
262
  async function astro(options = {}) {
@@ -302,6 +411,12 @@ async function stylistic(options = {}) {
302
411
  "antfu/consistent-chaining": "error",
303
412
  "antfu/consistent-list-newline": "error",
304
413
  "antfu/top-level-function": "error",
414
+ "@stylistic/arrow-parens": ["error", "always"],
415
+ "@stylistic/brace-style": [
416
+ "error",
417
+ "1tbs",
418
+ { allowSingleLine: true }
419
+ ],
305
420
  "@stylistic/max-len": ["error", {
306
421
  "code": maxLineLength,
307
422
  "ignoreStrings": true,
@@ -325,6 +440,11 @@ async function stylistic(options = {}) {
325
440
  before: false
326
441
  }],
327
442
  "@stylistic/quote-props": ["error", "consistent"],
443
+ "@stylistic/quotes": [
444
+ "error",
445
+ quotes,
446
+ { avoidEscape: true }
447
+ ],
328
448
  "@stylistic/semi": "error",
329
449
  "@stylistic/comma-spacing": "error",
330
450
  "@stylistic/yield-star-spacing": ["error", {
@@ -688,7 +808,6 @@ async function javascript(options = {}) {
688
808
  "no-sequences": ["error", { allowInParentheses: false }],
689
809
  "no-shadow-restricted-names": "error",
690
810
  "no-sparse-arrays": "error",
691
- "no-template-curly-in-string": "error",
692
811
  "no-this-before-super": "error",
693
812
  "no-throw-literal": "error",
694
813
  "no-undef": "error",
@@ -1659,16 +1778,18 @@ async function vue(options = {}) {
1659
1778
  ...acc,
1660
1779
  ...c
1661
1780
  }), {}),
1662
- "antfu/no-top-level-await": "off",
1663
- "n/prefer-global/process": "off",
1664
- "@typescript-eslint/explicit-function-return-type": "off",
1665
- "@typescript-eslint/naming-convention": "off",
1781
+ "vue/block-lang": ["error", { script: { lang: "ts" } }],
1666
1782
  "vue/block-order": ["error", { order: [
1667
1783
  "script",
1668
1784
  "template",
1669
1785
  "style"
1670
1786
  ] }],
1671
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
1787
+ "vue/component-api-style": ["error", ["script-setup"]],
1788
+ "vue/component-name-in-template-casing": [
1789
+ "error",
1790
+ "PascalCase",
1791
+ { registeredComponentsOnly: true }
1792
+ ],
1672
1793
  "vue/component-options-name-casing": ["error", "PascalCase"],
1673
1794
  "vue/custom-event-name-casing": ["error", "camelCase"],
1674
1795
  "vue/define-macros-order": ["error", { order: [
@@ -1686,6 +1807,7 @@ async function vue(options = {}) {
1686
1807
  "vue/max-attributes-per-line": "off",
1687
1808
  "vue/multi-word-component-names": "off",
1688
1809
  "vue/no-dupe-keys": "off",
1810
+ "vue/no-empty-component-block": "error",
1689
1811
  "vue/no-empty-pattern": "error",
1690
1812
  "vue/no-irregular-whitespace": "error",
1691
1813
  "vue/no-loss-of-precision": "error",
@@ -1703,8 +1825,8 @@ async function vue(options = {}) {
1703
1825
  "vue/no-setup-props-reactivity-loss": "off",
1704
1826
  "vue/no-sparse-arrays": "error",
1705
1827
  "vue/no-template-target-blank": "error",
1706
- "vue/no-unused-refs": "error",
1707
1828
  "vue/no-unused-properties": "error",
1829
+ "vue/no-unused-refs": "error",
1708
1830
  "vue/no-use-v-else-with-v-for": "error",
1709
1831
  "vue/no-useless-mustaches": "error",
1710
1832
  "vue/no-useless-v-bind": "error",
@@ -1719,14 +1841,15 @@ async function vue(options = {}) {
1719
1841
  ],
1720
1842
  "vue/prefer-separate-static-class": "error",
1721
1843
  "vue/prefer-template": "error",
1844
+ "vue/prefer-true-attribute-shorthand": "error",
1722
1845
  "vue/prop-name-casing": ["error", "camelCase"],
1723
- "vue/require-default-prop": "off",
1724
- "vue/require-prop-types": "off",
1846
+ "vue/require-typed-ref": "error",
1725
1847
  "vue/space-infix-ops": "error",
1726
1848
  "vue/space-unary-ops": ["error", {
1727
1849
  nonwords: false,
1728
1850
  words: true
1729
1851
  }],
1852
+ "vue/static-class-names-order": "off",
1730
1853
  ...stylistic$1 ? {
1731
1854
  "vue/array-bracket-spacing": ["error", "never"],
1732
1855
  "vue/arrow-spacing": ["error", {
@@ -1740,7 +1863,7 @@ async function vue(options = {}) {
1740
1863
  }],
1741
1864
  "vue/brace-style": [
1742
1865
  "error",
1743
- "stroustrup",
1866
+ "1tbs",
1744
1867
  { allowSingleLine: true }
1745
1868
  ],
1746
1869
  "vue/comma-dangle": ["error", "always-multiline"],
@@ -1772,6 +1895,11 @@ async function vue(options = {}) {
1772
1895
  "vue/template-curly-spacing": "error"
1773
1896
  } : {},
1774
1897
  "unicorn/filename-case": "off",
1898
+ "antfu/no-top-level-await": "off",
1899
+ "n/prefer-global/process": "off",
1900
+ "@typescript-eslint/explicit-function-return-type": "off",
1901
+ "@typescript-eslint/naming-convention": "off",
1902
+ "@stylistic/max-len": "off",
1775
1903
  ...overrides
1776
1904
  }
1777
1905
  }];
@@ -1858,4 +1986,4 @@ async function yaml(options = {}) {
1858
1986
  }
1859
1987
 
1860
1988
  //#endregion
1861
- export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, 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_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, astro, combine, command, comments, disables, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, vue, yaml };
1989
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, 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_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, adonisjs, astro, combine, command, comments, disables, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, vue, yaml };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Awaitable, ConfigNames, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVue, RuleOptions, Rules, StylisticConfig, TypedFlatConfigItem } from "./types-BDuTVdZ8.js";
1
+ import { Awaitable, ConfigNames, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVue, RuleOptions, Rules, StylisticConfig, TypedFlatConfigItem } from "./types-CBNl8Ios.js";
2
2
  import { FlatConfigComposer } from "eslint-flat-config-utils";
3
3
  import { Linter } from "eslint";
4
4
 
@@ -82,4 +82,4 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
82
82
  declare function isInEditorEnv(): boolean;
83
83
  declare function isInGitHooksOrLintStaged(): boolean;
84
84
  //#endregion
85
- export { Awaitable, ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, 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_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVue, ResolvedOptions, Rules, StylisticConfig, TypedFlatConfigItem, combine, eienjs as default, defaultPluginRenaming, eienjs, ensurePackages, getOverrides, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, resolveSubOptions, toArray };
85
+ export { Awaitable, ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, 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_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVue, ResolvedOptions, Rules, StylisticConfig, TypedFlatConfigItem, combine, eienjs as default, defaultPluginRenaming, eienjs, ensurePackages, getOverrides, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, resolveSubOptions, toArray };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, 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_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, astro, combine, command, comments, disables, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, vue, yaml } from "./configs-B_fhQhgr.js";
1
+ import { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, 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_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, adonisjs, astro, combine, command, comments, disables, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, vue, yaml } from "./configs-ChITrcNN.js";
2
2
  import { FlatConfigComposer } from "eslint-flat-config-utils";
3
3
  import { isPackageExists } from "local-pkg";
4
4
 
@@ -24,7 +24,7 @@ const defaultPluginRenaming = {
24
24
  "yml": "yaml"
25
25
  };
26
26
  function eienjs(options = {}) {
27
- const { astro: enableAstro = false, componentExts = [], gitignore: enableGitignore = true, imports: enableImports = true, pnpm: enableCatalogs = false, regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
27
+ const { astro: enableAstro = false, componentExts = [], gitignore: enableGitignore = true, imports: enableImports = true, pnpm: enableCatalogs = false, regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, vue: enableVue = VuePackages.some((i) => isPackageExists(i)), adonisjs: enableAdonisjs = false } = options;
28
28
  let { isInEditor } = options;
29
29
  if (isInEditor == null) {
30
30
  isInEditor = isInEditorEnv();
@@ -93,6 +93,10 @@ function eienjs(options = {}) {
93
93
  overrides: getOverrides(options, "markdown")
94
94
  }));
95
95
  if (options.formatters) configs.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions));
96
+ if (enableAdonisjs) configs.push(adonisjs({
97
+ ...resolveSubOptions(options, "adonisjs"),
98
+ overrides: getOverrides(options, "adonisjs")
99
+ }));
96
100
  configs.push(disables());
97
101
  if ("files" in options) throw new Error("[@eienjs/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
98
102
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
@@ -6,6 +6,16 @@ import { Linter } from "eslint";
6
6
 
7
7
  //#region src/typegen.d.ts
8
8
  interface RuleOptions {
9
+ /**
10
+ * (Needed for HMR) Prefer lazy controller import over standard import
11
+ * @see https://github.com/adonisjs/eslint-plugin-adonisjs#prefer-lazy-controller-import
12
+ */
13
+ '@adonisjs/prefer-lazy-controller-import'?: Linter.RuleEntry<[]>;
14
+ /**
15
+ * (Needed for HMR) Prefer lazy listener import over standard import
16
+ * @see https://github.com/adonisjs/eslint-plugin-adonisjs#prefer-lazy-listener-import
17
+ */
18
+ '@adonisjs/prefer-lazy-listener-import'?: Linter.RuleEntry<[]>;
9
19
  /**
10
20
  * require a `eslint-enable` comment for every `eslint-disable` comment
11
21
  * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html
@@ -15354,7 +15364,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
15354
15364
  onlyEquality?: boolean;
15355
15365
  }];
15356
15366
  // Names of all the configs
15357
- type ConfigNames = 'eienjs/astro/setup' | 'eienjs/astro/rules' | 'eienjs/eslint-comments/rules' | 'eienjs/formatter/setup' | 'eienjs/imports/rules' | 'eienjs/javascript/setup' | 'eienjs/javascript/rules' | 'eienjs/jsdoc/rules' | 'eienjs/jsonc/setup' | 'eienjs/jsonc/rules' | 'eienjs/markdown/setup' | 'eienjs/markdown/processor' | 'eienjs/markdown/parser' | 'eienjs/markdown/disables' | 'eienjs/node/rules' | 'eienjs/perfectionist/setup' | 'eienjs/sort/package-json' | 'eienjs/stylistic/rules' | 'eienjs/test/setup' | 'eienjs/test/rules' | 'eienjs/toml/setup' | 'eienjs/toml/rules' | 'eienjs/regexp/rules' | 'eienjs/typescript/setup' | 'eienjs/typescript/parser' | 'eienjs/typescript/rules' | 'eienjs/unicorn/rules' | 'eienjs/vue/setup' | 'eienjs/vue/rules' | 'eienjs/yaml/setup' | 'eienjs/yaml/rules' | 'eienjs/yaml/pnpm-workspace';
15367
+ type ConfigNames = 'eienjs/adonisjs/rules' | 'eienjs/adonisjs/disables' | 'eienjs/adonisjs/database-disables' | 'eienjs/adonisjs/bin-disables' | 'eienjs/adonisjs/commands-disables' | 'eienjs/adonisjs/middleware-disables' | 'eienjs/adonisjs/exceptions-disables' | 'eienjs/adonisjs/controllers-disables' | 'eienjs/adonisjs/config-disables' | 'eienjs/adonisjs/providers-disables' | 'eienjs/astro/setup' | 'eienjs/astro/rules' | 'eienjs/eslint-comments/rules' | 'eienjs/formatter/setup' | 'eienjs/imports/rules' | 'eienjs/javascript/setup' | 'eienjs/javascript/rules' | 'eienjs/jsdoc/rules' | 'eienjs/jsonc/setup' | 'eienjs/jsonc/rules' | 'eienjs/markdown/setup' | 'eienjs/markdown/processor' | 'eienjs/markdown/parser' | 'eienjs/markdown/disables' | 'eienjs/node/rules' | 'eienjs/perfectionist/setup' | 'eienjs/sort/package-json' | 'eienjs/stylistic/rules' | 'eienjs/test/setup' | 'eienjs/test/rules' | 'eienjs/toml/setup' | 'eienjs/toml/rules' | 'eienjs/regexp/rules' | 'eienjs/typescript/setup' | 'eienjs/typescript/parser' | 'eienjs/typescript/rules' | 'eienjs/unicorn/rules' | 'eienjs/vue/setup' | 'eienjs/vue/rules' | 'eienjs/yaml/setup' | 'eienjs/yaml/rules' | 'eienjs/yaml/pnpm-workspace';
15358
15368
  //#endregion
15359
15369
  //#region src/vendored/prettier_types.d.ts
15360
15370
  /**
@@ -15498,11 +15508,31 @@ type TypedFlatConfigItem = Omit<Linter.Config, 'plugins' | 'rules'> & {
15498
15508
  */
15499
15509
  rules?: Rules;
15500
15510
  };
15501
- interface OptionsFiles {
15502
- /**
15503
- * Override the `files` option to provide custom globs.
15504
- */
15505
- files?: string[];
15511
+ interface OptionsAdonisJS extends OptionsOverrides {
15512
+ /**
15513
+ * Override the `dirs` option to provide custom directories of adonisjs app.
15514
+ */
15515
+ dirs?: {
15516
+ root?: string;
15517
+ bin?: string;
15518
+ controllers?: string;
15519
+ exceptions?: string;
15520
+ models?: string;
15521
+ mails?: string;
15522
+ services?: string;
15523
+ listeners?: string;
15524
+ events?: string;
15525
+ middleware?: string;
15526
+ validators?: string;
15527
+ providers?: string;
15528
+ policies?: string;
15529
+ abilities?: string;
15530
+ database?: string;
15531
+ start?: string;
15532
+ tests?: string;
15533
+ config?: string;
15534
+ commands?: string;
15535
+ };
15506
15536
  }
15507
15537
  interface OptionsVue extends OptionsOverrides {
15508
15538
  /**
@@ -15608,6 +15638,12 @@ interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'qu
15608
15638
  interface OptionsOverrides {
15609
15639
  overrides?: TypedFlatConfigItem['rules'];
15610
15640
  }
15641
+ interface OptionsFiles {
15642
+ /**
15643
+ * Override the `files` option to provide custom globs.
15644
+ */
15645
+ files?: string[];
15646
+ }
15611
15647
  interface OptionsRegExp {
15612
15648
  /**
15613
15649
  * Override rulelevels
@@ -15742,6 +15778,15 @@ interface OptionsConfig extends OptionsComponentExts {
15742
15778
  * @default auto-detect based on the process.env
15743
15779
  */
15744
15780
  isInEditor?: boolean;
15781
+ /**
15782
+ * Enable AdonisJS support.
15783
+ *
15784
+ * Requires installing:
15785
+ * - `@adonisjs/eslint-plugin`
15786
+ *
15787
+ * @default false
15788
+ */
15789
+ adonisjs?: boolean | OptionsAdonisJS;
15745
15790
  }
15746
15791
  //#endregion
15747
- export { Awaitable, type ConfigNames, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVue, RuleOptions, Rules, StylisticConfig, TypedFlatConfigItem };
15792
+ export { Awaitable, type ConfigNames, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVue, RuleOptions, Rules, StylisticConfig, TypedFlatConfigItem };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eienjs/eslint-config",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "description": "EienJS ESLint Config",
6
6
  "author": "Fernando Isidro <luffynando@gmail.com> (https://github.com/luffynando/)",
7
7
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  "node": ">=20.11"
30
30
  },
31
31
  "peerDependencies": {
32
+ "@adonisjs/eslint-plugin": "^2.0.0",
32
33
  "@prettier/plugin-xml": "^3.4.2",
33
34
  "astro-eslint-parser": "^1.2.2",
34
35
  "eslint": "^9.32.0",
@@ -37,6 +38,9 @@
37
38
  "prettier-plugin-astro": "^0.14.1"
38
39
  },
39
40
  "peerDependenciesMeta": {
41
+ "@adonisjs/eslint-plugin": {
42
+ "optional": true
43
+ },
40
44
  "@prettier/plugin-xml": {
41
45
  "optional": true
42
46
  },
@@ -68,7 +72,7 @@
68
72
  "eslint-plugin-antfu": "^3.1.1",
69
73
  "eslint-plugin-command": "^3.3.1",
70
74
  "eslint-plugin-import-lite": "^0.3.0",
71
- "eslint-plugin-jsdoc": "^52.0.1",
75
+ "eslint-plugin-jsdoc": "^52.0.2",
72
76
  "eslint-plugin-jsonc": "^2.20.1",
73
77
  "eslint-plugin-n": "^17.21.3",
74
78
  "eslint-plugin-no-only-tests": "^3.3.0",
@@ -84,11 +88,13 @@
84
88
  "globals": "^16.3.0",
85
89
  "jsonc-eslint-parser": "^2.4.0",
86
90
  "local-pkg": "^1.1.1",
91
+ "pathe": "^2.0.3",
87
92
  "toml-eslint-parser": "^0.10.0",
88
93
  "vue-eslint-parser": "^10.2.0",
89
94
  "yaml-eslint-parser": "^1.3.0"
90
95
  },
91
96
  "devDependencies": {
97
+ "@adonisjs/eslint-plugin": "^2.0.0",
92
98
  "@commitlint/cli": "^19.8.1",
93
99
  "@commitlint/config-conventional": "^19.8.1",
94
100
  "@eslint/config-inspector": "^1.1.0",
@@ -103,9 +109,9 @@
103
109
  "husky": "^9.1.7",
104
110
  "np": "^10.2.0",
105
111
  "prettier-plugin-astro": "^0.14.1",
106
- "tsdown": "^0.13.0",
112
+ "tsdown": "^0.13.1",
107
113
  "tsx": "^4.20.3",
108
- "typescript": "^5.8.3"
114
+ "typescript": ">=4.8.4 <5.9.0"
109
115
  },
110
116
  "resolutions": {
111
117
  "eslint": "catalog:peer"