From 58a0f99147b615c127a71c0e782acbe58e613af2 Mon Sep 17 00:00:00 2001 From: James Rogers Date: Tue, 22 Jun 2021 16:25:57 -0700 Subject: [PATCH 1/2] use import plugin directly and remove airbnb extension, still no report --- .eslintrc.js | 9 +++++++-- foo/index.js | 5 ++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 1b24c7e..4d6cb04 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,10 +5,15 @@ module.exports = { node: true, }, extends: [ - 'airbnb-base', + // 'plugin:import/recommended', + // 'airbnb-base', + ], + plugins: [ + 'import' ], parserOptions: { ecmaVersion: 11, + sourceType: 'module', }, settings: { 'import/internal-regex': '^@my/', @@ -19,7 +24,7 @@ module.exports = { }, }, rules: { - 'import/no-unresolved': [2, { commonjs: true, amd: true }], + // 'import/no-unresolved': [2, { commonjs: true, amd: true }], 'import/named': 2, }, }; diff --git a/foo/index.js b/foo/index.js index 7993d32..b201b12 100644 --- a/foo/index.js +++ b/foo/index.js @@ -1,6 +1,5 @@ -function helloFoo() { +// eslint-disable-next-line import/prefer-default-export +export function helloFoo() { // eslint-disable-next-line no-console console.log('hello foo'); } - -module.exports = { helloFoo }; From dac6fe0d15971460f6da5704688fcfc5293355e2 Mon Sep 17 00:00:00 2001 From: James Rogers Date: Fri, 25 Jun 2021 15:02:18 -0700 Subject: [PATCH 2/2] add import/ignore solution and semi rule --- .eslintrc.js | 4 +++- bar/index.js | 2 +- foo/index.js | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4d6cb04..e976590 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -22,9 +22,11 @@ module.exports = { extensions: ['.js'], }, }, + 'import/ignore': ['!^@my'], }, rules: { - // 'import/no-unresolved': [2, { commonjs: true, amd: true }], + 'import/no-unresolved': [2, { commonjs: true, amd: true }], 'import/named': 2, + 'semi': ['warn'], }, }; diff --git a/bar/index.js b/bar/index.js index b679736..fcf0981 100644 --- a/bar/index.js +++ b/bar/index.js @@ -1,4 +1,4 @@ const { helloFoo, helloFooV2 } = require('@my/foo'); helloFoo(); -helloFooV2(); +helloFooV2() diff --git a/foo/index.js b/foo/index.js index b201b12..ee2cc0e 100644 --- a/foo/index.js +++ b/foo/index.js @@ -1,5 +1,3 @@ -// eslint-disable-next-line import/prefer-default-export export function helloFoo() { - // eslint-disable-next-line no-console console.log('hello foo'); }