Hello and thank you for this wonderful plugin.
Tell us about your environment
Please show your full configuration:
module.exports = {
root: true,
extends: 'standard',
// extends: [
// 'eslint:standard',
// 'plugin:vue/essential'
// ],
parserOptions: {
sourceType: 'module',
},
plugins: [
'vue'
],
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true
},
rules: {
'no-console': 0,
'no-undef': 0,
'semi': [2, 'always'],
'space-before-function-paren': 0,
'object-property-newline': 0
}
}
What did you expect to happen?
With this config, ESLint is linting only .js files on every save and that's my wanted behavior but also with .vue files in the src folder. When I try uncommenting the _extends_ array, it does not work.
What actually happened? Please include the actual, raw output from ESLint.
ESLint is throwing the classic ELIFECYCLE error with the current config. It was linting .js files in the root folder, but I can't manage to make it work with .vue files. Also tried eslint-plugin-html, but the documentation said it can have onflicts with this plugin so I kicked it out of the project.
Okay, this is my 2nd submitted issue after ~20 hours of trying to find the error and after submitting, I've fixed it in 20 mins. Sorry for the mess.
Anyways, the issue was in this line:
'eslint:standard',
and it should look like this:
'standard'
so my .eslintrc.js file looks like this now (and it's working):
module.exports = {
root: true,
extends: [
'standard',
'plugin:vue/recommended'
],
parserOptions: {
sourceType: 'module',
},
plugins: [
'vue'
],
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true
},
rules: {
'no-console': 0,
'no-undef': 0,
'semi': [2, 'always'],
'space-before-function-paren': 0,
'object-property-newline': 0,
'vue/order-in-components': 0,
"vue/max-attributes-per-line": [2, {
"singleline": 2,
"multiline": {
"max": 2,
"allowFirstLine": false
}
}]
}
}
I'm not really sure why the mentioned line is cousing problems, cuz I found it in the readme file of this very project.
Our README.md mentions eslint:recommended embedded preset. On the other hand, standard is a shorthand of eslint-config-standard, and eslint:standard doesn't exist.
The .eslintrc file does not control target files. Target files are decided by how eslint runs. For example, the CLI ./node_modules/.bin/eslint "src/**/*.{js,vue}" will lint .js and .vue files in src folder. If you use editor integrations, I think there is an editor setting to run ESLint on .vue files. For example, vscode needs the following setting:
{
"eslint.validate": [
"javascript",
"javascriptreact",
{"language": "vue", "autoFix": true}
]
}
@mysticatea thank you for your explaination, it helped a lot.
Also you can use --ext flag while running eslint command:
eslint src --ext .js,.vue
What is the setting for Sublime Text 3?
I found the solution for god sakes!! 馃檶
In your Sublime Linter settings:
{
"linters": {
"eslint": {
"selector": "source.js, text.html.vue"
}
}
}
I found the solution for god sakes!!
In your Sublime Linter settings:{ "linters": { "eslint": { "selector": "source.js, text.html.vue" } } }You save my day! Thank's a lot! ;D
Most helpful comment
Our README.md mentions
eslint:recommendedembedded preset. On the other hand,standardis a shorthand ofeslint-config-standard, andeslint:standarddoesn't exist.The
.eslintrcfile does not control target files. Target files are decided by how eslint runs. For example, the CLI./node_modules/.bin/eslint "src/**/*.{js,vue}"will lint.jsand.vuefiles insrcfolder. If you use editor integrations, I think there is an editor setting to run ESLint on.vuefiles. For example,vscodeneeds the following setting: