diff --git a/configs/base.js b/configs/base.js index 88b7b27..64e729c 100644 --- a/configs/base.js +++ b/configs/base.js @@ -19,34 +19,6 @@ import strict from './strict.js'; import style from './style.js'; import variables from './variables.js'; -/* -async function checkIsTSAvailable() { - try { - // Dynamically import the package - await import('typescript'); - console.log(`Package typescript is available`); - return true; - } catch (error) { - console.log(error); - console.log(`Package typescript is not available`); - return false; - } -} - -async function checkJestTSAvailable() { - try { - // Dynamically import the package - await import('jest'); - console.log(`Package jest is available`); - return true; - } catch (error) { - console.log(error); - console.log(`Package jest is not available`); - return false; - } -} -*/ - const isTSAvailable = await isPackageAvailable('typescript'); let tsConfigs = []; if (isTSAvailable) { @@ -59,7 +31,7 @@ const configs = [ bestPractices, errors, es6, - imports, + ...imports, node, promises, strict, @@ -83,8 +55,6 @@ const overrides = [ }, ].filter(Boolean); -console.log({ tsConfigs }); - export default [ ...configs, { diff --git a/configs/imports.js b/configs/imports.js index 2a77127..6e5c9be 100644 --- a/configs/imports.js +++ b/configs/imports.js @@ -2,7 +2,7 @@ import importPlugin from 'eslint-plugin-import'; import simpleImportSort from 'eslint-plugin-simple-import-sort'; import globals from 'globals'; -export default { +const configs = { name: 'imports-cabify-eslint-config', languageOptions: { globals: { @@ -10,7 +10,6 @@ export default { }, }, plugins: { - import: importPlugin, 'simple-import-sort': simpleImportSort, }, settings: { @@ -275,3 +274,5 @@ export default { 'import/no-relative-parent-imports': 'off', }, }; + +export default [importPlugin.flatConfigs.recommended, configs]; diff --git a/configs/ts.js b/configs/ts.js index a45a17d..3a53796 100644 --- a/configs/ts.js +++ b/configs/ts.js @@ -158,4 +158,5 @@ if (tsLintConfig.length) { }); } +// eslint-disable-next-line import/prefer-default-export export { tsLintConfig }; diff --git a/package.json b/package.json index 0999faa..676b63a 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@typescript-eslint/parser": "^8.4.0", "confusing-browser-globals": "^1.0.10", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.30.0", + "eslint-plugin-import": "^2.31.0", "eslint-plugin-jest": "^28.8.3", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-lodash": "^7.4.0", diff --git a/yarn.lock b/yarn.lock index 84d6cce..a6579f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -663,7 +663,7 @@ eslint-module-utils@^2.12.0: dependencies: debug "^3.2.7" -eslint-plugin-import@^2.30.0: +eslint-plugin-import@^2.31.0: version "2.31.0" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz#310ce7e720ca1d9c0bb3f69adfd1c6bdd7d9e0e7" integrity sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==