Skip to content

Instantly share code, notes, and snippets.

@karanssj4
Created March 2, 2018 07:57
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karanssj4/7188528ab36fb4e78c8fc385510f3136 to your computer and use it in GitHub Desktop.
Save karanssj4/7188528ab36fb4e78c8fc385510f3136 to your computer and use it in GitHub Desktop.
Make eslint work with vueJs with eslint-plugin-vue (tested with eslint-plugin-vue v4.3.0)
// http://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
sourceType: 'module',
parser: 'babel-eslint',
},
env: {
browser: true,
},
// required to lint *.vue files
plugins: [
'vue'
],
extends: [
'eslint:recommended',
'airbnb',
'plugin:vue/recommended'
],
// add your custom rules here
rules: {
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'import/extensions': ['error', 'always', {
js: 'never',
vue: 'never'
}]
},
settings: {
'import/resolver': {
node: {
extensions: ['.js','.jsx','.vue']
}
},
}
}
@karanssj4
Copy link
Author

resolves .vue files so that you can import vue components without specifying .vue extension

@starandtina
Copy link

👍

@Definence
Copy link

👍

@yogendrajs
Copy link

how to resolve import/no-unresolved when importing TS files in JS in React, any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment