Skip to content

Commit

Permalink
fix: @vue/cli-service can be an optional peer dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Feb 15, 2020
1 parent c06f89e commit 3276eae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
20 changes: 13 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
// https://github.com/benmosher/eslint-plugin-import/issues/1396
const resolver = {
[require.resolve('eslint-import-resolver-node')]: {},
}

// in case the project does not depend on @vue/cli-service
try {
resolver[require.resolve('eslint-import-resolver-webpack')] = {
config: require.resolve('@vue/cli-service/webpack.config.js'),
}
} catch (e) {}

module.exports = {
extends: [
require.resolve('eslint-config-standard')
],
settings: {
'import/resolver': {
// https://github.com/benmosher/eslint-plugin-import/issues/1396
[require.resolve('eslint-import-resolver-node')]: {},
[require.resolve('eslint-import-resolver-webpack')]: {
config: require.resolve('@vue/cli-service/webpack.config.js'),
},
},
'import/resolver': resolver,
'import/extensions': [
'.js',
'.jsx',
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,10 @@
"eslint-plugin-promise": ">= 4.2.1",
"eslint-plugin-standard": ">= 4.0.0",
"eslint-plugin-vue": ">= 6.1.2"
},
"peerDependenciesMeta": {
"@vue/cli-service": {
"optional": true
}
}
}

0 comments on commit 3276eae

Please sign in to comment.