Skip to content

Commit

Permalink
change import pluging
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Ezequiel Fabbroni Assum committed Dec 2, 2024
1 parent 5f24769 commit afa2424
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 35 deletions.
32 changes: 1 addition & 31 deletions configs/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -59,7 +31,7 @@ const configs = [
bestPractices,
errors,
es6,
imports,
...imports,
node,
promises,
strict,
Expand All @@ -83,8 +55,6 @@ const overrides = [
},
].filter(Boolean);

console.log({ tsConfigs });

export default [
...configs,
{
Expand Down
5 changes: 3 additions & 2 deletions configs/imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ 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: {
...globals.es2015,
},
},
plugins: {
import: importPlugin,
'simple-import-sort': simpleImportSort,
},
settings: {
Expand Down Expand Up @@ -275,3 +274,5 @@ export default {
'import/no-relative-parent-imports': 'off',
},
};

export default [importPlugin.flatConfigs.recommended, configs];
1 change: 1 addition & 0 deletions configs/ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,5 @@ if (tsLintConfig.length) {
});
}

// eslint-disable-next-line import/prefer-default-export
export { tsLintConfig };
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
Expand Down

0 comments on commit afa2424

Please sign in to comment.