Closed ashtonian closed 7 years ago
That's odd... what version do you see running eslint --version
? Also it's advised to run a local installation of eslint
in each project instead of a global one, that way everyone working on the project is using the same setup :wink:.
Just as an FYI, this is an issue with your configuration of eslint
, which is odd as you say it was generated by eslint
...
I believe this is due to a new feature in the latest v of eslint - they just added string based severity settings ie "error" vs 2. It looks like they decided to make that the default behavior of eslint init?
2.3 was released 4 days ago: http://eslint.org/blog/2016/03/eslint-v2.3.0-released https://github.com/eslint/eslint/releases
Yes, it's now the form that is generated by --init
, since it is easier for new users of the tool to understand. It actually looks like this is a bug in the config validator, since it is saying you passed "2"
, which you didn't. Could you open an issue at ESLint after verifying your version number and that the behavior exists when you run it on the command line as well?
What's the status on updating to the latest version of the eslint init configuration? I see the linter is on 2.4.0
, but eslint is now up to 2.7.0
.
@nickroberts the version of ESLint that is bundled with linter-eslint is intended as a last-resort fallback. Ideally, you should install eslint into your project with npm install --save-dev eslint
. Or, second best, you can install it globally with npm install -g eslint
.
If you do install locally, you can run it on the cli with node_modules/.bin/eslint
, or you can add it to an npm script so that you can npm run lint
, for example.
Does this help at all?
I have eslint
installed locally. I still get the error Configuration for rule "indent" is invalid: Severity should be one of the following: 0 = off, 1 = warning, 2 = error (you passed "error").
I can run eslint via the command line, fine, but the Atom Linter goes :boom: with the big red box.
I was just wondering if the linter was going to be able to use the new eslint --init
configuration.
Thanks!
@nickroberts the version of ESLint that is bundled with linter-eslint is intended as a last-resort fallback. Ideally, you should install eslint into your project with npm install --save-dev eslint. Or, second best, you can install it globally with npm install -g eslint.
In that case, it's better that linter-eslint
remove its bundled one and use directly the one installed on the project or the global one or disable itself if none is found.
@piranna can you explain why you believe that it would be better not to provide a fallback?
@nickroberts Do you have the Use global ESLint installation
option checked, by chance? It seems that linter-eslint is not picking up your local installation correctly.
I did not have that option checked, however, I restarted Atom, and it works now. Not sure what was going on there. Weird.
Turn it off and turn it back on
- IT support's first suggestion for a reason
@piranna can you explain why you believe that it would be better not to provide a fallback?
This way it will force users to set it as devDependency
on their projects, and also it will be always the same version used both on the terminal and by linter-eslint
. I see this movement similar to the one of eslint
when it removed any default configuration, to force users to enable it according to their preferences.
@piranna setting it as a devDependency on their projects has nothing to do with the version used on the terminal, unless you specifically run something like ./node_modules/.bin/eslint foo.js
.
Personally I'd be for removing it as it causes issues with users falling back to it when they expect something different (and then doing silly things like installing their project's dependencies inside the package to "just get it working").
@Arcanemagus I think I agree. It's a common source of confusion. We would just need to be clear in the docs that eslint
must be installed separately.
Personally I'd be for removing it as it causes issues with users falling back to it when they expect something different (and then doing silly things like installing their project's dependencies inside the package to "just get it working").
+1
We would just need to be clear in the docs that eslint must be installed separately.
+1 too, I think this is the way to go.
@nickroberts I am getting this issue too. What did you do to fix it? "Turning it off and on again" didnt work for me :/
Edit: I replaced all the "errors" with 2 and that fixed it for me
This issue is a result of creating a config file that is not compatible with the version of eslint that is being used by linter-eslint
. If you aren't sure which eslint is being used, you can run the command Linter Eslint: Debug
from the Atom command palette if you are using at least version 8.0.0
of linter-eslint.
As this is not a bug in this package, I'm going to close this issue.
I tried did the following setting to my .eslinrc file to fix the problem { "root": true, "env": { "es6": true, "browser": true }, "extends": [ "airbnb" ], "settings": { "import/resolver": { "node": { "paths": [ "." ], "extensions": [ ".js", ".jsx" ] } } }, "rules": { "linebreak-style": 0, "eslint linebreak-style": [0, "error", "windows"], "comma-dangle": "off", "jsx-a11y/anchor-is-valid": "off", "max-len": "off", "no-console": "off", "no-plusplus": "off", "react/forbid-prop-types": "off", "react/jsx-filename-extension": "off", "react/jsx-props-no-spreading": "off", "react/react-in-jsx-scope": "off", "react/require-default-props": "off" } }
anyone have solution for vscode ?
Version: 1.73.0-insider (Universal)
Commit: 3544aabd5a2b0da2cd3a6f3fa3f00759aa9d9709
Date: 2022-10-27T21:41:11.954Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 21.6.0
Sandboxed: Yes
i got same issue
[Error - 3:34:38 PM] .eslintrc.js: Configuration for rule "parser" is invalid: Severity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '"@babel/eslint-parser"').
here is my .eslintrc.js
module.exports = {
root: true,
env: {
node: true
},
extends: [
// 'plugin:vue/recommended',
// '@vue/airbnb',
'plugin:vue/essential',
'plugin:prettier/recommended',
'eslint:recommended'
],
// plugins: ['prettier'],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
semi: ['error', 'never'],
'prettier/prettier': 'error',
parser: '@babel/eslint-parser',
parserOptions: { requireConfigFile: 'false' },
babelOptions: { configFile: './.babelrc' },
'max-len': 'off',
'linebreak-style': 'off',
camelcase: [
'error',
{
properties: 'never',
ignoreDestructuring: true,
ignoreImports: true
}
],
'arrow-parens': [true, 'ban-single-arg-parens', 'error', 'as-needed'],
'vue/multiline-html-element-content-newline': 'off',
'no-underscore-dangle': 'off',
// 'ignoreDestructuring': false ,
'template-curly-spacing': 'off',
indent: [
'error',
2,
{
ignoredNodes: ['TemplateLiteral']
}
]
}
}
then here is my package.json
"devDependencies": {
"@volar-plugins/vetur": "^0.1.0",
"@vue/cli-plugin-babel": "~4.5.9",
"@vue/cli-plugin-eslint": "~4.5.9",
"@vue/cli-plugin-router": "~4.5.9",
"@vue/cli-plugin-vuex": "~4.5.9",
"@vue/cli-service": "~4.5.9",
"@vue/compiler-dom": "^3.2.41",
"@vue/eslint-config-airbnb": "^5.3.0",
"@vue/runtime-dom": "^3.2.41",
"@vuepress/plugin-medium-zoom": "^1.7.1",
"babel-eslint": "^10.0.3",
"eslint": "^6.8.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "6.2.2",
"prettier": "^2.7.1",
"sass": "1.32.*",
"sass-loader": "^10.1.0",
"vue-template-compiler": "2.x"
}
You have parser
under rules
but it should be in the top level
Hello! i'm not sure who's this problem is but I recently installed linter-eslint, I went through the eslint init and answered questions. The json object below is the result of that. Atom then seemed to freak out. I changed "error" out for 2 and it seemed to fix it. Please see attached and if this belongs to someone else let me know here to go.