@open-turo/eslint-config-typescript 18.1.0-pr-440.293.1.1 → 18.1.0-pr-440.295.1.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.
package/index.cjs CHANGED
@@ -12,6 +12,7 @@ const perfectionistPlugin = require("eslint-plugin-perfectionist");
12
12
  const prettierPluginRecommended = require("eslint-plugin-prettier/recommended");
13
13
  const sonarjsPlugin = require("eslint-plugin-sonarjs");
14
14
  const unicornPlugin = require("eslint-plugin-unicorn");
15
+ const eslintConfig = require("eslint/config");
15
16
  const tseslint = require("typescript-eslint");
16
17
 
17
18
  const FILES_JS = "**/*.?([cm])js";
@@ -40,7 +41,7 @@ const typescriptLanguageOptions = () => ({
40
41
  * @param {EcmaVersion} [ecmaVersion]
41
42
  */
42
43
  const javascriptConfig = (ecmaVersion = "latest") =>
43
- tseslint.config(eslint.configs.recommended, {
44
+ eslintConfig.defineConfig(eslint.configs.recommended, {
44
45
  files: [FILES_JS],
45
46
  languageOptions: {
46
47
  parserOptions: {
@@ -60,7 +61,7 @@ const getImportPluginFlatConfigs = () => {
60
61
  };
61
62
 
62
63
  const importConfig = () =>
63
- tseslint.config({
64
+ eslintConfig.defineConfig({
64
65
  extends: [getImportPluginFlatConfigs().recommended],
65
66
  rules: {
66
67
  "import/default": "off",
@@ -83,7 +84,7 @@ const importConfig = () =>
83
84
  });
84
85
 
85
86
  const nPluginConfig = (allowModules = ["@jest/globals", "nock"]) =>
86
- tseslint.config({
87
+ eslintConfig.defineConfig({
87
88
  extends: [
88
89
  nPlugin.configs["flat/recommended"],
89
90
  nPlugin.configs["flat/mixed-esm-and-cjs"],
@@ -101,7 +102,7 @@ const nPluginConfig = (allowModules = ["@jest/globals", "nock"]) =>
101
102
  });
102
103
 
103
104
  const sonarJsConfig = () =>
104
- tseslint.config({
105
+ eslintConfig.defineConfig({
105
106
  extends: [sonarjsPlugin.configs.recommended],
106
107
  rules: {
107
108
  // Noisy rule - we may have helpers/methods that we mark as @deprecated but aren't planning to remove in the near future. This rule also significantly adds to eslint running time, which slows down both local development and CI.
@@ -128,7 +129,7 @@ const sonarJsConfig = () =>
128
129
  });
129
130
 
130
131
  const typescriptConfig = () =>
131
- tseslint.config({
132
+ eslintConfig.defineConfig({
132
133
  extends: [
133
134
  tseslint.configs.recommendedTypeChecked,
134
135
  // @ts-expect-error -- We are inferring the types of this import from runtime, but the rule values are inferred as `string` instead of `RuleEntry` ("off" | "warn" | "error")
@@ -191,7 +192,7 @@ const jestTestConfig = (options) => {
191
192
  "jest/unbound-method": "error",
192
193
  })
193
194
  : {};
194
- return tseslint.config({
195
+ return eslintConfig.defineConfig({
195
196
  extends: [jestPlugin.configs["flat/recommended"]],
196
197
  files: FILES_TEST,
197
198
  languageOptions: {
@@ -202,22 +203,18 @@ const jestTestConfig = (options) => {
202
203
  rules: {
203
204
  ...jestPlugin.configs["flat/recommended"].rules,
204
205
  ...typescriptRules,
205
- "import/no-extraneous-dependencies": [
206
- "error",
207
- { devDependencies: FILES_TEST },
208
- ],
209
206
  "jest/no-jest-import": "off",
210
207
  },
211
208
  });
212
209
  };
213
210
 
214
211
  /**
215
- *
212
+ * Creates Vitest-specific test configuration
216
213
  * @param {object} options Configuration options
217
214
  * @param {boolean} options.typescript Whether to include typescript rules
218
215
  */
219
216
  const vitestTestConfig = (options) => {
220
- return tseslint.config({
217
+ return eslintConfig.defineConfig({
221
218
  extends: [vitestPlugin.configs.recommended],
222
219
  files: FILES_TEST,
223
220
  languageOptions: {
@@ -225,33 +222,40 @@ const vitestTestConfig = (options) => {
225
222
  ...(options.typescript ? typescriptLanguageOptions() : {}),
226
223
  },
227
224
  plugins: { vitest: vitestPlugin },
228
- rules: {
229
- "import/no-extraneous-dependencies": [
230
- "error",
231
- { devDependencies: FILES_TEST },
232
- ],
233
- },
234
225
  });
235
226
  };
236
227
 
237
228
  /**
238
- *
229
+ * Creates test configuration for the specified framework
239
230
  * @param {object} options Configuration options
240
231
  * @param {boolean} options.typescript Whether to include typescript rules
241
232
  * @param {"jest" | "vitest"} options.testFramework Test framework to use
233
+ * @returns {ReturnType<typeof eslintConfig.defineConfig>} ESLint configuration for test files
242
234
  */
243
235
  const testConfig = (options) => {
244
- if (options.testFramework === "vitest") {
245
- return vitestTestConfig(options);
246
- }
247
- return jestTestConfig(options);
236
+ const frameworkConfig =
237
+ options.testFramework === "vitest"
238
+ ? vitestTestConfig(options)
239
+ : jestTestConfig(options);
240
+
241
+ return eslintConfig.defineConfig(...frameworkConfig, {
242
+ files: FILES_TEST,
243
+ rules: {
244
+ "import/no-extraneous-dependencies": [
245
+ "error",
246
+ { devDependencies: FILES_TEST },
247
+ ],
248
+ },
249
+ });
248
250
  };
249
251
 
250
252
  /**
251
- * @param {string[]} ignores
253
+ * Creates ignore patterns configuration
254
+ * @param {string[]} ignores Additional patterns to ignore
255
+ * @returns {ReturnType<typeof eslintConfig.defineConfig>} ESLint configuration with ignore patterns
252
256
  */
253
257
  const ignoresConfig = (ignores = []) =>
254
- tseslint.config({
258
+ eslintConfig.defineConfig({
255
259
  ignores: ["**/.yalc", "**/dist", ...ignores],
256
260
  });
257
261
 
@@ -279,7 +283,7 @@ module.exports = function config(options = {}) {
279
283
  testFramework === "vitest" ? ["nock"] : ["@jest/globals", "nock"];
280
284
  const allowModules = options.allowModules || defaultAllowModules;
281
285
 
282
- return tseslint.config(
286
+ return eslintConfig.defineConfig(
283
287
  javascriptConfig(options.ecmaVersion),
284
288
  importConfig(),
285
289
  nPluginConfig(allowModules),
package/package.json CHANGED
@@ -56,6 +56,6 @@
56
56
  "access": "public"
57
57
  },
58
58
  "repository": "https://github.com/open-turo/eslint-config-typescript",
59
- "version": "18.1.0-pr-440.293.1.1",
59
+ "version": "18.1.0-pr-440.295.1.1",
60
60
  "packageManager": "npm@11.6.1"
61
61
  }