@eienjs/eslint-config 1.3.0 → 1.4.1

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.
@@ -3,7 +3,7 @@ const versionsMap = {
3
3
  "@adonisjs/eslint-plugin": "^2.0.1",
4
4
  "@nuxt/eslint-plugin": "^1.9.0",
5
5
  "astro-eslint-parser": "^1.2.2",
6
- "eslint": "^9.36.0",
6
+ "eslint": "^9.37.0",
7
7
  "eslint-plugin-astro": "^1.3.1",
8
8
  "eslint-plugin-format": "^1.0.2",
9
9
  "prettier-plugin-astro": "^0.14.1"
@@ -18,8 +18,7 @@ async function updateEslintFiles(result) {
18
18
  const eslintIgnores = [];
19
19
  if (fs.existsSync(pathESLintIgnore)) {
20
20
  p.log.step(c.cyan`Migrating existing .eslintignore`);
21
- const content = await fsp.readFile(pathESLintIgnore, "utf8");
22
- const globs = parse(content).globs();
21
+ const globs = parse(await fsp.readFile(pathESLintIgnore, "utf8")).globs();
23
22
  for (const glob of globs) if (glob.type === "ignore") eslintIgnores.push(...glob.patterns);
24
23
  else if (glob.type === "unignore") eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
25
24
  }
@@ -27,8 +26,7 @@ async function updateEslintFiles(result) {
27
26
  if (eslintIgnores.length > 0) configLines.push(`ignores: ${JSON.stringify(eslintIgnores)},`);
28
27
  if (result.extra.includes("formatter")) configLines.push("formatters: true,");
29
28
  for (const framework of result.frameworks) configLines.push(`${framework}: true,`);
30
- const mainConfig = configLines.map((i) => ` ${i}`).join("\n");
31
- const eslintConfigContent = getEslintConfigContent(mainConfig);
29
+ const eslintConfigContent = getEslintConfigContent(configLines.map((i) => ` ${i}`).join("\n"));
32
30
  await fsp.writeFile(pathFlatConfig, eslintConfigContent);
33
31
  p.log.success(c.green`Created ${configFileName}`);
34
32
  const files = fs.readdirSync(cwd);
@@ -1,6 +1,6 @@
1
- import { OptionsComponentExts, OptionsFiles, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, TypedFlatConfigItem } from "../types.js";
1
+ import { OptionsComponentExts, OptionsFiles, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescriptWithErasableSyntaxOnly, TypedFlatConfigItem } from "../types.js";
2
2
 
3
3
  //#region src/configs/typescript.d.ts
4
- declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsStylistic): Promise<TypedFlatConfigItem[]>;
4
+ declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsTypescriptWithErasableSyntaxOnly & OptionsStylistic): Promise<TypedFlatConfigItem[]>;
5
5
  //#endregion
6
6
  export { typescript };
@@ -1,11 +1,11 @@
1
1
  import { GLOB_ASTRO_TS, GLOB_MARKDOWN, GLOB_TS, GLOB_TSX } from "../globs.js";
2
- import { interopDefault } from "../utils.js";
2
+ import { ensurePackages, interopDefault } from "../utils.js";
3
3
  import { pluginAntfu } from "../plugins.js";
4
4
  import process from "node:process";
5
5
 
6
6
  //#region src/configs/typescript.ts
7
7
  async function typescript(options = {}) {
8
- const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, stylistic = true } = options;
8
+ const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, stylistic = true, erasableSyntaxOnly = false } = options;
9
9
  const files = options.files ?? [
10
10
  GLOB_TS,
11
11
  GLOB_TSX,
@@ -15,6 +15,7 @@ async function typescript(options = {}) {
15
15
  const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS];
16
16
  const tsconfigPath = options.tsconfigPath ?? void 0;
17
17
  const isTypeAware = Boolean(tsconfigPath);
18
+ const isErasableSyntaxOnly = Boolean(erasableSyntaxOnly);
18
19
  const typeAwareRules = {
19
20
  "dot-notation": "off",
20
21
  "no-implied-eval": "off",
@@ -94,7 +95,6 @@ async function typescript(options = {}) {
94
95
  "@typescript-eslint/restrict-template-expressions": "error",
95
96
  "@typescript-eslint/return-await": ["error", "in-try-catch"],
96
97
  "@typescript-eslint/switch-exhaustiveness-check": ["error", { considerDefaultExhaustiveForUnions: true }],
97
- "@typescript-eslint/no-empty-object-type": "off",
98
98
  "@typescript-eslint/no-unused-vars": ["error", {
99
99
  "args": "all",
100
100
  "argsIgnorePattern": "^_",
@@ -103,8 +103,7 @@ async function typescript(options = {}) {
103
103
  "destructuredArrayIgnorePattern": "^_",
104
104
  "varsIgnorePattern": "^_",
105
105
  "ignoreRestSiblings": true
106
- }],
107
- "@typescript-eslint/no-non-null-assertion": "off"
106
+ }]
108
107
  };
109
108
  const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
110
109
  function makeParser(typeAware, files$1, ignores) {
@@ -129,84 +128,108 @@ async function typescript(options = {}) {
129
128
  name: `eienjs/typescript/${typeAware ? "type-aware-parser" : "parser"}`
130
129
  };
131
130
  }
132
- return [
133
- {
134
- name: "eienjs/typescript/setup",
135
- plugins: {
136
- "antfu": pluginAntfu,
137
- "@typescript-eslint": pluginTs
138
- }
139
- },
140
- ...isTypeAware ? [makeParser(false, files), makeParser(true, filesTypeAware, ignoresTypeAware)] : [makeParser(false, files)],
141
- {
131
+ const rules = [{
132
+ name: "eienjs/typescript/setup",
133
+ plugins: {
134
+ "antfu": pluginAntfu,
135
+ "@typescript-eslint": pluginTs
136
+ }
137
+ }];
138
+ if (isTypeAware) rules.push(makeParser(false, files), makeParser(true, filesTypeAware, ignoresTypeAware));
139
+ else rules.push(makeParser(false, files));
140
+ rules.push({
141
+ files,
142
+ name: "eienjs/typescript/rules",
143
+ rules: {
144
+ ...pluginTs.configs["eslint-recommended"].overrides?.[0].rules,
145
+ ...pluginTs.configs.strict.rules,
146
+ ...stylistic ? pluginTs.configs.stylistic.rules : {},
147
+ "no-dupe-class-members": "off",
148
+ "no-redeclare": "off",
149
+ "no-use-before-define": "off",
150
+ "no-useless-constructor": "off",
151
+ "@typescript-eslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
152
+ "@typescript-eslint/consistent-type-assertions": "error",
153
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
154
+ "@typescript-eslint/consistent-type-imports": ["error", {
155
+ disallowTypeAnnotations: false,
156
+ fixStyle: "separate-type-imports",
157
+ prefer: "type-imports"
158
+ }],
159
+ "@typescript-eslint/default-param-last": "error",
160
+ "@typescript-eslint/method-signature-style": ["error", "property"],
161
+ "@typescript-eslint/no-dupe-class-members": "error",
162
+ "@typescript-eslint/no-dynamic-delete": "off",
163
+ "@typescript-eslint/no-explicit-any": "off",
164
+ "@typescript-eslint/no-import-type-side-effects": "error",
165
+ "@typescript-eslint/no-invalid-void-type": "off",
166
+ "@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
167
+ "@typescript-eslint/no-require-imports": "error",
168
+ "@typescript-eslint/no-unused-expressions": ["error", {
169
+ allowShortCircuit: true,
170
+ allowTaggedTemplates: true,
171
+ allowTernary: true
172
+ }],
173
+ "@typescript-eslint/no-unused-vars": ["error", {
174
+ "args": "all",
175
+ "argsIgnorePattern": "^_",
176
+ "caughtErrors": "all",
177
+ "caughtErrorsIgnorePattern": "^_",
178
+ "destructuredArrayIgnorePattern": "^_",
179
+ "varsIgnorePattern": "^_",
180
+ "ignoreRestSiblings": true
181
+ }],
182
+ "@typescript-eslint/no-use-before-define": ["error", {
183
+ classes: false,
184
+ functions: false,
185
+ variables: true
186
+ }],
187
+ "@typescript-eslint/no-useless-constructor": "off",
188
+ "@typescript-eslint/no-wrapper-object-types": "error",
189
+ "@typescript-eslint/triple-slash-reference": "off",
190
+ "@typescript-eslint/unified-signatures": "off",
191
+ ...overrides
192
+ }
193
+ });
194
+ if (isTypeAware) rules.push({
195
+ files: filesTypeAware,
196
+ ignores: ignoresTypeAware,
197
+ name: "eienjs/typescript/rules-type-aware",
198
+ rules: {
199
+ ...pluginTs.configs["strict-type-checked"].rules,
200
+ ...stylistic ? pluginTs.configs["stylistic-type-checked"].rules : {},
201
+ ...typeAwareRules,
202
+ ...overridesTypeAware
203
+ }
204
+ });
205
+ rules.push({
206
+ files: isTypeAware ? filesTypeAware : files,
207
+ name: "eienjs/typescript/disables",
208
+ rules: {
209
+ "@typescript-eslint/no-empty-object-type": "off",
210
+ "@typescript-eslint/no-extraneous-class": "off",
211
+ "@typescript-eslint/no-non-null-assertion": "off"
212
+ }
213
+ });
214
+ if (isErasableSyntaxOnly) {
215
+ await ensurePackages(["eslint-plugin-erasable-syntax-only"]);
216
+ const pluginErasableSyntaxOnly = await interopDefault(import("eslint-plugin-erasable-syntax-only"));
217
+ const resolvedErasableSyntaxOnly = typeof erasableSyntaxOnly === "boolean" ? {} : erasableSyntaxOnly;
218
+ const enums = resolvedErasableSyntaxOnly.enums ?? true;
219
+ const parameterProperties = resolvedErasableSyntaxOnly.parameterProperties ?? true;
220
+ rules.push({
142
221
  files,
143
- name: "eienjs/typescript/rules",
144
- rules: {
145
- ...pluginTs.configs["eslint-recommended"].overrides?.[0].rules,
146
- ...pluginTs.configs.strict.rules,
147
- ...stylistic ? pluginTs.configs.stylistic.rules : {},
148
- "no-dupe-class-members": "off",
149
- "no-redeclare": "off",
150
- "no-use-before-define": "off",
151
- "no-useless-constructor": "off",
152
- "@typescript-eslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
153
- "@typescript-eslint/consistent-type-assertions": "error",
154
- "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
155
- "@typescript-eslint/consistent-type-imports": ["error", {
156
- disallowTypeAnnotations: false,
157
- fixStyle: "separate-type-imports",
158
- prefer: "type-imports"
159
- }],
160
- "@typescript-eslint/default-param-last": "error",
161
- "@typescript-eslint/method-signature-style": ["error", "property"],
162
- "@typescript-eslint/no-dupe-class-members": "error",
163
- "@typescript-eslint/no-dynamic-delete": "off",
164
- "@typescript-eslint/no-empty-object-type": "off",
165
- "@typescript-eslint/no-explicit-any": "off",
166
- "@typescript-eslint/no-extraneous-class": "off",
167
- "@typescript-eslint/no-import-type-side-effects": "error",
168
- "@typescript-eslint/no-invalid-void-type": "off",
169
- "@typescript-eslint/no-non-null-assertion": "off",
170
- "@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
171
- "@typescript-eslint/no-require-imports": "error",
172
- "@typescript-eslint/no-unused-expressions": ["error", {
173
- allowShortCircuit: true,
174
- allowTaggedTemplates: true,
175
- allowTernary: true
176
- }],
177
- "@typescript-eslint/no-unused-vars": ["error", {
178
- "args": "all",
179
- "argsIgnorePattern": "^_",
180
- "caughtErrors": "all",
181
- "caughtErrorsIgnorePattern": "^_",
182
- "destructuredArrayIgnorePattern": "^_",
183
- "varsIgnorePattern": "^_",
184
- "ignoreRestSiblings": true
185
- }],
186
- "@typescript-eslint/no-use-before-define": ["error", {
187
- classes: false,
188
- functions: false,
189
- variables: true
190
- }],
191
- "@typescript-eslint/no-useless-constructor": "off",
192
- "@typescript-eslint/no-wrapper-object-types": "error",
193
- "@typescript-eslint/triple-slash-reference": "off",
194
- "@typescript-eslint/unified-signatures": "off",
195
- ...overrides
196
- }
197
- },
198
- ...isTypeAware ? [{
199
- files: filesTypeAware,
200
- ignores: ignoresTypeAware,
201
- name: "eienjs/typescript/rules-type-aware",
222
+ name: "eienjs/typescript/erasable-syntax-only",
223
+ plugins: { "erasable-syntax-only": pluginErasableSyntaxOnly },
202
224
  rules: {
203
- ...pluginTs.configs["strict-type-checked"].rules,
204
- ...stylistic ? pluginTs.configs["stylistic-type-checked"].rules : {},
205
- ...typeAwareRules,
206
- ...overridesTypeAware
225
+ "erasable-syntax-only/enums": enums ? "error" : "off",
226
+ "erasable-syntax-only/import-aliases": "error",
227
+ "erasable-syntax-only/namespaces": "error",
228
+ "erasable-syntax-only/parameter-properties": parameterProperties ? "error" : "off"
207
229
  }
208
- }] : []
209
- ];
230
+ });
231
+ }
232
+ return rules;
210
233
  }
211
234
 
212
235
  //#endregion
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ConfigNames } from "./typegen.js";
2
- import { Awaitable, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVue, Rules, StylisticConfig, TypedFlatConfigItem } from "./types.js";
2
+ import { Awaitable, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, Rules, StylisticConfig, TypedFlatConfigItem } from "./types.js";
3
3
  import { ResolvedOptions, defaultPluginRenaming, eienjs, getOverrides, resolveSubOptions } from "./factory.js";
4
4
  import { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, 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 } from "./globs.js";
5
5
  import { combine, ensurePackages, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, toArray } from "./utils.js";
6
- export { Awaitable, ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, 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, OptionsNuxt, 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 };
6
+ export { Awaitable, ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, 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, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, ResolvedOptions, Rules, StylisticConfig, TypedFlatConfigItem, combine, eienjs as default, defaultPluginRenaming, eienjs, ensurePackages, getOverrides, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, resolveSubOptions, toArray };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "1.3.0";
2
+ var version = "1.4.1";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/dist/typegen.d.ts CHANGED
@@ -957,7 +957,7 @@ interface RuleOptions {
957
957
  * Disallow member access on a value with type `any`
958
958
  * @see https://typescript-eslint.io/rules/no-unsafe-member-access
959
959
  */
960
- '@typescript-eslint/no-unsafe-member-access'?: Linter.RuleEntry<[]>;
960
+ '@typescript-eslint/no-unsafe-member-access'?: Linter.RuleEntry<TypescriptEslintNoUnsafeMemberAccess>;
961
961
  /**
962
962
  * Disallow returning a value with type `any` from a function
963
963
  * @see https://typescript-eslint.io/rules/no-unsafe-return
@@ -1914,6 +1914,11 @@ interface RuleOptions {
1914
1914
  * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/empty-tags.md#repos-sticky-header
1915
1915
  */
1916
1916
  'jsdoc/empty-tags'?: Linter.RuleEntry<JsdocEmptyTags>;
1917
+ /**
1918
+ * Reports use of JSDoc tags in non-tag positions (in the default "typescript" mode).
1919
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/escape-inline-tags.md#repos-sticky-header
1920
+ */
1921
+ 'jsdoc/escape-inline-tags'?: Linter.RuleEntry<JsdocEscapeInlineTags>;
1917
1922
  /**
1918
1923
  * Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors).
1919
1924
  * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/implements-on-classes.md#repos-sticky-header
@@ -1994,6 +1999,11 @@ interface RuleOptions {
1994
1999
  * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md#repos-sticky-header
1995
2000
  */
1996
2001
  'jsdoc/no-undefined-types'?: Linter.RuleEntry<JsdocNoUndefinedTypes>;
2002
+ /**
2003
+ * Prefer `@import` tags to inline `import()` statements.
2004
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/prefer-import-tag.md#repos-sticky-header
2005
+ */
2006
+ 'jsdoc/prefer-import-tag'?: Linter.RuleEntry<JsdocPreferImportTag>;
1997
2007
  /**
1998
2008
  * Reports use of `any` or `*` type
1999
2009
  * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/reject-any-type.md#repos-sticky-header
@@ -2119,6 +2129,11 @@ interface RuleOptions {
2119
2129
  * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header
2120
2130
  */
2121
2131
  'jsdoc/require-template'?: Linter.RuleEntry<JsdocRequireTemplate>;
2132
+ /**
2133
+ * Requires a description for `@template` tags
2134
+ * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template-description.md#repos-sticky-header
2135
+ */
2136
+ 'jsdoc/require-template-description'?: Linter.RuleEntry<[]>;
2122
2137
  /**
2123
2138
  * Requires that throw statements are documented with `@throws` tags.
2124
2139
  * @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-throws.md#repos-sticky-header
@@ -4638,6 +4653,11 @@ interface RuleOptions {
4638
4653
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-test-blocks.md
4639
4654
  */
4640
4655
  'test/padding-around-test-blocks'?: Linter.RuleEntry<[]>;
4656
+ /**
4657
+ * Prefer `toHaveBeenCalledExactlyOnceWith` over `toHaveBeenCalledOnce` and `toHaveBeenCalledWith`
4658
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-exactly-once-with.md
4659
+ */
4660
+ 'test/prefer-called-exactly-once-with'?: Linter.RuleEntry<[]>;
4641
4661
  /**
4642
4662
  * enforce using `toBeCalledOnce()` or `toHaveBeenCalledOnce()`
4643
4663
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-once.md
@@ -4698,6 +4718,11 @@ interface RuleOptions {
4698
4718
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
4699
4719
  */
4700
4720
  'test/prefer-hooks-on-top'?: Linter.RuleEntry<[]>;
4721
+ /**
4722
+ * prefer dynamic import in mock
4723
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-import-in-mock.md
4724
+ */
4725
+ 'test/prefer-import-in-mock'?: Linter.RuleEntry<[]>;
4701
4726
  /**
4702
4727
  * enforce importing Vitest globals
4703
4728
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-importing-vitest-globals.md
@@ -8980,6 +9005,10 @@ type TypescriptEslintNoUnnecessaryTypeAssertion = [] | [{
8980
9005
  checkLiteralConstAssertions?: boolean;
8981
9006
  typesToIgnore?: string[];
8982
9007
  }];
9008
+ // ----- @typescript-eslint/no-unsafe-member-access -----
9009
+ type TypescriptEslintNoUnsafeMemberAccess = [] | [{
9010
+ allowOptionalChaining?: boolean;
9011
+ }];
8983
9012
  // ----- @typescript-eslint/no-unused-expressions -----
8984
9013
  type TypescriptEslintNoUnusedExpressions = [] | [{
8985
9014
  allowShortCircuit?: boolean;
@@ -8997,6 +9026,7 @@ type TypescriptEslintNoUnusedVars = [] | [(("all" | "local") | {
8997
9026
  destructuredArrayIgnorePattern?: string;
8998
9027
  ignoreClassWithStaticInitBlock?: boolean;
8999
9028
  ignoreRestSiblings?: boolean;
9029
+ ignoreUsingDeclarations?: boolean;
9000
9030
  reportUsedIgnorePattern?: boolean;
9001
9031
  vars?: ("all" | "local");
9002
9032
  varsIgnorePattern?: string;
@@ -9651,6 +9681,7 @@ type JsdocCheckPropertyNames = [] | [{
9651
9681
  type JsdocCheckTagNames = [] | [{
9652
9682
  definedTags?: string[];
9653
9683
  enableFixer?: boolean;
9684
+ inlineTags?: string[];
9654
9685
  jsxTags?: boolean;
9655
9686
  typed?: boolean;
9656
9687
  }];
@@ -9693,6 +9724,12 @@ type JsdocConvertToJsdocComments = [] | [{
9693
9724
  type JsdocEmptyTags = [] | [{
9694
9725
  tags?: string[];
9695
9726
  }];
9727
+ // ----- jsdoc/escape-inline-tags -----
9728
+ type JsdocEscapeInlineTags = [] | [{
9729
+ allowedInlineTags?: string[];
9730
+ enableFixer?: boolean;
9731
+ fixType?: ("backticks" | "backslash");
9732
+ }];
9696
9733
  // ----- jsdoc/implements-on-classes -----
9697
9734
  type JsdocImplementsOnClasses = [] | [{
9698
9735
  contexts?: (string | {
@@ -9809,10 +9846,17 @@ type JsdocNoTypes = [] | [{
9809
9846
  }];
9810
9847
  // ----- jsdoc/no-undefined-types -----
9811
9848
  type JsdocNoUndefinedTypes = [] | [{
9849
+ checkUsedTypedefs?: boolean;
9812
9850
  definedTypes?: string[];
9813
9851
  disableReporting?: boolean;
9814
9852
  markVariablesAsUsed?: boolean;
9815
9853
  }];
9854
+ // ----- jsdoc/prefer-import-tag -----
9855
+ type JsdocPreferImportTag = [] | [{
9856
+ enableFixer?: boolean;
9857
+ exemptTypedefs?: boolean;
9858
+ outputType?: ("named-import" | "namespaced-import");
9859
+ }];
9816
9860
  // ----- jsdoc/require-asterisk-prefix -----
9817
9861
  type JsdocRequireAsteriskPrefix = [] | [("always" | "never" | "any")] | [("always" | "never" | "any"), {
9818
9862
  tags?: {
@@ -9972,6 +10016,7 @@ type JsdocRequireReturns = [] | [{
9972
10016
  type JsdocRequireReturnsCheck = [] | [{
9973
10017
  exemptAsync?: boolean;
9974
10018
  exemptGenerators?: boolean;
10019
+ noNativeTypes?: boolean;
9975
10020
  reportMissingReturnForUndefinedTypes?: boolean;
9976
10021
  }];
9977
10022
  // ----- jsdoc/require-returns-description -----
@@ -10063,13 +10108,29 @@ type JsdocTextEscaping = [] | [{
10063
10108
  // ----- jsdoc/type-formatting -----
10064
10109
  type JsdocTypeFormatting = [] | [{
10065
10110
  arrayBrackets?: ("angle" | "square");
10111
+ arrowFunctionPostReturnMarkerSpacing?: string;
10112
+ arrowFunctionPreReturnMarkerSpacing?: string;
10066
10113
  enableFixer?: boolean;
10114
+ functionOrClassParameterSpacing?: string;
10115
+ functionOrClassPostGenericSpacing?: string;
10116
+ functionOrClassPostReturnMarkerSpacing?: string;
10117
+ functionOrClassPreReturnMarkerSpacing?: string;
10118
+ functionOrClassTypeParameterSpacing?: string;
10119
+ genericAndTupleElementSpacing?: string;
10067
10120
  genericDot?: boolean;
10121
+ keyValuePostColonSpacing?: string;
10122
+ keyValuePostKeySpacing?: string;
10123
+ keyValuePostOptionalSpacing?: string;
10124
+ keyValuePostVariadicSpacing?: string;
10125
+ methodQuotes?: ("double" | "single");
10068
10126
  objectFieldIndent?: string;
10069
10127
  objectFieldQuote?: ("double" | "single" | null);
10070
10128
  objectFieldSeparator?: ("comma" | "comma-and-linebreak" | "linebreak" | "semicolon" | "semicolon-and-linebreak");
10071
10129
  objectFieldSeparatorOptionalLinebreak?: boolean;
10072
10130
  objectFieldSeparatorTrailingPunctuation?: boolean;
10131
+ parameterDefaultValueSpacing?: string;
10132
+ postMethodNameSpacing?: string;
10133
+ postNewSpacing?: string;
10073
10134
  separatorForSingleObjectField?: boolean;
10074
10135
  stringQuotes?: ("double" | "single");
10075
10136
  typeBracketSpacing?: string;
@@ -11418,12 +11479,14 @@ type NoRestrictedImports = ((string | {
11418
11479
  message?: string;
11419
11480
  importNames?: string[];
11420
11481
  allowImportNames?: string[];
11482
+ allowTypeImports?: boolean;
11421
11483
  })[] | [] | [{
11422
11484
  paths?: (string | {
11423
11485
  name: string;
11424
11486
  message?: string;
11425
11487
  importNames?: string[];
11426
11488
  allowImportNames?: string[];
11489
+ allowTypeImports?: boolean;
11427
11490
  })[];
11428
11491
  patterns?: (string[] | ({
11429
11492
  [k: string]: unknown | undefined;
@@ -14131,6 +14194,7 @@ type UnusedImportsNoUnusedImports = [] | [(("all" | "local") | {
14131
14194
  destructuredArrayIgnorePattern?: string;
14132
14195
  ignoreClassWithStaticInitBlock?: boolean;
14133
14196
  ignoreRestSiblings?: boolean;
14197
+ ignoreUsingDeclarations?: boolean;
14134
14198
  reportUsedIgnorePattern?: boolean;
14135
14199
  vars?: ("all" | "local");
14136
14200
  varsIgnorePattern?: string;
@@ -14144,6 +14208,7 @@ type UnusedImportsNoUnusedVars = [] | [(("all" | "local") | {
14144
14208
  destructuredArrayIgnorePattern?: string;
14145
14209
  ignoreClassWithStaticInitBlock?: boolean;
14146
14210
  ignoreRestSiblings?: boolean;
14211
+ ignoreUsingDeclarations?: boolean;
14147
14212
  reportUsedIgnorePattern?: boolean;
14148
14213
  vars?: ("all" | "local");
14149
14214
  varsIgnorePattern?: string;
@@ -15566,6 +15631,6 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
15566
15631
  onlyEquality?: boolean;
15567
15632
  }];
15568
15633
  // Names of all the configs
15569
- 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/adonisjs/tests-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/nuxt/setup' | 'eienjs/nuxt/vue/single-root' | 'eienjs/nuxt/rules' | 'eienjs/nuxt/utils-disables' | 'eienjs/nuxt/sort-config' | 'eienjs/nuxt/vue/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/unicorn/special-rules' | 'eienjs/vue/setup' | 'eienjs/vue/rules' | 'eienjs/vue/composables-disables' | 'eienjs/yaml/setup' | 'eienjs/yaml/rules' | 'eienjs/yaml/pnpm-workspace';
15634
+ 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/adonisjs/tests-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/nuxt/setup' | 'eienjs/nuxt/vue/single-root' | 'eienjs/nuxt/rules' | 'eienjs/nuxt/utils-disables' | 'eienjs/nuxt/sort-config' | 'eienjs/nuxt/vue/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/typescript/disables' | 'eienjs/unicorn/rules' | 'eienjs/unicorn/special-rules' | 'eienjs/vue/setup' | 'eienjs/vue/rules' | 'eienjs/vue/composables-disables' | 'eienjs/yaml/setup' | 'eienjs/yaml/rules' | 'eienjs/yaml/pnpm-workspace';
15570
15635
  //#endregion
15571
15636
  export { ConfigNames, RuleOptions };
package/dist/types.d.ts CHANGED
@@ -28,6 +28,20 @@ type TypedFlatConfigItem = Omit<Linter.Config, 'plugins' | 'rules'> & {
28
28
  */
29
29
  rules?: Rules;
30
30
  };
31
+ interface OptionsErasableSyntaxOnly {
32
+ /**
33
+ * Enable/disable erasable syntax only rules for enums.
34
+ *
35
+ * @default true when `erableSyntaxOnly` is enabled
36
+ */
37
+ enums?: boolean;
38
+ /**
39
+ * Enable/disable erasable syntax only rules for parameter properties.
40
+ *
41
+ * @default true when `erableSyntaxOnly` is enabled
42
+ */
43
+ parameterProperties?: boolean;
44
+ }
31
45
  interface OptionsNuxt extends OptionsOverrides {
32
46
  /**
33
47
  * Version of Nuxt
@@ -146,7 +160,7 @@ interface OptionsVue extends OptionsOverrides {
146
160
  */
147
161
  componentNameInTemplateCasingGlobals?: string[];
148
162
  }
149
- type OptionsTypescript = (OptionsTypeScriptWithTypes & OptionsOverrides) | (OptionsTypeScriptParserOptions & OptionsOverrides);
163
+ type OptionsTypescript = (OptionsTypeScriptWithTypes & OptionsOverrides & OptionsTypescriptWithErasableSyntaxOnly) | (OptionsTypeScriptParserOptions & OptionsOverrides & OptionsTypescriptWithErasableSyntaxOnly);
150
164
  interface OptionsFormatters {
151
165
  /**
152
166
  * Enable formatting support for CSS, Less, Sass, and SCSS.
@@ -218,6 +232,14 @@ interface OptionsTypeScriptParserOptions {
218
232
  */
219
233
  ignoresTypeAware?: string[];
220
234
  }
235
+ interface OptionsTypescriptWithErasableSyntaxOnly {
236
+ /**
237
+ * Enable erasable syntax only rules.
238
+ *
239
+ * @default false
240
+ */
241
+ erasableSyntaxOnly?: boolean | OptionsErasableSyntaxOnly;
242
+ }
221
243
  interface OptionsTypeScriptWithTypes {
222
244
  /**
223
245
  * When this options is provided, type aware rules will be enabled.
@@ -401,4 +423,4 @@ interface OptionsConfig extends OptionsComponentExts {
401
423
  nuxt?: boolean | OptionsNuxt;
402
424
  }
403
425
  //#endregion
404
- export { Awaitable, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVue, Rules, StylisticConfig, TypedFlatConfigItem };
426
+ export { Awaitable, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, 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": "1.3.0",
4
+ "version": "1.4.1",
5
5
  "description": "EienJS ESLint Config",
6
6
  "author": "Fernando Isidro <luffynando@gmail.com> (https://github.com/luffynando/)",
7
7
  "license": "MIT",
@@ -40,8 +40,9 @@
40
40
  "@nuxt/eslint-plugin": "^1.9.0",
41
41
  "@prettier/plugin-xml": "^3.4.2",
42
42
  "astro-eslint-parser": "^1.2.2",
43
- "eslint": "^9.36.0",
43
+ "eslint": "^9.37.0",
44
44
  "eslint-plugin-astro": "^1.3.1",
45
+ "eslint-plugin-erasable-syntax-only": "^0.3.1",
45
46
  "eslint-plugin-format": "^1.0.2",
46
47
  "prettier-plugin-astro": "^0.14.1"
47
48
  },
@@ -61,6 +62,9 @@
61
62
  "eslint-plugin-astro": {
62
63
  "optional": true
63
64
  },
65
+ "eslint-plugin-erasable-syntax-only": {
66
+ "optional": true
67
+ },
64
68
  "eslint-plugin-format": {
65
69
  "optional": true
66
70
  },
@@ -72,12 +76,12 @@
72
76
  "@antfu/install-pkg": "^1.1.0",
73
77
  "@clack/prompts": "^0.11.0",
74
78
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
75
- "@eslint/markdown": "^7.3.0",
79
+ "@eslint/markdown": "^7.4.0",
76
80
  "@stylistic/eslint-plugin": "^5.4.0",
77
- "@typescript-eslint/eslint-plugin": "^8.44.1",
78
- "@typescript-eslint/parser": "^8.44.1",
79
- "@vitest/eslint-plugin": "^1.3.12",
80
- "ansis": "^4.1.0",
81
+ "@typescript-eslint/eslint-plugin": "^8.46.0",
82
+ "@typescript-eslint/parser": "^8.46.0",
83
+ "@vitest/eslint-plugin": "^1.3.16",
84
+ "ansis": "^4.2.0",
81
85
  "cac": "^6.7.14",
82
86
  "eslint-config-flat-gitignore": "^2.1.0",
83
87
  "eslint-flat-config-utils": "^2.1.4",
@@ -85,18 +89,18 @@
85
89
  "eslint-plugin-antfu": "^3.1.1",
86
90
  "eslint-plugin-command": "^3.3.1",
87
91
  "eslint-plugin-import-lite": "^0.3.0",
88
- "eslint-plugin-jsdoc": "^60.1.1",
89
- "eslint-plugin-jsonc": "^2.20.1",
92
+ "eslint-plugin-jsdoc": "^61.0.1",
93
+ "eslint-plugin-jsonc": "^2.21.0",
90
94
  "eslint-plugin-n": "^17.23.1",
91
95
  "eslint-plugin-no-only-tests": "^3.3.0",
92
- "eslint-plugin-perfectionist": "^4.15.0",
93
- "eslint-plugin-pnpm": "^1.1.1",
96
+ "eslint-plugin-perfectionist": "^4.15.1",
97
+ "eslint-plugin-pnpm": "^1.2.0",
94
98
  "eslint-plugin-regexp": "^2.10.0",
95
99
  "eslint-plugin-toml": "^0.12.0",
96
100
  "eslint-plugin-unicorn": "^61.0.2",
97
101
  "eslint-plugin-unused-imports": "^4.2.0",
98
102
  "eslint-plugin-vue": "^10.5.0",
99
- "eslint-plugin-yml": "^1.18.0",
103
+ "eslint-plugin-yml": "^1.19.0",
100
104
  "eslint-processor-vue-blocks": "^2.0.0",
101
105
  "globals": "^16.4.0",
102
106
  "jsonc-eslint-parser": "^2.4.1",
@@ -109,24 +113,25 @@
109
113
  },
110
114
  "devDependencies": {
111
115
  "@adonisjs/eslint-plugin": "^2.0.1",
112
- "@commitlint/cli": "^19.8.1",
113
- "@commitlint/config-conventional": "^19.8.1",
116
+ "@commitlint/cli": "^20.1.0",
117
+ "@commitlint/config-conventional": "^20.0.0",
114
118
  "@eslint/config-inspector": "^1.3.0",
115
119
  "@nuxt/eslint-plugin": "^1.9.0",
116
120
  "@prettier/plugin-xml": "^3.4.2",
117
- "@types/node": "^22.18.6",
121
+ "@types/node": "^22.18.9",
118
122
  "astro-eslint-parser": "^1.2.2",
119
123
  "auto-changelog": "^2.5.0",
120
- "eslint": "^9.36.0",
124
+ "eslint": "^9.37.0",
121
125
  "eslint-plugin-astro": "^1.3.1",
126
+ "eslint-plugin-erasable-syntax-only": "^0.3.1",
122
127
  "eslint-plugin-format": "^1.0.2",
123
128
  "eslint-typegen": "^2.3.0",
124
129
  "husky": "^9.1.7",
125
130
  "np": "^10.2.0",
126
131
  "prettier-plugin-astro": "^0.14.1",
127
- "tsdown": "0.15.1",
128
- "tsx": "^4.20.5",
129
- "typescript": "^5.9.2"
132
+ "tsdown": "0.15.6",
133
+ "tsx": "^4.20.6",
134
+ "typescript": "^5.9.3"
130
135
  },
131
136
  "resolutions": {
132
137
  "eslint": "catalog:peer"